commit 8363637872d72e9f6a40716aaf20f5ec92ae3179 Author: oldmud0 Date: Wed Nov 11 21:27:28 2015 -0600 Version 1.07 from zip file (10/24/15) http://ux.getuploader.com/ainefill/download/342/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be87538 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ + +#ignore thumbnails created by windows +Thumbs.db +#Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* + +ipch*/ +*.ipch +LilithPort.sdf diff --git a/LilithPort.sln b/LilithPort.sln new file mode 100644 index 0000000..3175918 --- /dev/null +++ b/LilithPort.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LilithPort", "LilithPort\LilithPort.vcproj", "{9057AFAF-D9A2-4F09-8D35-C39084BA2A87}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9057AFAF-D9A2-4F09-8D35-C39084BA2A87}.Debug|Win32.ActiveCfg = Debug|Win32 + {9057AFAF-D9A2-4F09-8D35-C39084BA2A87}.Debug|Win32.Build.0 = Debug|Win32 + {9057AFAF-D9A2-4F09-8D35-C39084BA2A87}.Release|Win32.ActiveCfg = Release|Win32 + {9057AFAF-D9A2-4F09-8D35-C39084BA2A87}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/LilithPort/AssemblyInfo.cpp b/LilithPort/AssemblyInfo.cpp new file mode 100644 index 0000000..f1bae86 --- /dev/null +++ b/LilithPort/AssemblyInfo.cpp @@ -0,0 +1,40 @@ +#include "stdafx.h" + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +// +// ƒAƒZƒ“ƒuƒŠ‚ÉŠÖ‚·‚éˆê”Êî•ñ‚͈ȉº‚Ì‘®«ƒZƒbƒg‚ð‚Æ‚¨‚µ‚ħŒä‚³‚ê‚Ü‚·B +// ƒAƒZƒ“ƒuƒŠ‚ÉŠÖ˜A•t‚¯‚ç‚ê‚Ä‚¢‚éî•ñ‚ð•ÏX‚·‚é‚É‚ÍA +// ‚±‚ê‚ç‚Ì‘®«’l‚ð•ÏX‚µ‚Ä‚­‚¾‚³‚¢B +// +[assembly:AssemblyTitleAttribute("LilithPort")]; +[assembly:AssemblyDescriptionAttribute("")]; +[assembly:AssemblyConfigurationAttribute("")]; +[assembly:AssemblyCompanyAttribute("")]; +[assembly:AssemblyProductAttribute("LilithPort")]; +[assembly:AssemblyCopyrightAttribute("Copyright (c) 2014")]; +[assembly:AssemblyTrademarkAttribute("")]; +[assembly:AssemblyCultureAttribute("")]; + +// +// ƒAƒZƒ“ƒuƒŠ‚̃o[ƒWƒ‡ƒ“î•ñ‚ÍAˆÈ‰º‚Ì 4 ‚‚̒l‚Å\¬‚³‚ê‚Ä‚¢‚Ü‚·: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// ‚·‚ׂĂ̒l‚ðŽw’è‚·‚é‚©A‰º‚̂悤‚É '*' ‚ðŽg‚Á‚ăŠƒrƒWƒ‡ƒ“‚¨‚æ‚уrƒ‹ƒh”Ô†‚ð +// Šù’è’l‚É‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·: + +[assembly:AssemblyVersionAttribute("1.0.0.0")]; + +[assembly:ComVisible(false)]; + +[assembly:CLSCompliantAttribute(true)]; + +[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; diff --git a/LilithPort/LilithPort.cpp b/LilithPort/LilithPort.cpp new file mode 100644 index 0000000..5429b7b --- /dev/null +++ b/LilithPort/LilithPort.cpp @@ -0,0 +1,85 @@ +// LilithPort.cpp : ƒƒCƒ“ ƒvƒƒWƒFƒNƒg ƒtƒ@ƒCƒ‹‚Å‚·B + +#include "stdafx.h" +#include "MainForm.h" +#include + +using namespace LilithPort; + +// ƒOƒ[ƒoƒ‹ +MT_SP_INFORMATION MTINFO; +MT_SP_OPTION MTOPTION; +MT_SP_WINDOW_STATE MTWS; +MT_SP_COLOR MTCOLOR; + +CRITICAL_SECTION CS_CAPTION; + +[STAThreadAttribute] +int main(array ^args) +{ + // ƒRƒ“ƒgƒ[ƒ‹‚ªì¬‚³‚ê‚é‘O‚ÉAWindows XP ƒrƒWƒ…ƒAƒ‹Œø‰Ê‚ð—LŒø‚É‚µ‚Ü‚· + Application::EnableVisualStyles(); + Application::SetCompatibleTextRenderingDefault(true); + + // Ž©ƒvƒƒOƒ‰ƒ€‚̃pƒX + TCHAR drive[_MAX_DRIVE], dir[_MAX_DIR]; + + GetModuleFileName(NULL, MTOPTION.PATH, _MAX_PATH); + _tsplitpath_s(MTOPTION.PATH, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL, 0, NULL, 0); + _stprintf_s(MTOPTION.PATH, _T("%s%s"), drive, dir); + + // ƒRƒ}ƒ“ƒhƒ‰ƒCƒ“ˆø” + if(args->Length > 0){ + if(args[0] == "-s"){ + MTINFO.SERVER_MODE = true; + if(args->Length > 1){ + try{ + MTINFO.SERVER_MODE_PORT = (UINT)Convert::ToInt32(args[1]); + } + catch(Exception^){ + MTINFO.SERVER_MODE_PORT = 0; + } + }else{ + MTINFO.SERVER_MODE_PORT = 0; + } + } + + } + +#ifdef _DEBUG + MTINFO.DEBUG = true; +#endif + + LoadMTOption(); + CheckMTOption(); + + // —”‚̉Šú‰»•‚Ü‚º‚Ü‚º + XorShift((UINT)DateTime::Now.Ticks); + XorShift(); + XorShift(); + XorShift(); + + // ‰¹—Ê(dB)‚ð‚ ‚ç‚©‚¶‚ߌvŽZ‚µ‚Ä‚¨‚­ + MTINFO.VOLUME[0] = -10000; + + for(int i = 1; i < 21; i++){ + // -6dB‚ʼn¹—Ê”¼Œ¸ADirectSound“I‚É‚Í-600 + // 19.931568f = -6.0f / log10(0.5f); + MTINFO.VOLUME[i] = (INT32)(19.931568f*log10((float)(i*5)/100.0f)*100.0f); + } + + InitializeCriticalSection(&CS_CAPTION); + + // –¢ˆ—‚Ì—áŠO‚ðƒLƒƒƒbƒ` + Application::ThreadException += gcnew ThreadExceptionEventHandler(ApplicationThreadException); + Threading::Thread::GetDomain()->UnhandledException += gcnew UnhandledExceptionEventHandler(ApplicationUnhandledException); + + // ƒƒCƒ“ ƒEƒBƒ“ƒhƒE‚ð쬂µ‚ÄAŽÀs‚µ‚Ü‚· + Application::Run(gcnew MainForm()); + + DeleteCriticalSection(&CS_CAPTION); + + SaveMTOption(); + + return 0; +} diff --git a/LilithPort/LilithPort.vcproj b/LilithPort/LilithPort.vcproj new file mode 100644 index 0000000..9acca3d --- /dev/null +++ b/LilithPort/LilithPort.vcproj @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LilithPort/MainForm.cpp b/LilithPort/MainForm.cpp new file mode 100644 index 0000000..fb65035 --- /dev/null +++ b/LilithPort/MainForm.cpp @@ -0,0 +1,3599 @@ +#include "stdafx.h" +#include "MainForm.h" + +using namespace LilithPort; + +void MainForm::Begin() +{ + ServerName = gcnew String(MTOPTION.SERVER_NAME); + ConnectIP = gcnew String(MTOPTION.CONNECTION_IP); + + ServerMode = SM_NORMAL; + MTINFO.VERSION_CHECKED = false; + + MemberInfo^ me = gcnew MemberInfo; + me->IP_EP = gcnew IPEndPoint(0, 0); + me->ID = 0; + me->NAME = gcnew String(MTOPTION.NAME); + me->COMMENT = gcnew String(MTOPTION.COMMENT); + me->TYPE = MTOPTION.CONNECTION_TYPE; + me->STATE = MS_FREE; + me->RESPONSE = timeGetTime(); + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER && ServerName->Length > 0){ + + MemberInfoBackUp^ bk = gcnew MemberInfoBackUp; + bk->IP_EP = gcnew IPEndPoint(0, 0); + bk->ID = 0; + + // “ÁŽêƒT[ƒoƒ‚[ƒh”»’è + if(ServerName[0] == '#'){ + ServerMode = SM_NORA; + ListView = LV_BLIND; + me->NAME = gcnew String("Ÿ"); + me->COMMENT = String::Empty; + + MemberList->Add(me); + MemberListBackUp->Add(bk); + listBoxMember->Items->Add(gcnew String("–쎎‡‰ïê")); + } + else{ + MemberList->Add(me); + MemberListBackUp->Add(bk); + listBoxMember->Items->Add(me->NAME); + + if(ServerName[0] == '+'){ + ServerMode = SM_MIX; + } + else if(ServerName[0] == '@'){ + ServerMode = SM_MATCH; + } + } + } + else{ + MemberList->Add(me); + listBoxMember->Items->Add(me->NAME); + } + + try{ + // ‰ñüÝ’è + if(MTOPTION.CONNECTION_TYPE == CT_SERVER || MTOPTION.CONNECTION_TYPE == CT_HOST){ + UDP = gcnew UdpClient(MTOPTION.OPEN_PORT); + } + else if(MTOPTION.CONNECTION_TYPE == CT_CLIENT){ + UDP = gcnew UdpClient; + } + } + catch(SocketException^ e){ + UDP = nullptr; + + if(e->ErrorCode == WSAEADDRINUSE){ + WriteMessage("ŠJ•úƒ|[ƒg‚ª‘¼‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚ÅŽg—p‚³‚ê‚Ä‚¢‚Ü‚·B\n", ErrorMessageColor); + } + else{ + WriteMessage(String::Format("UDP‚̉Šú‰»‚ÉŽ¸”s‚µ‚Ü‚µ‚½B({0})\n", e->ErrorCode), ErrorMessageColor); + if(MTINFO.DEBUG){ + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + + // ƒlƒbƒg‚ÉÚ‘± + if(UDP != nullptr){ + + // Ý’è‚ð•Û‘¶ + SaveMTOption(); + + if(MTOPTION.AUTO_REST && MemberList[0]->STATE == MS_FREE){ + AutoRestThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunAutoRest)); + AutoRestThread->Start(); + } + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + + // ŽIŽóMŠJŽn + UDP->BeginReceive(gcnew AsyncCallback(ReceivePackets), this); + + // ƒ\ƒi[‹O“¹ + Ranging = true; + SonarThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunSonar)); + SonarThread->Start(); + + this->Text += String::Format(" [{0}] [Server Port:{1}]", ServerName, MTOPTION.OPEN_PORT); + WriteTime(0, SystemMessageColor); + WriteMessage("ƒT[ƒo‚Ì€”õ‚ªŠ®—¹‚µ‚Ü‚µ‚½B\n[ƒT[ƒo[’m]-------------------\n", SystemMessageColor); + + // WelcomeƒƒbƒZ[ƒW‚Ì•\Ž¦ + int len = _tcslen(MTOPTION.WELCOME); + for(int i = 0; i < len; i++){ + if(MTOPTION.WELCOME[i] == _T('\t')){ + MTOPTION.WELCOME[i] = _T('\n'); + } + } + richTextBoxLog->SelectionFont = gcnew Drawing::Font(richTextBoxLog->Font->FontFamily, richTextBoxLog->Font->Size + 2); + richTextBoxLog->SelectionColor = TalkMessageColor; + richTextBoxLog->SelectionBackColor = NoticeBackColor; + richTextBoxLog->AppendText(gcnew String(MTOPTION.WELCOME)+"\n"); + + WriteMessage("-------------------------------\n", SystemMessageColor); + + // IPƒAƒhƒŒƒX‚ðŽæ“¾‚µ‚Ä•\Ž¦ + if(MTOPTION.GET_IP_ENABLE){ + GetIPAddress(); + } + + } + else{ + // ƒNƒ‰ƒCƒAƒ“ƒg + _int64 address; + int port = MTOPTION.PORT; + array^ host = ConnectIP->Split(gcnew array{':'}, 2, StringSplitOptions::RemoveEmptyEntries); + + // ƒ|[ƒg":"Žw’è + if(host->Length > 1){ + try{ + port = Convert::ToInt32(host[1]); + } + catch(Exception^){ + port = MTOPTION.PORT; + } + } + + try{ + + // MTSPƒAƒhƒŒƒXÚ‘± + if(host[0]->Length == 5){ + try{ + if(MTINFO.DEBUG){ + WriteMessage("ƒAƒhƒŒƒX‚ð•ÏŠ·‚µ‚Ü‚·(MTSP)\n", DebugMessageColor); + } + address = MTDecryptionIP(host[0]); + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage("ƒAƒhƒŒƒX•ÏŠ·(MTSP)Ž¸”s\n", ErrorMessageColor); + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + + // •ÏŠ·ƒAƒhƒŒƒXÚ‘±(ASCII) + if(address == 0){ + try{ + if(MTINFO.DEBUG){ + WriteMessage("ƒAƒhƒŒƒX‚ð•ÏŠ·‚µ‚Ü‚·(ASCII)\n", DebugMessageColor); + } + address = DecryptionIP(host[0], true); + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage("ƒAƒhƒŒƒX•ÏŠ·(ASCII)Ž¸”s\n", ErrorMessageColor); + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + + // DNSÚ‘± + if(address == 0){ + try{ + if(MTINFO.DEBUG){ + WriteMessage("DNS‚ðŽæ“¾‚µ‚Ü‚·\n", DebugMessageColor); + } + address = Dns::GetHostEntry(host[0])->AddressList[0]->Address; + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage("DNSŽæ“¾Ž¸”s\n", ErrorMessageColor); + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + address = 0; + } + } + + // •ÏŠ·ƒAƒhƒŒƒXÚ‘±(Unicode) + if(address == 0){ + try{ + if(MTINFO.DEBUG){ + WriteMessage("ƒAƒhƒŒƒX‚ð•ÏŠ·‚µ‚Ü‚·(Unicode)\n", DebugMessageColor); + } + address = DecryptionIP(host[0], false); + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage("ƒAƒhƒŒƒX•ÏŠ·(Unicode)Ž¸”s\n", ErrorMessageColor); + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + + // ƒ[ƒJƒ‹Ú‘±—p + /* + if(address == 0){ + try{ + if((host[0]->StartsWith("192.168.", StringComparison::OrdinalIgnoreCase))) { + address = IPAddress::Parse(host[0])->Address; + } + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage("ƒ[ƒJƒ‹Ú‘±Ž¸”s\n", ErrorMessageColor); + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + address = 0; + } + } + */ + + + if(address == 0){ + WriteMessage("Ú‘±æ‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½B\n", ErrorMessageColor); + throw gcnew SocketException; + } + + IPEndPoint^ ep = gcnew IPEndPoint(address, port); + if(MTINFO.DEBUG){ + WriteMessage(String::Format("Connect > {0}\n", ep), DebugMessageColor); + } + + PacketPacker^ pp = gcnew PacketPacker; + array^ name = Encoding::Unicode->GetBytes(me->NAME); + array^ cmnt = Encoding::Unicode->GetBytes(me->COMMENT); + + pp->Pack(MTOPTION.CONNECTION_TYPE == CT_CLIENT ? (BYTE)PH_REQ_CONNECTION : (BYTE)PH_REQ_CONNECTION_H); + pp->Pack(TYMT_VERSION); + pp->Pack((BYTE)name->Length); + pp->Pack(name); + pp->Pack((BYTE)cmnt->Length); + pp->Pack(cmnt); + + // ƒT[ƒo‚ÉÚ‘±—v‹ + UDP->Send(pp->Packet, pp->Length, ep); + + // •ÔM‘Ò‚¿ + UDP->Client->ReceiveTimeout = TIME_OUT; + array^ rcv = UDP->Receive(ep); + UDP->Client->ReceiveTimeout = 0; + + PacketDivider^ pd = gcnew PacketDivider(rcv); + + // Ú‘±OK + if(pd->Divide() == PH_RES_CONNECTION){ + int len = pd->Divide(); + + ServerName = Encoding::Unicode->GetString(pd->Divide(len)); + MemberList[0]->ID = BitConverter::ToUInt16(pd->Divide(2), 0); + + if(MemberList[0]->ID > MAX_ID){ + throw gcnew SocketException; + } + + MemberInfo^ mi = gcnew MemberInfo; + mi->IP_EP = ep; + mi->ID = 0; + mi->TYPE = CT_SERVER; + mi->NUM_VS = 0; + mi->RESPONSE = timeGetTime(); + + // –¼‘O + len = pd->Divide(); + mi->NAME = Encoding::Unicode->GetString(pd->Divide(len)); + + // ƒRƒƒ“ƒg + len = pd->Divide(); + mi->COMMENT = Encoding::Unicode->GetString(pd->Divide(len)); + + // ó‘Ô + mi->STATE = pd->Divide(); + + MemberList->Add(mi); + AddListView(mi); + + // ƒo[ƒWƒ‡ƒ“Šm”F + UINT ServerVersion; + try{ + // 1.03ˆÈã‚È‚ç—ˆ‚é + ServerVersion = pd->Divide(); + MTINFO.VERSION_CHECKED = true; + } + catch(Exception^){ + MTINFO.VERSION_CHECKED = false; + } + if(MTINFO.VERSION_CHECKED) { + WriteMessage(String::Format("ƒT[ƒo‚̃o[ƒWƒ‡ƒ“ : v{0}\n", ServerVersion), SystemMessageColor); + if(LP_VERSION > ServerVersion){ + WriteMessage("ƒT[ƒo‚̃o[ƒWƒ‡ƒ“‚ªŒÃ‚¢‚½‚ßAˆê•”‹@”\‚̌݊·«‚ªŽæ‚ê‚È‚¢ê‡‚ª‚ ‚è‚Ü‚·B\n", ErrorMessageColor); + } + else if(LP_VERSION < ServerVersion) { + WriteMessage("LilithPort‚̃o[ƒWƒ‡ƒ“‚ªƒT[ƒo‚æ‚è’á‚¢‚½‚ßAˆê•”‹@”\‚̌݊·«‚ªŽæ‚ê‚È‚¢ê‡‚ª‚ ‚è‚Ü‚·B\nÅVƒo[ƒWƒ‡ƒ“‚ðŠm”F‚µ‚Ä‚­‚¾‚³‚¢B\n", ErrorMessageColor); + } + } + else{ + WriteMessage("MTSP, ‚Ü‚½‚͌¢ƒo[ƒWƒ‡ƒ“‚ÌLilithPortƒT[ƒo‚Å‚·Bˆê•”‹@”\‚̌݊·«‚ªŽæ‚ê‚È‚¢ê‡‚ª‚ ‚è‚Ü‚·B\n", ErrorMessageColor); + } + + // ‘ ŽóMŠJŽn + UDP->BeginReceive(gcnew AsyncCallback(ReceivePackets), this); + + + if(MTOPTION.CONNECTION_TYPE == CT_HOST){ + this->Text += String::Format(" [{0}] [Host Port:{1}]", ServerName, MTOPTION.OPEN_PORT); + } + else{ + this->Text += String::Format(" [{0}] [Client]", ServerName); + } + WriteMessage(String::Format("{0}‚ÉÚ‘±‚µ‚Ü‚µ‚½B (ID = {1})\n", ServerName, me->ID), SystemMessageColor); + + if(ServerName->Length > 0){ + if(ServerName[0] == '+'){ + ServerMode = SM_MIX; + WriteMessage("¬ÝƒT[ƒo‚Å‚·B\n", SystemMessageColor); + } + if(ServerName[0] == '@'){ + ServerMode = SM_MATCH; + WriteMessage("ƒ`ƒƒƒbƒg‹ÖŽ~ƒT[ƒo‚Å‚·B\n", SystemMessageColor); + } + else if(ServerName[0] == '#'){ + ServerMode = SM_NORA; + WriteMessage("‚¨‚¨‚Á‚ÆI –ì—ǃT[ƒo\n", SystemMessageColor); + + ListView = LV_BLIND; + listBoxMember->Items[0] = gcnew String("–쎎‡‰ïê"); + } + } + + // ƒƒ“ƒo[ƒŠƒXƒg‚ð—v‹ + pp->Clear(); + pp->Pack(PH_REQ_LIST); + pp->Pack(0); + pp->Pack(0); + UDP->Send(pp->Packet, pp->Length, ep); + + // ƒ\ƒi[‹N“® + Ranging = true; + SonarThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunSonar)); + SonarThread->Start(); + } + else{ + throw gcnew SocketException; + } + } + catch(SocketException^ e){ + Leave(false); + + if(e->ErrorCode == 0){ + if(me->ID == 0xFFFF){ + WriteMessage(String::Format("{0}‚Í–žŽº‚Å‚·B\n", ServerName), ErrorMessageColor); + } + else if(me->ID == 0xFFFE){ + WriteMessage("–{‘̂̃o[ƒWƒ‡ƒ“‚ªˆá‚¢‚Ü‚·B\n", ErrorMessageColor); + } + else if(me->ID > MAX_ID){ + WriteMessage(String::Format("{0}‚Í‚±‚êˆÈãID‚ð”­s‚Å‚«‚Ü‚¹‚ñB\n", ServerName), ErrorMessageColor); + } + else if(address != 0){ + WriteMessage("ƒT[ƒo‚ÉÚ‘±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B\n‰ñü‚ª¬ŽG‚µ‚Ä‚¢‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B\n", ErrorMessageColor); + } + } + else{ + if(e->ErrorCode == WSAECONNRESET){ + WriteMessage("ƒT[ƒo‚̃|[ƒg‚ªŠJ‚¢‚Ä‚¢‚Ü‚¹‚ñB\n", ErrorMessageColor); + } + else if(e->ErrorCode == WSAETIMEDOUT){ + WriteMessage("ƒT[ƒo‚©‚ç‚̉ž“š‚ª‚ ‚è‚Ü‚¹‚ñ‚Å‚µ‚½B\nƒT[ƒo‚ª‰Ò“­‚µ‚Ä‚¢‚È‚¢‚©AƒAƒhƒŒƒX‚ªŠÔˆá‚Á‚Ä‚¢‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B\n", ErrorMessageColor); + } + else if(e->ErrorCode != WSAHOST_NOT_FOUND){ + WriteMessage(String::Format("ƒ\ƒPƒbƒgƒGƒ‰[ > {0}\n", e->ErrorCode), ErrorMessageColor); + } + if(MTINFO.DEBUG){ + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + } + } + else if(MTOPTION.CONNECTION_TYPE != CT_FREE){ + Leave(false); + } + else{ + this->Text += " [Free Play]"; + } +} + +void MainForm::PacketSendAllMember(array^% datagram, UINT received_id) +{ + Monitor::Enter(MemberList); + try{ + for(int i = 1; i < MemberList->Count; i++){ + if(received_id != MemberList[i]->ID){ + UDP->BeginSend(datagram, datagram->Length, MemberList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + } + finally{ + Monitor::Exit(MemberList); + } +} + +void MainForm::SendPackets(IAsyncResult^ asyncResult) +{ + UdpClient^ udp = (UdpClient^)asyncResult->AsyncState; + + try{ + udp->EndSend(asyncResult); + } + catch(ObjectDisposedException^){ + } +} + +void MainForm::ReceivePackets(IAsyncResult^ asyncResult) +{ + int i; + UINT16 id; + array ^send; + + MainForm^ form = safe_cast(asyncResult->AsyncState); + IPEndPoint^ ep = gcnew IPEndPoint(IPAddress::Any, 0); + + try{ + array^ rcv = UDP->EndReceive(asyncResult, ep); + UDP->BeginReceive(gcnew AsyncCallback(ReceivePackets), form); + + if(rcv->Length > MAX_PACKET){ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("Large Packet > {0} from {1}\n", rcv[0], ep->ToString()), DebugMessageColor); + } + return; + } + + switch(rcv[0]){ + case PH_PING: + rcv[0] = PH_PONG; + UDP->Send(rcv, rcv->Length, ep); + break; + + case PH_PONG: + if(rcv->Length == 1 && Ping > 0){ + form->WriteMessage(String::Format("Ping : {0}ms\n", timeGetTime() - Ping), SystemMessageColor); + Ping = 0; + } + break; + + case PH_REQ_CONNECTION: + case PH_REQ_CONNECTION_H: + // ŽI‚¶‚á‚È‚¢‚Ì‚ÉÚ‘±—v‹‚ª—ˆ‚½ + if(MTOPTION.CONNECTION_TYPE != CT_SERVER){ + break; + } + + Monitor::Enter(MemberList); + try{ + array^ a_id; + array^ saba = Encoding::Unicode->GetBytes(ServerName); + array^ name = Encoding::Unicode->GetBytes(MemberList[0]->NAME); + array^ cmnt = Encoding::Unicode->GetBytes(MemberList[0]->COMMENT); + + MemberInfo^ mi; + PacketPacker^ pp = gcnew PacketPacker; + PacketDivider^ pd = gcnew PacketDivider(rcv); + + i = pd->Divide() == PH_REQ_CONNECTION ? CT_CLIENT : CT_HOST; + + // ƒT[ƒo–¼ + pp->Pack(PH_RES_CONNECTION); + pp->Pack((BYTE)saba->Length); + pp->Pack(saba); + + // ID‚Ì”­s + if(MemberList->Count > (int)MTOPTION.MAX_CONNECTION){ + // –žŽº + a_id = gcnew array{ 0xFF, 0xFF }; + } + else if(pd->Divide() != TYMT_VERSION){ + // ƒo[ƒWƒ‡ƒ“ˆá‚¢ + a_id = gcnew array{ 0xFE, 0xFF }; + } + else{ + a_id = BitConverter::GetBytes(++IDCounter); + + if(IDCounter <= MAX_ID){ + if(IDCounter == MAX_ID){ + form->WriteMessage("”­sID‚ªŒÀŠE‚É’B‚µ‚Ü‚µ‚½B\n", ErrorMessageColor); + } + + // ƒƒ“ƒo[“o˜^ + mi = gcnew MemberInfo; + mi->IP_EP = ep; + mi->ID = IDCounter; + mi->TYPE = i; + mi->STATE = MS_FREE; + mi->NUM_VS = 0; + mi->RESPONSE = timeGetTime(); + + // –¼‘O + i = pd->Divide(); + mi->NAME = Encoding::Unicode->GetString(pd->Divide(i)); + + // ƒRƒƒ“ƒg + i = pd->Divide(); + mi->COMMENT = Encoding::Unicode->GetString(pd->Divide(i)); + + if(ListView == LV_BLIND){ + mi->NAME = gcnew String("Ÿ"); + mi->COMMENT = String::Empty; + } + + MemberList->Add(mi); + form->AddListView(mi); + + // ƒoƒbƒNƒAƒbƒv + MemberInfoBackUp^ mibk = gcnew MemberInfoBackUp; + mibk->IP_EP = ep; + mibk->ID = IDCounter; + MemberListBackUp->Add(mibk); + + + form->WriteComment(mi->NAME, mi->TYPE, mi->COMMENT); + + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("Connect from {0}:{1}\n", ep->Address, ep->Port), DebugMessageColor); + } + } + else if(IDCounter > MAX_ID){ + IDCounter = MAX_ID; + } + } + + // ID + pp->Pack(a_id); + + // ŽIŽå‚̃jƒbƒNƒl[ƒ€ + pp->Pack((BYTE)name->Length); + pp->Pack(name); + + // ŽIŽå‚̃Rƒƒ“ƒg + pp->Pack((BYTE)cmnt->Length); + pp->Pack(cmnt); + + // ó‘Ô + pp->Pack((BYTE)MemberList[0]->STATE); + + // ƒo[ƒWƒ‡ƒ“î•ñ‘—M + pp->Pack((BYTE)LP_VERSION); + + // “o˜^Š®—¹ + UDP->Send(pp->Packet, pp->Length, ep); + + if(mi != nullptr){ + pp->Clear(); + + // ‘Sˆõ‚É“üŽº‚ð’Ê’m + name = Encoding::Unicode->GetBytes(mi->NAME); + cmnt = Encoding::Unicode->GetBytes(mi->COMMENT); + array^ address = ep->Address->GetAddressBytes(); + array^ port = BitConverter::GetBytes((UINT16)ep->Port); + + a_id[1] |= mi->TYPE << 6; + + pp->Pack(PH_NEW_MEMBER); + pp->Pack(a_id); + pp->Pack((BYTE)name->Length); + pp->Pack(name); + pp->Pack((BYTE)cmnt->Length); + pp->Pack(cmnt); + pp->Pack(MS_FREE); + pp->Pack(address); + pp->Pack(port); + + // ŠÈˆÕˆÃ† + Monitor::Enter(ServerName); + try{ + CipherRand(ServerName->GetHashCode()); + + for(i = 1; i < pp->Length; i++){ + pp->Packet[i] ^= CipherRand(); + } + } + finally{ + Monitor::Exit(ServerName); + } + + for(i = 1; i < MemberList->Count - 1; i++){ + UDP->BeginSend(pp->Packet, pp->Length, MemberList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + } + finally{ + Monitor::Exit(MemberList); + } + + // WelcomeƒƒbƒZ[ƒW + for(UINT j = 0; j < _tcslen(MTOPTION.WELCOME); j++){ + if(MTOPTION.WELCOME[j] == _T('\t')){ + MTOPTION.WELCOME[j] = _T('\n'); + } + } + i = _tcslen(MTOPTION.WELCOME)*2; + + + if(i > 0){ + Thread::Sleep(50); + + PacketPacker^ pp = gcnew PacketPacker; + + pp->Pack(PH_NOTICE); + pp->Pack((BYTE)i); + pp->Pack(Encoding::Unicode->GetBytes(gcnew String(MTOPTION.WELCOME))); + UDP->Send(pp->Packet, pp->Length, ep); + } + break; + + case PH_MESSAGE: + if(ServerMode >= SM_MATCH){ + break; + } + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + form->TalkMessage(BitConverter::ToUInt16(rcv, 1), rcv); + } + else{ + // ŽóMONLY + form->TalkMessage(0xFFFF, rcv); + } + break; + + case PH_NOTICE: + if(UDP != nullptr){ + form->WriteMessage("[ƒT[ƒo[’m]-------------------\n", SystemMessageColor); + form->WriteNotice(Encoding::Unicode->GetString(rcv, 2, (rcv->Length)-2)); + form->WriteMessage("-------------------------------\n", SystemMessageColor); + } + break; + + case PH_REQ_LIST: + if(MTOPTION.CONNECTION_TYPE != CT_SERVER){ + return; + } + else{ + id = BitConverter::ToUInt16(rcv, 1); + array ^a_id, ^name, ^cmnt, ^address, ^port; + PacketPacker^ pp = gcnew PacketPacker; + + Monitor::Enter(MemberList); + try{ + for(i = 1; i < MemberList->Count; i++){ + // id == 0‚Å‘Sˆõ•ª + if(id == 0 || id == MemberList[i]->ID){ + a_id = BitConverter::GetBytes((UINT16)(MemberList[i]->ID | MemberList[i]->TYPE << 14)); + name = Encoding::Unicode->GetBytes(MemberList[i]->NAME); + cmnt = Encoding::Unicode->GetBytes(MemberList[i]->COMMENT); + address = MemberList[i]->IP_EP->Address->GetAddressBytes(); + port = BitConverter::GetBytes((UINT16)MemberList[i]->IP_EP->Port); + + pp->Clear(); + pp->Pack(PH_RES_LIST); + pp->Pack(a_id); + pp->Pack((BYTE)name->Length); + pp->Pack(name); + pp->Pack((BYTE)cmnt->Length); + pp->Pack(cmnt); + pp->Pack((BYTE)MemberList[i]->STATE); + pp->Pack(address); + pp->Pack(port); + + // ŠÈˆÕˆÃ† + Monitor::Enter(ServerName); + try{ + CipherRand(ServerName->GetHashCode()); + + for(int j = 1; j < pp->Length; j++){ + pp->Packet[j] ^= CipherRand(); + } + } + finally{ + Monitor::Exit(ServerName); + } + + UDP->BeginSend(pp->Packet, pp->Length, ep, gcnew AsyncCallback(SendPackets), UDP); + + if(id > 0){ + break; + } + } + } + if(MTINFO.DEBUG){ + if(id == 0){ + form->WriteMessage("ƒƒ“ƒo[ƒŠƒXƒg‚Ì—v‹‚ð•ÔM‚µ‚Ü‚µ‚½B\n", DebugMessageColor); + } + } + + if(id > 0 && i >= MemberList->Count){ + // ƒT[ƒo‚Å‚àƒNƒ‰‚Å‚àŒ©‚¦‚È‚¢ó‘Ô + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("Unknown({0})‚ÌŒŸõ\n", id), ErrorMessageColor); + } + + // ƒoƒbƒNƒAƒbƒvŒŸõ + if(id <= MemberListBackUp->Count){ + try{ + // Unknown’Ê’m + array^ send = gcnew array(3){ PH_LOST, 0xFF, 0xFF }; + UDP->BeginSend(send, send->Length, MemberListBackUp[id]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + form->WriteMessage(String::Format("Unknown({0})‚É’Ê’m‚ð‚µ‚Ü‚µ‚½B\n", id), SystemMessageColor); + } + catch(Exception^){ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("Unknown({0})‚Ö‚Ì’Ê’m‚ÉŽ¸”s‚µ‚Ü‚µ‚½B\n", id), ErrorMessageColor); + } + } + }else{ + // ƒoƒbƒNƒAƒbƒvƒŠƒXƒgˆÈã‚ÌID + form->WriteMessage(String::Format("—š—ð‚É‘¶Ý‚µ‚È‚¢Ú‘±ID‚Å‚·B\nƒT[ƒo‚ðƒVƒƒƒbƒgƒ_ƒEƒ“ŒãA‚µ‚΂炭‚µ‚Ä‚©‚çƒT[ƒo‚ð‹N“®‚µ‚Ä‚­‚¾‚³‚¢B\n", id), ErrorMessageColor); + } + } + } + finally{ + Monitor::Exit(MemberList); + } + } + break; + + case PH_RES_LIST: + case PH_NEW_MEMBER: + // ŠÈˆÕ•œ† + Monitor::Enter(ServerName); + try{ + CipherRand(ServerName->GetHashCode()); + + for(i = 1; i < rcv->Length; i++){ + rcv[i] ^= CipherRand(); + } + } + finally{ + Monitor::Exit(ServerName); + } + + id = BitConverter::ToUInt16(rcv, 1); + + if((id & 0x3FFF) != MemberList[0]->ID){ + int len; + PacketDivider^ pd = gcnew PacketDivider(rcv); + pd->Length = 3; + + Monitor::Enter(MemberList); + try{ + MemberInfo^ mi = gcnew MemberInfo; + mi->IP_EP = gcnew IPEndPoint(0, 0); + mi->ID = id & 0x3FFF; + mi->TYPE = id >> 14; + mi->NUM_VS = 0; + + // –¼‘O + len = pd->Divide(); + mi->NAME = Encoding::Unicode->GetString(pd->Divide(len)); + + // ƒRƒƒ“ƒg + len = pd->Divide(); + mi->COMMENT = Encoding::Unicode->GetString(pd->Divide(len)); + + // ó‘Ô + mi->STATE = pd->Divide(); + + // ƒGƒ“ƒhƒ|ƒCƒ“ƒg + mi->IP_EP->Address = gcnew IPAddress(pd->Divide(4)); + mi->IP_EP->Port = BitConverter::ToUInt16(pd->Divide(2), 0); + + MemberList->Add(mi); + form->AddListView(mi); + + // ˆ¥ŽA‘ã‚í‚è + UDP->Send(gcnew array{PH_PING}, 1, mi->IP_EP); + + if(rcv[0] == PH_NEW_MEMBER){ + form->WriteComment(mi->NAME, mi->TYPE, mi->COMMENT); + } + } + finally{ + Monitor::Exit(MemberList); + } + } + break; + + case PH_QUIT: + case PH_LOST: + id = BitConverter::ToUInt16(rcv, 1); + + Monitor::Enter(MemberList); + try{ + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + int member = 0; + // ‘Sˆõ‚É’Ê’B + for(i = 1; i < MemberList->Count; i++){ + if(id != MemberList[i]->ID){ + UDP->BeginSend(rcv, rcv->Length, MemberList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + else{ + member = i; + } + } + + if(member > 0){ + if(ListView != LV_BLIND){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(MemberList[member]->NAME + "‚ª‘ÞŽº‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + } + + // ŠÏí’†Ž~ + if(MemberList[0]->STATE == MS_WATCH || MemberList[0]->STATE == MS_COUCH){ + if(TargetID == MemberList[member]->ID){ + form->QuitWatch(false); + } + } + MemberList->RemoveAt(member); + form->listBoxMember->Items->RemoveAt(member); + } + } + else{ + if(id == 0){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(ServerName + "‚ªƒVƒƒƒbƒgƒ_ƒEƒ“‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + MemberList[0]->STATE = 0xFF; + } + else if(id == 0xFFFF){ + form->WriteMessage(ServerName + "‚É‚Í“o˜^‚³‚ê‚Ä‚¢‚Ü‚¹‚ñB\nŽžŠÔ‚ð’u‚¢‚ÄÄÚ‘±‚µ‚Ä‚Ý‚Ä‚­‚¾‚³‚¢B\n", ErrorMessageColor); + MemberList[0]->STATE = 0xFF; + } + else{ + for(i = 0; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + if(i == 0){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage("ƒT[ƒo‚Æ‚ÌÚ‘±‚ªØ’f‚³‚ê‚Ü‚µ‚½B\n", ErrorMessageColor); + MemberList[0]->STATE = 0xFF; + } + else{ + if(ListView != LV_BLIND){ + if(rcv[0] == PH_QUIT){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(MemberList[i]->NAME + "‚ª‘ÞŽº‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + } + else{ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(MemberList[i]->NAME + "‚̉ñü‚ª“rØ‚ê‚Ü‚µ‚½B\n", ErrorMessageColor); + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("ID = {0}\n", MemberList[i]->ID), DebugMessageColor); + form->WriteMessage(String::Format("IP_EP = {0}\n", MemberList[i]->IP_EP), DebugMessageColor); + } + } + } + + // ŠÏí’†Ž~ + if(MemberList[0]->STATE == MS_WATCH || MemberList[0]->STATE == MS_COUCH){ + if(TargetID == MemberList[i]->ID){ + form->QuitWatch(false); + } + } + + MemberList->RemoveAt(i); + form->listBoxMember->Items->RemoveAt(i); + } + + break; + } + } + } + } + } + finally{ + Monitor::Exit(MemberList); + } + + if(MemberList[0]->STATE == 0xFF){ + form->Leave(false); + } + break; + + case PH_CHANGE_STATE: + id = BitConverter::ToUInt16(rcv, 1); + + Monitor::Enter(MemberList); + try{ + for(i = 0; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + + if(MemberList[i]->STATE == MS_SEEK && rcv[3] != MS_SEEK){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(String::Format("{0}‚ª‘Îí•åW‚ð’÷‚ßØ‚è‚Ü‚µ‚½B\n", MemberList[i]->NAME), SystemMessageColor); + } + + MemberList[i]->STATE = rcv[3]; + form->listBoxMember->Refresh(); + + if(MemberList[i]->STATE == MS_SEEK){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(String::Format("{0}‚ª‘Îí•åWó‘Ô‚É‚È‚è‚Ü‚µ‚½B\n", MemberList[i]->NAME), SystemMessageColor); + if(MTOPTION.SEEK_SOUND_ENABLE){ + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.SEEK_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + } + + if(MTOPTION.CONNECTION_TYPE != CT_SERVER){ + break; + } + } + else if(i != 0 && MTOPTION.CONNECTION_TYPE == CT_SERVER){ + UDP->BeginSend(rcv, rcv->Length, MemberList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + } + finally{ + Monitor::Exit(MemberList); + } + break; + + case PH_REQ_STATE: + id = BitConverter::ToUInt16(rcv, 1); + + Monitor::Enter(MemberList); + try{ + send = gcnew array(4){ PH_RES_STATE, rcv[1], rcv[2], 0xFF }; + BYTE state; + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + for(i = 0; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + state = (BYTE)MemberList[i]->STATE; + + if(state == MS_READY){ + state = MS_FREE; + } + + send[3] = state; + break; + } + } + } + else if(id == MemberList[0]->ID){ + state = (BYTE)MemberList[0]->STATE; + + if(state == MS_READY){ + state = MS_FREE; + } + + send[3] = state; + } + + UDP->Send(send, send->Length, ep); + } + finally{ + Monitor::Exit(MemberList); + } + break; + + case PH_RES_STATE: + id = BitConverter::ToUInt16(rcv, 1); + + Monitor::Enter(MemberList); + try{ + for(i = 1; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + MemberList[i]->RESPONSE = timeGetTime(); + + if(rcv[3] == 0xFF){ + // ‚»‚ñ‚Èl‚¢‚È‚©‚Á‚½ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(MemberList[i]->NAME + "‚ÍŠù‚É‚¢‚Ü‚¹‚ñ‚Å‚µ‚½B\n", SystemMessageColor); + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + // ‘Sˆõ‚É’Ê’B + rcv[0] = PH_LOST; + + for(int j = 1; j < MemberList->Count; j++){ + if(id != MemberList[j]->ID){ + UDP->BeginSend(rcv, 3, MemberList[j]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + } + else{ + // ‚¢‚È‚©‚Á‚½’Ê’m ‰ž‹}ˆ’uVer + // ‘ ‚©‚ç‚Ì‚ÝŒ©‚¦‚Ä‚¢‚éó‘Ô + // ƒT[ƒo‚É‚Íî•ñ‚ª‚È‚¢‚Ì‚ÅŠÔÚ“I‚É’Ê’m‚µ‚Ä‚à‚炤 + rcv[0] = PH_LOST; + rcv[1] = 0xFF; + rcv[2] = 0xFF; + UDP->Send(rcv, 3, MemberList[i]->IP_EP); + } + + MemberList->RemoveAt(i); + form->listBoxMember->Items->RemoveAt(i); + } + else if(MemberList[i]->STATE != rcv[3]){ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format(MemberList[i]->NAME + " > state:{0}\n", rcv[3]), DebugMessageColor); + } + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(MemberList[i]->NAME + "‚Ìó‘Ô‚ðXV‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + if(MTOPTION.CONNECTION_TYPE != CT_SERVER && MemberList[i]->ID == 0){ + form->WriteMessage("ƒT[ƒo[‚Æ‚Ì’ÊM‚ª“r؂ꂽ‰Â”\«‚ª‚ ‚è‚Ü‚·BÄÚ‘±‚ð‚µ‚Ä‚Ý‚Ä‚­‚¾‚³‚¢B\n", ErrorMessageColor); + } + MemberList[i]->STATE = rcv[3]; + form->listBoxMember->Refresh(); + } + break; + } + } + } + finally{ + Monitor::Exit(MemberList); + } + break; + + case PH_CHANGE_COMMENT: + if(ServerMode >= SM_MATCH){ + break; + } + + id = BitConverter::ToUInt16(rcv, 1); + + Monitor::Enter(MemberList); + try{ + for(i = 1; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + MemberList[i]->COMMENT = Encoding::Unicode->GetString(rcv, 4, rcv[3]); + break; + } + } + + if(i < MemberList->Count && ListView == LV_COMMENT){ + if(MemberList[i]->COMMENT->Length > 0){ + form->listBoxMember->Items[i] = MemberList[i]->COMMENT; + } + else{ + form->listBoxMember->Items[i] = gcnew String("Ÿ"); + } + } + } + finally{ + Monitor::Exit(MemberList); + } + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + form->PacketSendAllMember(rcv, id); + } + break; + + case PH_DICE: + if(MTOPTION.CONNECTION_TYPE != CT_SERVER){ + Monitor::Enter(form->richTextBoxLog); + try{ + form->richTextBoxLog->SelectionStart = form->richTextBoxLog->Text->Length; + + form->richTextBoxLog->SelectionColor = TalkMessageColor; + form->richTextBoxLog->SelectionBackColor = NoticeBackColor; + form->richTextBoxLog->AppendText(Byte(rcv[1]).ToString() + "\n"); + + form->richTextBoxLog->SelectionStart = form->richTextBoxLog->Text->Length; + if(!MTOPTION.LOG_LOCK) { + form->richTextBoxLog->ScrollToCaret(); + } + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "RichTextBox"); + } + finally{ + Monitor::Exit(form->richTextBoxLog); + } + } + break; + + case PH_REQ_VS: + + // €”õŽžŠÔ‚ª’·‚·‚¬‚½ê‡‚ÍV‹KÚ‘±Žó•t + if(NetVS != nullptr && MemberList[0]->STATE == MS_READY){ + if((timeGetTime() - NetVS->START_UP) > TIME_OUT*2 + 1000){ + MemberList[0]->STATE = MS_FREE; + delete NetVS; + NetVS = nullptr; + } + } + + if(MemberList[0]->STATE == MS_SEEK && GameThread != nullptr){ + form->QuitGame(); + GameThread = nullptr; + Thread::Sleep(500); + } + + send = gcnew array(2); + send[0] = PH_RES_VS; + send[1] = (BYTE)MemberList[0]->STATE; + + // ŠiƒcƒN‚¶‚á‚È‚¢‚æ + try{ + String^ exe = gcnew String(MTOPTION.GAME_EXE); + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(exe); + + if(info->FileDescription != "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd." && info->FileDescription != "‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T"){ + throw gcnew Exception; + } + /* + else if(ServerMode == SM_MIX){ + // ¬ÝƒT[ƒoƒ‚[ƒh‚È‚Ì‚ÅAŽÀsƒtƒ@ƒCƒ‹‚̃`ƒFƒbƒN + if((INT32)(Path::GetFileNameWithoutExtension(exe)->GetHashCode()) != BitConverter::ToInt32(rcv, 3)){ + send[1] = 0xFE; + } + } + */ + else{ + if((INT32)(Path::GetFileNameWithoutExtension(exe)->GetHashCode()) != BitConverter::ToInt32(rcv, 3)){ + send[1] = 0xFE; + } + if(info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd."){ + MTINFO.KGT2K = true; + } + else{ + MTINFO.KGT2K = false; + } + } + } + catch(Exception^){ + send[1] = 0xFF; + form->WriteMessage("Ši“¬ƒcƒN[ƒ‹‚ÌŽÀsƒtƒ@ƒCƒ‹‚Å‚Í‚ ‚è‚Ü‚¹‚ñB\n", ErrorMessageColor); + form->WriteMessage("ƒIƒvƒVƒ‡ƒ“‚ÅŽÀsƒtƒ@ƒCƒ‹‚̃pƒX‚ðݒ肵‚Ä‚­‚¾‚³‚¢B\n", ErrorMessageColor); + } + + UDP->BeginSend(send, send->Length, ep, gcnew AsyncCallback(SendPackets), UDP); + + if((send[1] == MS_FREE)||(send[1] == MS_SEEK)){ + MemberList[0]->STATE = MS_READY; + + id = BitConverter::ToUInt16(rcv, 1); + + Monitor::Enter(MemberList); + try{ + for(i = 0; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID) break; + } + + if(i >= MemberList->Count){ + form->WriteMessage("ƒŠƒXƒg‚É‚¢‚È‚¢l•¨‚©‚ç‚Ì‘Îí—v‹‚ª‚ ‚è‚Ü‚µ‚½B\n", ErrorMessageColor); + MemberList[0]->STATE = MS_FREE; + + if(MTOPTION.CONNECTION_TYPE != CT_SERVER){ + // ’m‚ç‚È‚¢l‚ª‚¢‚½‚̂ŃT[ƒo‚É–â‚¢‡‚킹 + array^ send = gcnew array(3){ PH_REQ_LIST }; + Array::Copy(BitConverter::GetBytes(id), 0, send, 1, 2); + UDP->Send(send, 3, MemberList[1]->IP_EP); + } + break; + } + + NetVS = gcnew VersusInfo; + NetVS->SEQUENCE = VS_SETTING; + NetVS->SLEEPING = false; + NetVS->WAITING = false; + NetVS->START_UP = timeGetTime(); + NetVS->IP_EP = ep; + NetVS->PING = gcnew array(5){ 0, 0, 0, 0, 0 }; + NetVS->PONG = gcnew array(5){ 0, 0, 0, 0, 0 }; + NetVS->SEND = gcnew array(32){ PH_VS_DATA }; + NetVS->L_FRAME = 0; + NetVS->L_READ = 0; + NetVS->R_FRAME = 0; + NetVS->R_READ = 0; + + // ŠÏí—pID + P1ID = MemberList[0]->ID; + P2ID = id; + + // –¼‘O + ZeroMemory(MTINFO.P1_NAME, sizeof(MTINFO.P1_NAME)); + ZeroMemory(MTINFO.P2_NAME, sizeof(MTINFO.P2_NAME)); + + if(ListView != LV_BLIND){ + _tcscpy_s(MTINFO.P1_NAME, MTOPTION.NAME); + + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(MemberList[i]->NAME); + _tcscpy_s(MTINFO.P2_NAME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + } + + // ‘Îí‰ñ” + MemberList[i]->NUM_VS++; + + if(ListView != LV_BLIND){ + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(MemberList[i]->NAME, NameColor[MemberList[i]->TYPE]); + form->WriteMessage("‚©‚ç‘Îí‚Ì\‚µž‚Ý‚Å‚·B\n", SystemMessageColor); + } + } + finally{ + Monitor::Exit(MemberList); + } + } + break; + + case PH_RES_VS: + if((rcv[1] != MS_FREE)&&(rcv[1] != MS_SEEK)){ + switch(rcv[1]){ + case MS_REST: + form->WriteMessage("’§í‘ŠŽè‚Í‹xŒe’†‚Å‚·B\n", SystemMessageColor); + break; + case MS_VS: + form->WriteMessage("’§í‘ŠŽè‚Í‘Îí’†‚Å‚·B\n", SystemMessageColor); + break; + case MS_WATCH: + case MS_COUCH: + form->WriteMessage("’§í‘ŠŽè‚ÍŠÏí’†‚Å‚·B\n", SystemMessageColor); + break; + case MS_SEEK: + break; + case MS_READY: + form->WriteMessage("’§í‘ŠŽè‚Í‘¼‚Ìl‚Æ‘Î퀔õ’†‚Å‚·B\n", SystemMessageColor); + break; + case 0xFE: + form->WriteMessage("’§í‘ŠŽè‚ƃvƒŒƒC‚·‚éƒQ[ƒ€‚ªˆá‚¢‚Ü‚·B\n", ErrorMessageColor); + break; + default: + form->WriteMessage("’§í‘ŠŽè‚ª‘Îío—ˆ‚éó‘Ô‚Å‚Í‚ ‚è‚Ü‚¹‚ñB\n", SystemMessageColor); + break; + } + + NetVS->SEQUENCE = VS_ERROR; + + if(VersusThread != nullptr && VersusThread->IsAlive && NetVS->SLEEPING){ + VersusThread->Interrupt(); + } + } + else if(NetVS != nullptr){ + NetVS->SEQUENCE = VS_PING; + + if(VersusThread != nullptr && VersusThread->IsAlive && NetVS->SLEEPING){ + VersusThread->Interrupt(); + } + } + break; + + case PH_REQ_VS_PING: + rcv[0] = PH_RES_VS_PONG; + UDP->Send(rcv, rcv->Length, ep); + break; + + case PH_RES_VS_PONG: + if(NetVS != nullptr){ + NetVS->PONG[rcv[1]] = timeGetTime(); + + for(id = 0, i = 0; id < 5; id++){ + if(NetVS->PONG[id] > 0){ + i++; + + if(i == 4){ + if(NetVS->SEQUENCE == VS_PING){ + NetVS->SEQUENCE = VS_SETTING; + + if(VersusThread != nullptr && VersusThread->IsAlive && NetVS->SLEEPING){ + VersusThread->Interrupt(); + } + } + break; + } + } + } + } + break; + + case PH_REQ_VS_SETTING: + if(NetVS != nullptr && NetVS->SEQUENCE == VS_SETTING){ + send = gcnew array(11){ PH_RES_VS_SETTING }; + + // ‘ÎíÝ’è + MTINFO.SEED = XorShift(); + MTINFO.MAX_STAGE = MTOPTION.MAX_STAGE; + MTINFO.STAGE_SELECT = MTOPTION.STAGE_SELECT; + MTINFO.ROUND = MTOPTION.ROUND; + MTINFO.TIMER = MTOPTION.TIMER; + MTINFO.TEAM_ROUND_HP = MTOPTION.TEAM_ROUND_HP; + + // ƒfƒBƒŒƒC + if(MTOPTION.DELAY == 0 || rcv[1] > MTOPTION.DELAY){ + send[1] = rcv[1]; + } + else{ + send[1] = (BYTE)MTOPTION.DELAY; + } + + NetVS->SEQUENCE = VS_DATA; + NetVS->DELAY = send[1]; + NetVS->LOCAL = gcnew array(NetVS->DELAY*4); + NetVS->REMOTE = gcnew array(NetVS->DELAY*4); + + for(i = 0; i < NetVS->LOCAL->Length; i++){ + NetVS->LOCAL[i] = 0xFFFF; + NetVS->REMOTE[i] = 0xFFFF; + } + + for(UINT i = 0; i < NetVS->DELAY; i++){ + NetVS->LOCAL[i] = 0x0000; + } + + Array::Copy(BitConverter::GetBytes(MTINFO.SEED), 0, send, 2, 4); + send[6] = (BYTE)MTINFO.MAX_STAGE; + send[7] = (BYTE)MTINFO.STAGE_SELECT; + send[8] = (BYTE)MTINFO.ROUND; + send[9] = (BYTE)MTINFO.TIMER; + send[10] = (BYTE)MTINFO.TEAM_ROUND_HP; + UDP->Send(send, send->Length, ep); + + MTINFO.CONTROL = 0; + + // ‘ÎíŠJŽn + form->WriteTime(0, SystemMessageColor); + form->WriteMessage(String::Format("‘Îí‚ðŠJŽn‚µ‚Ü‚·B(delay:{0})\n", NetVS->DELAY), SystemMessageColor); + + // ‰¹‚Å‚¨’m‚点 + if(MTOPTION.VS_SOUND_ENABLE){ + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.VS_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + + // ‘Ò‚¿Žó‚¯—p‚¿‚å‚Á‚ƃXƒŠ[ƒv + Thread::Sleep(1000); + + GameThread = gcnew Thread(gcnew ParameterizedThreadStart(form, &MainForm::RunGame)); + GameThread->Start((UINT)RT_VS); + } + break; + + case PH_RES_VS_SETTING: + if(NetVS != nullptr){ + NetVS->DELAY = rcv[1]; + NetVS->LOCAL = gcnew array(NetVS->DELAY*4); + NetVS->REMOTE = gcnew array(NetVS->DELAY*4); + + for(i = 0; i < NetVS->LOCAL->Length; i++){ + NetVS->LOCAL[i] = 0xFFFF; + NetVS->REMOTE[i] = 0xFFFF; + } + + for(UINT i = 0; i < NetVS->DELAY; i++){ + NetVS->LOCAL[i] = 0x0000; + } + + MTINFO.SEED = BitConverter::ToUInt32(rcv, 2); + MTINFO.MAX_STAGE = rcv[6]; + MTINFO.STAGE_SELECT = rcv[7]; + MTINFO.ROUND = rcv[8]; + MTINFO.TIMER = rcv[9]; + // v1.04ˆÈãŒÝŠ· + try{ + if(rcv[10]){ + MTINFO.TEAM_ROUND_HP = true; + }else{ + MTINFO.TEAM_ROUND_HP = false; + } + } + catch(Exception^){ + MTINFO.TEAM_ROUND_HP = false; + form->WriteMessage("‘Îí‘ŠŽè‚ªŒÃ‚¢ƒo[ƒWƒ‡ƒ“‚ÌLilithPort‚©AMTSP‚Å‚·B\n", ErrorMessageColor); + } + + + if(VersusThread != nullptr && VersusThread->IsAlive && NetVS->SEQUENCE == VS_SETTING && NetVS->SLEEPING){ + NetVS->SEQUENCE = VS_STANDBY; + VersusThread->Interrupt(); + } + } + break; + + case PH_VS_END: + if(NetVS != nullptr){ + form->WriteMessage("‘ÎíI—¹‚Ì‚¨’m‚点‚Å‚·B\n", SystemMessageColor); + + NetVS->SEQUENCE = VS_END; + form->QuitGame(); + + Monitor::Enter(NetVS->REMOTE); + try{ + if(NetVS->WAITING == 2){ + NetVS->WAITING = 1; + Monitor::Pulse(NetVS->REMOTE); + } + } + finally{ + Monitor::Exit(NetVS->REMOTE); + } + + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("Frame > {0}\n", NetVS->L_FRAME), DebugMessageColor); + } + } + break; + + case PH_VS_DATA: + if(NetVS != nullptr && NetVS->SEQUENCE == VS_DATA){ + UINT f = BitConverter::ToUInt32(rcv, 1); + + Monitor::Enter(NetVS->REMOTE); + try{ + if(NetVS->R_FRAME > f + NetVS->DELAY){ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("–³Œø‚ȃpƒPƒbƒg(’x‰„) > {0} / {1}\n", f, NetVS->R_FRAME), DebugMessageColor); + } + break; + } + else if(f > NetVS->R_FRAME + NetVS->DELAY){ + // ‚Ü‚¸‚±‚È‚¢ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("–³Œø‚ȃpƒPƒbƒg(æs) > {0} / {1}\n", f, NetVS->R_FRAME), DebugMessageColor); + } + break; + } + + for(UINT i = 0; i <= NetVS->DELAY; i++){ + if((f + i) < NetVS->R_FRAME){ + continue; + } + + NetVS->REMOTE[(f + i) % NetVS->REMOTE->Length] = BitConverter::ToUInt16(rcv, 5 + i*2); + + if((f + i) == NetVS->R_FRAME && NetVS->WAITING == 2){ + NetVS->WAITING = 1; + Monitor::Pulse(NetVS->REMOTE); + } + } + } + finally{ + Monitor::Exit(NetVS->REMOTE); + } + } + break; + + case PH_REQ_VS_DATA: + if(NetVS != nullptr && NetVS->SEQUENCE == VS_DATA){ + send = gcnew array(7); + send[0] = PH_RES_VS_DATA; + Array::Copy(rcv, 1, send, 1, 4); + send[5] = 0xFF; + send[6] = 0xFF; + + UINT f = BitConverter::ToUInt32(rcv, 1); + + Monitor::Enter(NetVS->LOCAL); + try{ + if(f >= NetVS->L_FRAME + NetVS->DELAY){ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("–³Œø‚ȃpƒPƒbƒg(æs—v‹) > {0} / {1}\n", f, NetVS->L_FRAME), DebugMessageColor); + } + UDP->BeginSend(send, send->Length, ep, gcnew AsyncCallback(SendPackets), UDP); + break; + } + else if(NetVS->L_FRAME > f + NetVS->DELAY*2){ + // Šù‚Ƀf[ƒ^‚ª‚È‚¢‚Ì‚Å‚±‚ꂪ‚­‚é‚ƃQ[ƒ€‚É‚È‚ç‚È‚¢ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("–³Œø‚ȃpƒPƒbƒg(’x‰„—v‹) > {0} / {1}\n", f, NetVS->L_FRAME), DebugMessageColor); + } + break; + } + + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("—v‹ƒpƒPƒbƒg > {0} / {1}\n", f, NetVS->L_FRAME), DebugMessageColor); + } + + Array::Copy(BitConverter::GetBytes(NetVS->LOCAL[f % NetVS->LOCAL->Length]), 0, send, 5, 2); + UDP->BeginSend(send, send->Length, ep, gcnew AsyncCallback(SendPackets), UDP); + } + finally{ + Monitor::Exit(NetVS->LOCAL); + } + } + break; + + case PH_RES_VS_DATA: + if(NetVS != nullptr && NetVS->WAITING > 0){ + UINT32 f = BitConverter::ToUInt32(rcv, 1); + + Monitor::Enter(NetVS->REMOTE); + try{ + if(f != NetVS->R_FRAME) break; + + UINT16 w = BitConverter::ToUInt16(rcv, 5); + + NetVS->REMOTE[NetVS->R_READ] = w; + + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("•ÔMƒpƒPƒbƒg > {0} : {1}\n", f, w), DebugMessageColor); + } + + if(NetVS->WAITING == 2){ + NetVS->WAITING = 1; + Monitor::Pulse(NetVS->REMOTE); + } + } + finally{ + Monitor::Exit(NetVS->REMOTE); + } + } + break; + + case PH_REQ_WATCH: + rcv[0] = PH_RES_WATCH; + id = BitConverter::ToUInt16(rcv, 1); + + if(MTOPTION.ALLOW_SPECTATOR == false){ + // ŠÏí•s‹–‰Â + rcv[1] = 1; + UDP->Send(rcv, 2, ep); + break; + } + else if(SpectatorList->Count >= (int)MTOPTION.MAX_CONNECTION){ + // –žÈ + rcv[1] = 2; + UDP->Send(rcv, 2, ep); + break; + } + else if(InputFrame > (UINT)InputHistory->Length - 200){ + // ’x + rcv[1] = 3; + UDP->Send(rcv, 2, ep); + break; + } + else if(WatchTarget != nullptr && id == TargetID){ + // ‘ŠŒÝŠÏí + rcv[1] = 4; + UDP->Send(rcv, 2, ep); + break; + } + else{ + SpectatorInfo^ si = gcnew SpectatorInfo; + si->ID = id; + si->IP_EP = ep; + si->FRAME = 0; + + if(SpectacleThread != nullptr && SpectacleThread->IsAlive && AllowWatch){ + // Šù‚É‚Í‚¶‚ß‚Ä‚é + send = gcnew array(14); + send[0] = PH_RES_WATCH; + send[1] = 0; + Array::Copy(BitConverter::GetBytes(P1ID), 0, send, 2, 2); + Array::Copy(BitConverter::GetBytes(P2ID), 0, send, 4, 2); + Array::Copy(BitConverter::GetBytes(MTINFO.SEED), 0, send, 6, 4); + send[10] = MTINFO.MAX_STAGE; + send[11] = MTINFO.STAGE_SELECT; + send[12] = MTINFO.ROUND; + send[13] = MTINFO.TIMER; + + UDP->Send(send, send->Length, ep); + + // ‚È‚©‚È‚©ƒfƒ“ƒWƒƒƒ‰ƒX‚ÈSleep + Thread::Sleep(100); + } + + Monitor::Enter(InputHistory); + try{ + SpectatorList->Add(si); + } + finally{ + Monitor::Exit(InputHistory); + } + + if(ListView != LV_BLIND){ + Monitor::Enter(MemberList); + try{ + for(i = 0 ; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + break; + } + } + + if(i >= MemberList->Count){ + // ŠO—ˆ‹q + form->WriteMessage("ŠÏíŽÒ‚ª—ˆ‚Ü‚µ‚½B\n", SystemMessageColor); + } + else{ + form->WriteMessage(MemberList[i]->NAME + "‚ªŠÏí‚É—ˆ‚Ü‚µ‚½B\n", SystemMessageColor); + } + } + finally{ + Monitor::Exit(MemberList); + } + } + } + break; + + case PH_RES_WATCH: + if(rcv[1] > 0){ + switch(rcv[1]){ + case 1: + form->WriteMessage("ŠÏ킪‹–‰Â‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ‚Å‚µ‚½B\n", SystemMessageColor); + break; + + case 2: + form->WriteMessage("ŠÏíÈ‚Í–žÈ‚Å‚µ‚½B\n", SystemMessageColor); + break; + + case 3: + form->WriteMessage("ŠÏí‚ɊԂɇ‚¢‚Ü‚¹‚ñ‚Å‚µ‚½B\n", SystemMessageColor); + break; + + case 4: + form->WriteMessage("Šù‚É‘ŠŽè‚ª‚±‚¿‚ç‚ðŠÏí‘ÎÛ‚É‚µ‚Ä‚¢‚Ü‚µ‚½B\n", SystemMessageColor); + break; + } + + form->QuitWatch(false); + } + else{ + if(MemberList[0]->STATE == MS_WATCH || MemberList[0]->STATE == MS_COUCH){ + ZeroMemory(MTINFO.P1_NAME, sizeof(MTINFO.P1_NAME)); + ZeroMemory(MTINFO.P2_NAME, sizeof(MTINFO.P2_NAME)); + + P1ID = BitConverter::ToUInt16(rcv, 2); + P2ID = BitConverter::ToUInt16(rcv, 4); + MTINFO.SEED = BitConverter::ToUInt32(rcv, 6); + + MTINFO.MAX_STAGE = rcv[10]; + MTINFO.STAGE_SELECT = rcv[11]; + MTINFO.ROUND = rcv[12]; + MTINFO.TIMER = rcv[13]; + + IntPtr mp; + int c = 0; + + if(ListView != LV_BLIND){ + Monitor::Enter(MemberList); + try{ + // –¼‘O + for(i = 0; i < MemberList->Count; i++){ + if(MemberList[i]->ID == P1ID){ + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(MemberList[i]->NAME); + _tcscpy_s(MTINFO.P1_NAME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + c++; + } + else if(MemberList[i]->ID == P2ID){ + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(MemberList[i]->NAME); + _tcscpy_s(MTINFO.P2_NAME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + c++; + } + + if(c == 2) break; + } + } + finally{ + Monitor::Exit(MemberList); + } + } + + for(i = 0; i < WatchHistory->Length; i++){ + WatchHistory[i] = 0xFFFF; + } + WaitingWatch = 1; + + GameThread = gcnew Thread(gcnew ParameterizedThreadStart(form, &MainForm::RunGame)); + GameThread->Start((UINT)RT_WATCH); + + form->WriteMessage("ŠÏí‚ðŠJŽn‚µ‚Ü‚·B\n", SystemMessageColor); + } + } + break; + + case PH_WATCH_DATA: + if(WatchTarget != nullptr && WaitingWatch > 0){ + UINT32 f = BitConverter::ToUInt32(rcv, 1); + + if(f > WatchFrame + WatchHistory->Length - 20){ + form->WriteMessage("“¯Šú‚ªŽæ‚ê‚È‚­‚È‚Á‚½‚½‚ߊÏí‚𒆎~‚µ‚Ü‚·B\n", ErrorMessageColor); + form->QuitWatch(true); + } + + Monitor::Enter(WatchHistory); + try{ + if(WatchFrame > f + 20){ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("ŠÏíƒpƒPƒbƒg(’x‰„) > {0} / {1}\n", f, WatchFrame), DebugMessageColor); + } + break; + } + + for(UINT i = 0; i < 20; i++){ + if((f + i) < WatchFrame){ + continue; + } + + WatchHistory[(f + i) % WatchHistory->Length] = BitConverter::ToUInt16(rcv, 5 + i*2); + + if((f + i) == WatchFrame && WaitingWatch == 2){ + WaitingWatch = 1; + Monitor::Pulse(WatchHistory); + } + } + } + finally{ + Monitor::Exit(WatchHistory); + } + } + break; + + case PH_WATCH_END: + id = BitConverter::ToUInt16(rcv, 1); + + if(id == MemberList[0]->ID){ + // •Â–‹‚Ì‚¨’m‚点 + form->WriteMessage("ŠÏíI—¹‚Ì‚¨’m‚点‚Å‚·B\n", SystemMessageColor); + form->QuitWatch(false); + } + else{ + // ŠÏí’†Ž~‚Ì‚¨’m‚点 + Monitor::Enter(InputHistory); + try{ + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("ŠÏí’†Ž~ > {0}\n", id), DebugMessageColor); + } + + for(i = 0; i < SpectatorList->Count; i++){ + if(id == SpectatorList[i]->ID){ + SpectatorList->RemoveAt(i); + break; + } + } + } + finally{ + Monitor::Exit(InputHistory); + } + } + break; + + case PH_SECRET: + // ‰B‚µƒRƒ}ƒ“ƒh + switch(rcv[1]){ + case ST_PING: + rcv[1] = ST_PONG; + UDP->Send(rcv, rcv->Length, ep); + break; + + case ST_PONG: + { + id = BitConverter::ToUInt16(rcv, 2); + UINT32 time = timeGetTime() - BitConverter::ToUInt32(rcv, 4); + + Monitor::Enter(MemberList); + try{ + for(i = 0; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + Monitor::Enter(form->richTextBoxLog); + try{ + form->richTextBoxLog->SelectionStart = form->richTextBoxLog->Text->Length; + + form->richTextBoxLog->SelectionColor = NameColor[MemberList[i]->TYPE]; + form->richTextBoxLog->AppendText(MemberList[i]->NAME); + + form->richTextBoxLog->SelectionColor = SecretColor; + form->richTextBoxLog->AppendText("‚É "); + + form->richTextBoxLog->SelectionColor = TalkMessageColor; + form->richTextBoxLog->AppendText(UInt32(time).ToString()); + + form->richTextBoxLog->SelectionColor = SecretColor; + form->richTextBoxLog->AppendText("‚Ì ƒ_ƒ[ƒWII\n"); + + form->richTextBoxLog->SelectionStart = form->richTextBoxLog->Text->Length; + if(!MTOPTION.LOG_LOCK) { + form->richTextBoxLog->ScrollToCaret(); + } + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "RichTextBox"); + } + finally{ + Monitor::Exit(form->richTextBoxLog); + } + break; + } + } + } + finally{ + Monitor::Exit(MemberList); + } + } + break; + + default: + break; + } + break; + + default: + if(MTINFO.DEBUG){ + form->WriteMessage(String::Format("Unknown Packet > {0} from {1}\n", rcv[0], ep->ToString()), DebugMessageColor); + } + break; + } + } + catch(ObjectDisposedException^){ + // UDPÚ‘±I—¹ + if(UDP != nullptr){ + UDP = nullptr; + form->WriteMessage("‰ñü‚ðØ’f‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + } + } + catch(SocketException^ e){ + UDP->BeginReceive(gcnew AsyncCallback(ReceivePackets), form); + + if(e->ErrorCode == WSAECONNRESET){ + // ƒpƒPƒbƒg‚ª’e‚©‚ꂽ + if(MTINFO.DEBUG){ + form->WriteMessage("ERROR > WSAECONNRESET\n", DebugMessageColor); + } + } + else{ + form->WriteMessage(String::Format("ƒ\ƒPƒbƒgƒGƒ‰[({0})\n", e->ErrorCode), ErrorMessageColor); + if(MTINFO.DEBUG){ + form->WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + catch(Exception^ e){ + form->WriteMessage(e->ToString() + "\n", ErrorMessageColor); + } +} +// IPŽæ“¾ƒ^ƒCƒ€ƒAƒEƒg—pƒ^ƒCƒ}[ +void MainForm::TimerGetIP() +{ + GetIPSleeping = true; + try{ + // 15•b‚®‚ç‚¢‚Ń^ƒCƒ€ƒAƒEƒg + Thread::Sleep(1000*15); + } + catch(ThreadInterruptedException^){ + } + GetIPSleeping = false; + + try{ + if(GetIPClient != nullptr){ + GetIPClient->CancelAsync(); + } + } + catch(Exception^ e) { + WriteMessage(e->ToString() + "\n", ErrorMessageColor); + } +} + +// HPŽ‚¿‰z‚µƒ^ƒCƒ}[ +void MainForm::SetTeamHP(){ + if(MTINFO.DEBUG){ + WriteMessage("EVENT:SET_TEAM_HP\n", DebugMessageColor); + WriteMessage(String::Format("PROCESS:{0}, WINNER:P{1}, HP:{2}\n", (UINT)MTINFO.PROCESS, ((UINT)MTINFO.WINNER)+1, MTINFO.P_HP), DebugMessageColor); + } + Thread::Sleep(1000); + try { + if(MTINFO.WINNER){ + WriteProcessMemory(MTINFO.PROCESS, (LPVOID)P2_HP, &MTINFO.P_HP, 4, NULL); + }else{ + WriteProcessMemory(MTINFO.PROCESS, (LPVOID)P1_HP, &MTINFO.P_HP, 4, NULL); + } + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage(String::Format("{0}\n", e->ToString()), DebugMessageColor); + } + } +} +void MainForm::RunSonar() +{ + int i, j; + bool leave = false; + array^ send = gcnew array(3){ PH_REQ_STATE, 0x00, 0x00 }; + + SonarSleeping = false; + + // 20s‚Ɉê“xƒpƒPƒbƒg‚ð‘—‚èA100sˆÈ㉞“š‚ª‚È‚©‚Á‚½‚çØ’f‚·‚é + while(Ranging){ + SonarSleeping = true; + try{ + Thread::Sleep(20*1000); + } + catch(ThreadInterruptedException^){ + } + SonarSleeping = false; + + // ƒƒO‚ÌŽ©“®•Û‘¶ + if(MTOPTION.AUTO_SAVE){ + if(((timeGetTime() - MemberList[0]->RESPONSE) / 60000) >= MTOPTION.AUTO_SAVE){ + String^ path = gcnew String(MTOPTION.PATH); + path += "auto.log"; + + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SaveFile(path, RichTextBoxStreamType::PlainText); + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "SaveLog"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + + MemberList[0]->RESPONSE = timeGetTime(); + } + } + + if(!Ranging) return; + + Monitor::Enter(MemberList); + try{ + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + listBoxMember->BeginUpdate(); + + for(i = 1; i < MemberList->Count; i++){ + Array::Copy(BitConverter::GetBytes(MemberList[i]->ID), 0, send, 1, 2); + + if((timeGetTime() - MemberList[i]->RESPONSE) > 100*1000){ + WriteTime(0, SystemMessageColor); + WriteMessage(MemberList[i]->NAME + "‚Æ‚Ì’ÊM‚ª“r₦‚Ü‚µ‚½B\n", ErrorMessageColor); + + send[0] = PH_LOST; + + for(j = 1; j < MemberList->Count; j++){ + UDP->BeginSend(send, send->Length, MemberList[j]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + MemberList->RemoveAt(i); + listBoxMember->Items->RemoveAt(i); + + send[0] = PH_REQ_STATE; + i--; + } + else{ + // Šm”FƒpƒP + UDP->BeginSend(send, send->Length, MemberList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + + listBoxMember->EndUpdate(); + } + else{ + if((timeGetTime() - MemberList[1]->RESPONSE) > 100*1000){ + WriteMessage("ƒT[ƒo‚Æ‚Ì’ÊM‚ª“r₦‚Ü‚µ‚½B\n", ErrorMessageColor); + leave = true; + Ranging = false; + } + else{ + UDP->Send(send, send->Length, MemberList[1]->IP_EP); + } + } + } + catch(Exception^){ + WriteMessage("ƒ\ƒi[ƒXƒŒƒbƒh‚ŃGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½B\n", ErrorMessageColor); + } + finally{ + Monitor::Exit(MemberList); + } + } + + if(leave){ + Leave(false); + } +} + +void MainForm::RunGame(Object^ obj) +{ + UINT run_type = (UINT)obj; + bool record_replay = MTOPTION.RECORD_REPLAY; + bool allow_spectator = MTOPTION.ALLOW_SPECTATOR; + UINT sim_delay = MTOPTION.SIMULATE_DELAY; + + // ‘—MŠÔŠu‚ðŒvŽZ + if(run_type == RT_VS){ + NetVS->INTERVAL = 0; + NetVS->INTERVAL2 = 0; + + if(MTOPTION.INTERVAL > 0){ + if(MTOPTION.INTERVAL == 1){ + // Low + NetVS->INTERVAL = (NetVS->DELAY + 1) / 4; + + if(NetVS->INTERVAL == 1){ + switch(NetVS->DELAY){ + case 3: + NetVS->INTERVAL = 0; + break; + case 4: + NetVS->INTERVAL2 = 5; + break; + case 5: + case 6: + NetVS->INTERVAL2 = 3; + break; + } + } + } + else if(MTOPTION.INTERVAL == 2){ + // Middle + NetVS->INTERVAL = (NetVS->DELAY + 1) / 3; + + if(NetVS->INTERVAL == 1){ + switch(NetVS->DELAY){ + case 2: + NetVS->INTERVAL = 0; + break; + case 3: + case 4: + NetVS->INTERVAL2 = 4; + break; + } + } + } + else if(MTOPTION.INTERVAL == 3){ + // High + NetVS->INTERVAL = (NetVS->DELAY + 1) / 2; + + if(NetVS->INTERVAL == 1){ + // Delay:2 ‚Ì‚Ý + NetVS->INTERVAL2 = 3; + } + } + } + } + + TCHAR wdir[_MAX_PATH], buf[_MAX_PATH], drive[_MAX_DRIVE]; + STARTUPINFO si; + PROCESS_INFORMATION pi; + DEBUG_EVENT de; + CONTEXT c; + HANDLE thread = NULL; + DWORD thread_id = 0; + DWORD state, e_code, e_address, mem; + DWORD stage_loop = 0, blt_count = 0, input_count = 0, rand_count = 0, now_time, last_time = 0; + int i, append_cap, last_cap = 0, num_vs = 0, p1_win = 0, p2_win = 0, timer = 0, p1_round = 0, p2_round = 0; + bool vs_end = true, single_p = 0; + + MTINFO.INITIALIZED = false; + MTINFO.SHOW_TOP = false; + ZeroMemory(MTINFO.ORIGINAL_TITLE, sizeof(MTINFO.ORIGINAL_TITLE)); + ZeroMemory(MTINFO.TITLE, sizeof(MTINFO.TITLE)); + + // ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹ + BinaryWriter^ bw = nullptr; + BinaryReader^ br = nullptr; + + REPLAY_INFO ri; + // deque‚ª‚ ‚邽‚߉Šú‰»‚ÍŽè“®‚Å + ri.CONTROL = 0; + ri.KEY[0] = ri.KEY[1] = 0xFFFF; + ri.COUNT[0] = ri.COUNT[1] = 0; + + // ƒfƒBƒŒƒCƒVƒ~ƒ…ƒŒ[ƒg + std::deque sim_que; + std::deque sim_que_p2; + + if(run_type == RT_FREE && sim_delay > 0){ + for(UINT i = 0; i < sim_delay; i++){ + sim_que.push_back(0); + sim_que_p2.push_back(0); + } + } + + try{ + String ^path, ^file; + array^ header = gcnew array{'T', 'Y', 'M', 'T', 'R'}; + BYTE len; + + if(run_type == RT_PLAYBACK){ + br = gcnew BinaryReader(File::OpenRead(ReplayFilePath)); + + // ƒwƒbƒ_ + br->ReadChars(header->Length); + ri.VERSION = br->ReadChar(); + + // P1ƒl[ƒ€ + len = br->ReadByte(); + for(i = 0; i < len; i++){ + MTINFO.P1_NAME[i] = br->ReadChar(); + } + + // P2ƒl[ƒ€ + len = br->ReadByte(); + for(i = 0; i < len; i++){ + MTINFO.P2_NAME[i] = br->ReadChar(); + } + + // —”ƒV[ƒh + MTINFO.SEED = br->ReadUInt32(); + MTINFO.TEAM_ROUND_HP = MTOPTION.TEAM_ROUND_HP; + + if(ri.VERSION >= _T('3')){ + MTINFO.MAX_STAGE = br->ReadByte(); + MTINFO.STAGE_SELECT = br->ReadByte(); + MTINFO.ROUND = br->ReadByte(); + MTINFO.TIMER = br->ReadByte(); + } + else{ + MTINFO.MAX_STAGE = MTOPTION.MAX_STAGE; + MTINFO.STAGE_SELECT = MTOPTION.STAGE_SELECT; + MTINFO.ROUND = MTOPTION.ROUND; + MTINFO.TIMER = MTOPTION.TIMER; + } + } + else if(record_replay){ + path = gcnew String(MTOPTION.REPLAY_FOLDER); + + // ƒQ[ƒ€•Ê‚ɃŠƒvƒŒƒC‚ðU‚蕪‚¯ + if(MTOPTION.REPLAY_DIVIDE){ + path += "\\" + Path::GetFileNameWithoutExtension(gcnew String(MTOPTION.GAME_EXE)); + } + + if(!Directory::Exists(path)){ + Directory::CreateDirectory(path); + } + + if(run_type == RT_VS){ + if(ListView == LV_BLIND){ + file = String::Format("vs_{0}.mtr", DateTime::Now.ToString("yyMMdd-HHmmss")); + } + else{ + file = String::Format("{0}_vs_{1}_{2}.mtr", gcnew String(MTINFO.P1_NAME), gcnew String(MTINFO.P2_NAME), DateTime::Now.ToString("yyMMdd-HHmmss")); + } + } + else{ + file = String::Format("{0}_{1}.mtr", gcnew String(MTINFO.P1_NAME), DateTime::Now.ToString("yyMMdd-HHmmss")); + } + + path += "\\" + file; + bw = gcnew BinaryWriter(File::Create(path)); + + WriteMessage(String::Format("\"{0}\"‚ɃŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚ð쬂µ‚Ü‚·B\n", file), SystemMessageColor); + + // ƒwƒbƒ_ + bw->Write(header); + + switch(MTOPTION.REPLAY_VERSION){ + case 1: + ri.VERSION = _T('3'); + break; + + case 2: + default: + ri.VERSION = _T('4'); + break; + } + + bw->Write(ri.VERSION); + + // P1ƒl[ƒ€ + len = (BYTE)_tcslen(MTINFO.P1_NAME); + bw->Write(len); + for(i = 0; i < len; i++){ + bw->Write(MTINFO.P1_NAME[i]); + } + + // P2ƒl[ƒ€ + len = (BYTE)_tcslen(MTINFO.P2_NAME); + bw->Write(len); + for(i = 0; i < len; i++){ + bw->Write(MTINFO.P2_NAME[i]); + } + + // —”ƒV[ƒh + bw->Write(MTINFO.SEED); + + // ŠeŽíÝ’è + bw->Write((BYTE)MTINFO.MAX_STAGE); + bw->Write((BYTE)MTINFO.STAGE_SELECT); + bw->Write((BYTE)MTINFO.ROUND); + bw->Write((BYTE)MTINFO.TIMER); + } + } + catch(IOException^ e){ + WriteMessage(String::Format("ERROR > ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹\n{0}\n", e->ToString()), ErrorMessageColor); + + if(bw != nullptr){ + bw->Close(); + bw = nullptr; + } + } + + // –¼‘O•\Ž¦—p + int is_p1 = _tcslen(MTINFO.P1_NAME); + int is_p2 = _tcslen(MTINFO.P2_NAME); + + // ƒ‰ƒ“ƒ_ƒ€ƒXƒe[ƒW—p + RandomStage(MTINFO.SEED); + + // ƒXƒe[ƒWƒ‹[ƒv—p + if(MTINFO.STAGE_SELECT > MTINFO.MAX_STAGE){ + stage_loop = MTINFO.MAX_STAGE; + } + + // ŠÏíƒpƒP‘—M€”õ + if(allow_spectator){ + AllowWatch = false; + InputFrame = 0; + + SpectacleThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunSpectacle)); + SpectacleThread->Start(); + } + + // ‘Îí’†’Ê’m + if(run_type != RT_WATCH){ + if(MemberList[0]->STATE == MS_SEEK && run_type == RT_FREE){ + //WriteMessage("aiueo\n", ErrorMessageColor); + }else{ + ChangeState((BYTE)MS_VS); + } + } + + try{ + ZeroMemory(&si, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + + // ì‹ÆƒfƒBƒŒƒNƒgƒŠ + _tsplitpath_s(MTOPTION.GAME_EXE, drive, _MAX_DRIVE, buf, _MAX_DIR, NULL, 0, NULL, 0); + _stprintf_s(wdir, _T("%s%s"), drive, buf); + + if(CreateProcess(MTOPTION.GAME_EXE, NULL, NULL, NULL, false, DEBUG_PROCESS, NULL, wdir, &si, &pi)){ + if(run_type == RT_PLAYBACK){ + WriteMessage(String::Format("\"{0}\"‚ðĶ‚µ‚Ü‚·B\n", Path::GetFileName(ReplayFilePath)), SystemMessageColor); + } + else{ + WriteMessage(String::Format("\"{0}\"‚ð‹N“®‚µ‚Ü‚·B\n", Path::GetFileNameWithoutExtension(gcnew String(MTOPTION.GAME_EXE))), SystemMessageColor); + } + } + else{ + WriteMessage(String::Format("ERROR({0}) > \"{1}\"‚ªŠJ‚¯‚Ü‚¹‚ñ‚Å‚µ‚½B\n", GetLastError(), gcnew String(MTOPTION.GAME_EXE)), ErrorMessageColor); + return; + } + + if(MTOPTION.SHOW_GAME_OPTION){ + WriteMessage(String::Format("[‘ÎíÝ’è]----------------------\n" + "Å‘åƒXƒe[ƒW”: {0} / " + "ƒ‰ƒ“ƒ_ƒ€ƒXƒe[ƒW: {1} / " + "ƒ‰ƒEƒ“ƒh”: {2} / " + "ƒQ[ƒ€ƒ^ƒCƒ}[: {3}\n" + "ƒ‰ƒEƒ“ƒhHPŽ‚¿‰z‚µ: {4}\n" + "-------------------------------\n" + , MTINFO.MAX_STAGE, MTINFO.STAGE_SELECT, MTINFO.ROUND, MTINFO.TIMER, MTINFO.TEAM_ROUND_HP == true ? "ON" : "OFF"), SystemMessageColor); + } + + // ‹N“®‘Ò‚¿ + Thread::Sleep(300); + + MTINFO.PROCESS = pi.hProcess; + MTINFO.PROCESS_ID = pi.dwProcessId; + + while(WaitForDebugEvent(&de, INFINITE)){ + state = DBG_CONTINUE; + + switch(de.dwDebugEventCode){ + case EXCEPTION_DEBUG_EVENT: + e_code = de.u.Exception.ExceptionRecord.ExceptionCode; + e_address = (DWORD)de.u.Exception.ExceptionRecord.ExceptionAddress; + + if (e_code == ERROR_NOACCESS) { + if(MTINFO.DEBUG){ + WriteMessage(String::Format("ERROR_NOACCESS > {0} : {1}\n", e_code, e_address), DebugMessageColor); + } + state = DBG_EXCEPTION_NOT_HANDLED; + } + + if(e_code == EXCEPTION_ACCESS_VIOLATION){ + ULONG_PTR info0 = de.u.Exception.ExceptionRecord.ExceptionInformation[0]; + ULONG_PTR info1 = de.u.Exception.ExceptionRecord.ExceptionInformation[1]; + + if(MTINFO.DEBUG){ + WriteMessage(String::Format("EXCEPTION_ACCESS_VIOLATION > {0:X8}@{1:X8} : {2}@{3:X8}\n", e_code, e_address, info0 ? "read" : "write", info1), DebugMessageColor); + } + + state = DBG_EXCEPTION_NOT_HANDLED; + } + + if(e_code == EXCEPTION_BREAKPOINT){ + if(de.dwThreadId != thread_id){ + break; + } + + switch(e_address){ + case VS_ROUND: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Eax++; + SetThreadContext(thread, &c); + + if(MTINFO.DEBUG){ + WriteMessage("EVENT:VS_ROUND\n", DebugMessageColor); + } + + if(vs_end){ + num_vs++; + vs_end = false; + } + break; + + case VS_ROUND_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Edx = 0; + SetThreadContext(thread, &c); + + if(vs_end){ + num_vs++; + vs_end = false; + } + break; + + case ROUND_END: + ReadProcessMemory(pi.hProcess, (LPVOID)ROUND_ESI, &mem, 4, NULL); + + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Esi = mem; + + if(vs_end == false){ + + // HPŽ‚¿‰z‚µ Edx:1P_ROUND Esi:2P_ROUND Eax:ROUND + if(MTINFO.TEAM_ROUND_HP){ + if(c.Edx > (UINT)p1_round && c.Esi > (UINT)p2_round){ + // ‘Š‘Å‚¿ + }else{ + if(c.Edx > (UINT)p1_round){ + p1_round = c.Edx; + ReadProcessMemory(pi.hProcess, (LPVOID)P1_HP, &MTINFO.P_HP, 4, NULL); + MTINFO.WINNER = 0; + SetTeamHPThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::SetTeamHP)); + SetTeamHPThread->Start(); + } + if(c.Esi > (UINT)p2_round){ + p2_round = c.Esi; + ReadProcessMemory(pi.hProcess, (LPVOID)P2_HP, &MTINFO.P_HP, 4, NULL); + MTINFO.WINNER = 1; + SetTeamHPThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::SetTeamHP)); + SetTeamHPThread->Start(); + } + } + } + + // ‘ÎíI—¹Žž‚Í‚Q‰ñ”ò‚ñ‚Å‚­‚é + if(c.Eax == c.Edx){ + p1_win++; + vs_end = true; + } + if(c.Eax == c.Esi){ + p2_win++; + vs_end = true; + } + + if(vs_end){ + timer = 0; + p1_round = 0; + p2_round = 0; + } + } + + SetThreadContext(thread, &c); + break; + + case ROUND_END_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Ebx = 0; + SetThreadContext(thread, &c); + + if(vs_end == false){ + // ‘ÎíI—¹Žž‚Í‚R‰ñ”ò‚ñ‚Å‚­‚é + ReadProcessMemory(pi.hProcess, (LPVOID)P1_WIN_95, &mem, 4, NULL); + if(mem == 2){ + p1_win++; + vs_end = true; + } + ReadProcessMemory(pi.hProcess, (LPVOID)P2_WIN_95, &mem, 4, NULL); + if(mem == 2){ + p2_win++; + vs_end = true; + } + } + break; + + case RAND_FUNC: + rand_count++; + ReadProcessMemory(pi.hProcess, (LPVOID)RANDOM_SEED, &mem, 4, NULL); + + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Eax = mem; + SetThreadContext(thread, &c); + break; + + case RAND_FUNC_95: + rand_count++; + ReadProcessMemory(pi.hProcess, (LPVOID)RANDOM_SEED_95, &mem, 4, NULL); + + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Eax = mem; + SetThreadContext(thread, &c); + break; + + case STAGE_SELECT: + case STAGE_SELECT_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + + if(MTINFO.DEBUG){ + WriteMessage("EVENT:STAGE_SELECT\n", DebugMessageColor); + } + + if(MTINFO.RAND_SEARCH){ + stage_loop = 0; + + MTINFO.MAX_STAGE = MTOPTION.MAX_STAGE; + MTINFO.STAGE_SELECT = MTOPTION.STAGE_SELECT; + } + + if(stage_loop > 0){ + i = stage_loop - 1; + + stage_loop++; + + if(stage_loop > MTINFO.STAGE_SELECT){ + stage_loop = MTINFO.MAX_STAGE; + } + } + else{ + if(MTINFO.STAGE_SELECT == 0){ + i = RandomStage() % MTINFO.MAX_STAGE; + } + else{ + i = MTINFO.STAGE_SELECT - 1; + } + } + + if(e_address == STAGE_SELECT){ + c.Eax = i; + } + else{ + c.Ecx = i; + } + + SetThreadContext(thread, &c); + break; + + case SINGLE_CONTROL_HOOK: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Ecx = 0; + SetThreadContext(thread, &c); + break; + + case STORY_KEY: + case VS_P2_KEY: + input_count++; + + case VS_P1_KEY: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + + if(run_type == RT_VS){ + if(e_address == STORY_KEY){ + c.Eax = LocalInput((UINT16)c.Eax); + c.Eax |= RemoteInput(); + } + else if((e_address == VS_P1_KEY && MTINFO.CONTROL == 0) || (e_address == VS_P2_KEY && MTINFO.CONTROL == 1)){ + c.Eax = LocalInput((UINT16)c.Eax); + } + else{ + c.Eax = RemoteInput(); + } + } + else if(run_type == RT_WATCH && WaitingWatch > 0){ + // ŠÏíƒoƒbƒtƒ@‚©‚ç“Ç‚Ýž‚Ý + c.Eax = WatchHistory[WatchFrame % WatchHistory->Length]; + + if(c.Eax == 0xFFFF){ + Monitor::Enter(WatchHistory); + try{ + WaitingWatch = 2; + Monitor::Wait(WatchHistory, TIME_OUT*2); + } + finally{ + Monitor::Exit(WatchHistory); + } + + c.Eax = WatchHistory[WatchFrame % WatchHistory->Length]; + + if(c.Eax == 0xFFFF && WaitingWatch == 2){ + WriteMessage("ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½‚½‚ߊÏí‚ðI—¹‚µ‚Ü‚·B\n", ErrorMessageColor); + QuitWatch(true); + } + } + + Monitor::Enter(WatchHistory); + try{ + WatchHistory[WatchFrame % WatchHistory->Length] = 0xFFFF; + WatchFrame++; + } + finally{ + Monitor::Exit(WatchHistory); + } + } + else if(run_type == RT_PLAYBACK){ + c.Eax = ReadReplayData(br, ri); + } + else if(run_type == RT_FREE && sim_delay > 0){ + // ƒfƒBƒŒƒCƒVƒ~ƒ…ƒŒ[ƒg + if(e_address != VS_P2_KEY){ + sim_que.push_back((UINT16)c.Eax); + c.Eax = sim_que.front(); + sim_que.pop_front(); + }else{ + sim_que_p2.push_back((UINT16)c.Eax); + c.Eax = sim_que_p2.front(); + sim_que_p2.pop_front(); + } + } + + if(record_replay || allow_spectator){ + RecordInput((UINT16)c.Eax, bw, ri, allow_spectator); + } + + // ƒƒ‚ƒŠ‚É‘‚«ž‚Ý + if(e_address == VS_P2_KEY){ + WriteProcessMemory(pi.hProcess, (LPVOID)P2_INPUT, &c.Eax, 4, NULL); + } + else{ + WriteProcessMemory(pi.hProcess, (LPVOID)P1_INPUT, &c.Eax, 4, NULL); + } + + SetThreadContext(thread, &c); + break; + + case UNCHECK_JOYSTICK_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Eax = 0; + SetThreadContext(thread, &c); + break; + + case STORY_P2_KEY_95: + case VS_P2_KEY_95: + input_count++; + + case STORY_P1_KEY_95: + case VS_P1_KEY_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + + if(e_address == STORY_P1_KEY_95){ + ReadProcessMemory(pi.hProcess, (LPVOID)INPUT_COUNTER_95, &mem, 4, NULL); + c.Ecx = mem; + } + else if(e_address == STORY_P2_KEY_95){ + ReadProcessMemory(pi.hProcess, (LPVOID)INPUT_COUNTER_95, &mem, 4, NULL); + c.Edx = mem; + } + + // ƒL[“ü—Í‚ ‚ꂱ‚ê 95Ver + if(run_type == RT_VS){ + if((e_address == STORY_P1_KEY_95 && MTINFO.CONTROL == 0) || (e_address == STORY_P2_KEY_95 && MTINFO.CONTROL == 1) || + (e_address == VS_P1_KEY_95 && MTINFO.CONTROL == 0) || (e_address == VS_P2_KEY_95 && MTINFO.CONTROL == 1)){ + c.Eax = LocalInput((UINT16)c.Eax); + } + else{ + c.Eax = RemoteInput(); + } + } + else if(run_type == RT_WATCH && WaitingWatch > 0){ + // ŠÏíƒoƒbƒtƒ@‚©‚ç“Ç‚Ýž‚Ý + c.Eax = WatchHistory[WatchFrame % WatchHistory->Length]; + + if(c.Eax == 0xFFFF){ + Monitor::Enter(WatchHistory); + try{ + WaitingWatch = 2; + Monitor::Wait(WatchHistory, TIME_OUT*2); + } + finally{ + Monitor::Exit(WatchHistory); + } + + c.Eax = WatchHistory[WatchFrame % WatchHistory->Length]; + + if(c.Eax == 0xFFFF && WaitingWatch == 2){ + WriteMessage("ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½‚½‚ߊÏí‚ðI—¹‚µ‚Ü‚·B\n", ErrorMessageColor); + QuitWatch(true); + } + } + + Monitor::Enter(WatchHistory); + try{ + WatchHistory[WatchFrame % WatchHistory->Length] = 0xFFFF; + WatchFrame++; + } + finally{ + Monitor::Exit(WatchHistory); + } + } + else if(run_type == RT_PLAYBACK){ + c.Eax = ReadReplayData(br, ri); + } + else if(run_type == RT_FREE && sim_delay > 0){ + // 2P“ü—͂̃Vƒ~ƒ…ƒŒ[ƒg‚Í‚µ‚È‚¢ + + if(e_address != STORY_P2_KEY_95 && e_address != VS_P2_KEY_95){ + sim_que.push_back((UINT16)c.Eax); + c.Eax = sim_que.front(); + sim_que.pop_front(); + } + + } + + if(record_replay || allow_spectator){ + RecordInput((UINT16)c.Eax, bw, ri, allow_spectator); + } + + if(e_address == VS_P1_KEY_95){ + WriteProcessMemory(pi.hProcess, (LPVOID)P1_INPUT_95, &c.Eax, 4, NULL); + } + else if(e_address == VS_P2_KEY_95){ + WriteProcessMemory(pi.hProcess, (LPVOID)P2_INPUT_95, &c.Eax, 4, NULL); + } + + SetThreadContext(thread, &c); + break; + + case FRAME_RATE: + case FRAME_RATE_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Esi = c.Eax; + SetThreadContext(thread, &c); + + blt_count++; + now_time = timeGetTime(); + + if(now_time - last_time >= 1000){ + last_time = now_time; + + append_cap = 0; + _tcscpy_s(MTINFO.TITLE, MTINFO.ORIGINAL_TITLE); + + if(MTOPTION.DISPLAY_NAME){ + if(is_p1 == 0 && is_p2 == 0){ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s [–쎎‡’†]"), MTINFO.TITLE); + } + else if(is_p2 == 0){ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s [%s]"), MTINFO.TITLE, MTINFO.P1_NAME); + } + else{ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s [%s vs %s]"), MTINFO.TITLE, MTINFO.P1_NAME, MTINFO.P2_NAME); + } + } + if(MTOPTION.DISPLAY_VERSUS){ + if(MTOPTION.SHOW_RESULT){ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s ‘Îí”:%d (%d - %d)"), MTINFO.TITLE, num_vs, p1_win, p2_win); + }else{ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s ‘Îí”:%d"), MTINFO.TITLE, num_vs); + } + } + if(MTOPTION.DISPLAY_FRAMERATE){ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s fps:%3d(%d“)"), MTINFO.TITLE, blt_count, input_count); + } + if(MTOPTION.DISPLAY_RAND){ + append_cap = _stprintf_s(MTINFO.TITLE, _T("%s —”:%d"), MTINFO.TITLE, rand_count); + } + + blt_count = 0; + input_count = 0; + rand_count = 0; + + if(append_cap > 0 || last_cap > 0 || MTINFO.HWND == NULL){ + last_cap = append_cap; + + Thread^ cap = gcnew Thread(gcnew ThreadStart(&SetCaption)); + cap->Start(); + } + } + break; + + case BGM_VOLUME: + case BGM_VOLUME_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Edx = MTINFO.VOLUME[MTOPTION.BGM_VOLUME/5]; + SetThreadContext(thread, &c); + break; + + case SE_VOLUME: + case SE_VOLUME_95: + c.ContextFlags = CONTEXT_INTEGER; + GetThreadContext(thread, &c); + c.Edx = MTINFO.VOLUME[MTOPTION.SE_VOLUME/5]; + SetThreadContext(thread, &c); + break; + } + + // ƒfƒoƒbƒO:ƒCƒxƒ“ƒg•\Ž¦ + if(MTINFO.DEBUG){ + /* + if (e_address != VS_P1_KEY && e_address != RAND_FUNC && e_address != VS_P2_KEY + && e_address != FRAME_RATE && e_address != SE_VOLUME && e_address != ROUND_END + && e_address != STAGE_SELECT && e_address != VS_ROUND) { + int nValue = e_address; + char pszText[32]; + _itoa_s(nValue, pszText, 32 * sizeof(char), 16); + WriteMessage(String::Format("EVENT:{0}\n", gcnew String(pszText)), DebugMessageColor); + } + */ + // ‰ðÍ—p + if (e_address != VS_P1_KEY && e_address != RAND_FUNC && e_address != VS_P2_KEY + && e_address != FRAME_RATE && e_address != SE_VOLUME && e_address != VS_ROUND) { + int nValue = e_address; + char pszText[32]; + _itoa_s(nValue, pszText, 32 * sizeof(char), 16); + WriteMessage(String::Format("EVENT:{0}\n", gcnew String(pszText)), DebugMessageColor); + } + + } + } + break; + + case CREATE_THREAD_DEBUG_EVENT: + if(MTINFO.DEBUG){ + WriteMessage("CREATE_THREAD_DEBUG_EVENT\n", DebugMessageColor); + } + break; + + case CREATE_PROCESS_DEBUG_EVENT: + if(MTINFO.DEBUG){ + WriteMessage("CREATE_PROCESS_DEBUG_EVENT\n", DebugMessageColor); + WriteMessage(String::Format("{0}\n", MTINFO.SEED), DebugMessageColor); + } + + thread = de.u.CreateProcessInfo.hThread; + thread_id = de.dwThreadId; + + // ‚±‚±‚©‚ç‘‚«Š·‚¦ƒ][ƒ“ + if(MTINFO.KGT2K){ + // 2nd.—p + mem = MTOPTION.HIT_JUDGE; + WriteProcessMemory(pi.hProcess, (LPVOID)HIT_JUDGE, &mem, 4, NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)HIT_JUDGE_SET, HIT_JUDGE_SET_CODE, sizeof(HIT_JUDGE_SET_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)RANDOM_SEED, &MTINFO.SEED, 4, NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)STAGE_SELECT, STAGE_SELECT_CODE, sizeof(STAGE_SELECT_CODE), NULL); + + WriteProcessMemory(pi.hProcess, (LPVOID)ROUND_SET, ROUND_SET_CODE, sizeof(ROUND_SET_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)TIMER_SET, TIMER_SET_CODE, sizeof(TIMER_SET_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)DEFAULT_ROUND, &MTINFO.ROUND, 4, NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)DEFAULT_TIMER, &MTINFO.TIMER, 4, NULL); + + // ƒ`[ƒ€ƒvƒŒƒCƒ‰ƒEƒ“ƒh” + WriteProcessMemory(pi.hProcess, (LPVOID)TEAM_ROUND_SET, TEAM_ROUND_SET_CODE, sizeof(TEAM_ROUND_SET_CODE), NULL); + if(MTINFO.ROUND > 4) { + WriteProcessMemory(pi.hProcess, (LPVOID)TEAM_ROUND, &MAX_TEAM_ROUND, 4, NULL); + }else{ + WriteProcessMemory(pi.hProcess, (LPVOID)TEAM_ROUND, &MTINFO.ROUND, 4, NULL); + } + + + // ƒ^ƒCƒgƒ‹ƒo[•\Ž¦—p + WriteProcessMemory(pi.hProcess, (LPVOID)VS_ROUND, VS_ROUND_CODE, sizeof(VS_ROUND_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)ROUND_END, ROUND_END_CODE, sizeof(ROUND_END_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)FRAME_RATE, FRAME_RATE_CODE, sizeof(FRAME_RATE_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)RAND_FUNC, RAND_FUNC_CODE, sizeof(RAND_FUNC_CODE), NULL); + + // ‰¹—Ê + WriteProcessMemory(pi.hProcess, (LPVOID)VOLUME_SET_1, VOLUME_SET_1_CODE, sizeof(VOLUME_SET_1_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VOLUME_SET_2, VOLUME_SET_2_CODE, sizeof(VOLUME_SET_2_CODE), NULL); + + // ”M‘Ñ’†‚Íí‚É1P“ü—Í + if(run_type == RT_VS){ + WriteProcessMemory(pi.hProcess, (LPVOID)SINGLE_CONTROL_HOOK, SINGLE_CONTROL_HOOK_CODE, sizeof(SINGLE_CONTROL_HOOK_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VS_CONTROL_HOOK, VS_CONTROL_HOOK_CODE, sizeof(VS_CONTROL_HOOK_CODE), NULL); + } + + // ƒL[î•ñ‚ðŽæ“¾ + WriteProcessMemory(pi.hProcess, (LPVOID)STORY_KEY, STORY_KEY_CODE, sizeof(STORY_KEY_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VS_P1_KEY, VS_P1_KEY_CODE, sizeof(VS_P1_KEY_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VS_P2_KEY, VS_P2_KEY_CODE, sizeof(VS_P2_KEY_CODE), NULL); + + // ƒEƒBƒ“ƒhƒEƒTƒCƒY‚ð640x480‚É + if(MTOPTION.CHANGE_WINDOW_SIZE){ + TCHAR val[32]; + + _stprintf_s(buf, _T("%sgame.ini"), wdir); + + if(File::Exists(gcnew String(buf))){ + _itot_s(640, val, 10); + WritePrivateProfileString(_T("GamePlay"), _T("GameWindowSize_x"), val, buf); + _itot_s(480, val, 10); + WritePrivateProfileString(_T("GamePlay"), _T("GameWindowSize_y"), val, buf); + } + } + } + else{ + // 95—p + mem = MTOPTION.HIT_JUDGE; + WriteProcessMemory(pi.hProcess, (LPVOID)HIT_JUDGE_95, &mem, 4, NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)HIT_JUDGE_SET_95, HIT_JUDGE_SET_95_CODE, sizeof(HIT_JUDGE_SET_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)RANDOM_SEED_95, &MTINFO.SEED, 4, NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)STAGE_SELECT_95, STAGE_SELECT_95_CODE, sizeof(STAGE_SELECT_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)TIMER_SET_95, TIMER_SET_95_CODE, sizeof(TIMER_SET_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)DEFAULT_TIMER_95, &MTINFO.TIMER, 4, NULL); + + // ƒ^ƒCƒgƒ‹ƒo[•\Ž¦—p + WriteProcessMemory(pi.hProcess, (LPVOID)VS_ROUND_95, VS_ROUND_95_CODE, sizeof(VS_ROUND_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)ROUND_END_95, ROUND_END_95_CODE, sizeof(ROUND_END_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)FRAME_RATE_95, FRAME_RATE_95_CODE, sizeof(FRAME_RATE_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)RAND_FUNC_95, RAND_FUNC_95_CODE, sizeof(RAND_FUNC_95_CODE), NULL); + + // ‰¹—Ê + WriteProcessMemory(pi.hProcess, (LPVOID)VOLUME_SET_1_95, VOLUME_SET_1_95_CODE, sizeof(VOLUME_SET_1_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VOLUME_SET_2_95, VOLUME_SET_2_95_CODE, sizeof(VOLUME_SET_2_95_CODE), NULL); + + // JoyStick‚̓Gƒ‰[‹N‚±‚·‚̂ŃIƒt‚É‚·‚é + WriteProcessMemory(pi.hProcess, (LPVOID)UNCHECK_JOYSTICK_95, UNCHECK_JOYSTICK_95_CODE, sizeof(UNCHECK_JOYSTICK_95_CODE), NULL); + + // ”M‘Ñ’†‚Íí‚É1P“ü—Í + if(run_type == RT_VS){ + WriteProcessMemory(pi.hProcess, (LPVOID)CONTROL_HOOK1_95, CONTROL_HOOK1_95_CODE, sizeof(CONTROL_HOOK1_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)CONTROL_HOOK2_95, CONTROL_HOOK2_95_CODE, sizeof(CONTROL_HOOK2_95_CODE), NULL); + } + + // ƒL[î•ñ‚ðŽæ“¾ + WriteProcessMemory(pi.hProcess, (LPVOID)STORY_P1_KEY_95, STORY_P1_KEY_95_CODE, sizeof(STORY_P1_KEY_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)STORY_P2_KEY_95, STORY_P2_KEY_95_CODE, sizeof(STORY_P2_KEY_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VS_P1_KEY_95, VS_P1_KEY_95_CODE, sizeof(VS_P1_KEY_95_CODE), NULL); + WriteProcessMemory(pi.hProcess, (LPVOID)VS_P2_KEY_95, VS_P2_KEY_95_CODE, sizeof(VS_P2_KEY_95_CODE), NULL); + } + + FlushInstructionCache(pi.hProcess, NULL, 0); + MTINFO.INITIALIZED = true; + break; + + case EXIT_THREAD_DEBUG_EVENT: + if(MTINFO.DEBUG){ + WriteMessage("EXIT_THREAD_DEBUG_EVENT\n", DebugMessageColor); + } + break; + + case EXIT_PROCESS_DEBUG_EVENT: + if(MTINFO.DEBUG){ + WriteMessage("EXIT_PROCESS_DEBUG_EVENT\n", DebugMessageColor); + } + break; + + case LOAD_DLL_DEBUG_EVENT: + if(MTINFO.DEBUG){ + TCHAR buf[MAX_PATH]; + LONG_PTR data; + + ReadProcessMemory(pi.hProcess, de.u.LoadDll.lpImageName, &data, sizeof(LONG_PTR), NULL); + ReadProcessMemory(pi.hProcess, (LPVOID)data, buf, sizeof(TCHAR)*MAX_PATH, NULL); + + WriteMessage(String::Format("LOAD_DLL_DEBUG_EVENT > \"{0}\"\n", gcnew String(buf)), DebugMessageColor); + } + break; + + case UNLOAD_DLL_DEBUG_EVENT: + if(MTINFO.DEBUG){ + WriteMessage("UNLOAD_DLL_DEBUG_EVENT\n", DebugMessageColor); + } + break; + + case OUTPUT_DEBUG_STRING_EVENT: + if(MTINFO.DEBUG){ + int size = de.u.DebugString.nDebugStringLength; + char *str = (char *)malloc(size); + ReadProcessMemory(pi.hProcess, de.u.DebugString.lpDebugStringData, str, size, NULL); + + if(str[size-2] == '\n'){ + str[size-2] = '\0'; + } + + WriteMessage(String::Format("OUTPUT_DEBUG_STRING_EVENT > {0}\n", gcnew String(str)), DebugMessageColor); + free(str); + } + break; + + case RIP_EVENT: + if(MTINFO.DEBUG){ + WriteMessage("RIP_EVENT\n", DebugMessageColor); + } + break; + } + + ContinueDebugEvent(de.dwProcessId, de.dwThreadId, state); + if(de.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) break; + } + } + catch(Exception^ e){ + WriteMessage(e->ToString() + "\n", ErrorMessageColor); + } + finally{ + AllowWatch = false; + InputFrame = 0; + + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + + if(br != nullptr){ + br->Close(); + } + if(bw != nullptr){ + bw->Write(ri.KEY[0]); + bw->Write(ri.COUNT[0]); + bw->Write((UINT16)(ri.KEY[1] | 0x0800)); + bw->Write(ri.COUNT[1]); + + bw->Close(); + } + + + if(MTINFO.INITIALIZED){ + if(WaitingWatch > 0){ + WaitingWatch = 0; + WriteMessage("ŠÏí‚𒆎~‚µ‚Ü‚·B\n", SystemMessageColor); + } + else if(_tcslen(MTINFO.ORIGINAL_TITLE) > 0){ + WriteMessage(String::Format("\"{0}\"‚ðI—¹‚µ‚Ü‚µ‚½B\n", gcnew String(MTINFO.ORIGINAL_TITLE)), SystemMessageColor); + + if(run_type == RT_VS){ + if(MTINFO.CONTROL == 1){ + i = p1_win; + p1_win = p2_win; + p2_win = i; + } + WriteTime(0, SystemMessageColor); + WriteMessage(String::Format("‘Îí¬Ñ F {0}í {1}Ÿ {2}”s\n", num_vs, p1_win, p2_win), SecretColor); + } + } + else{ + WriteMessage("ƒQ[ƒ€‚ðI—¹‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + } + } + + if(NetVS != nullptr && NetVS->SEQUENCE == VS_DATA){ + NetVS->SEQUENCE = VS_END; + UDP->Send(gcnew array{ PH_VS_END }, 1, NetVS->IP_EP); + + // ƒƒbƒNŠJ•ú‘Ò‚¿ + Monitor::Enter(NetVS->LOCAL); + Monitor::Exit(NetVS->LOCAL); + Monitor::Enter(NetVS->REMOTE); + Monitor::Exit(NetVS->REMOTE); + + delete NetVS; + NetVS = nullptr; + } + + if(allow_spectator){ + AllowWatch = false; + SpectacleThread->Join(); + } + + if(AfterCloseUDP){ + AfterCloseUDP = false; + UDP->Close(); + } + else if(run_type == RT_WATCH){ + QuitWatch(true); + } + else{ + // ‘ÎíI—¹‚ð’Ê’m + if(MTOPTION.AFTER_REST && run_type == RT_VS){ + ChangeState((BYTE)MS_REST); + } + else{ + ChangeState((BYTE)MS_FREE); + } + } + + MTINFO.INITIALIZED = false; + MTINFO.SHOW_TOP = false; + MTINFO.PROCESS = NULL; + MTINFO.PROCESS_ID = 0; + MTINFO.HWND = NULL; + ZeroMemory(MTINFO.ORIGINAL_TITLE, sizeof(MTINFO.ORIGINAL_TITLE)); + ZeroMemory(MTINFO.TITLE, sizeof(MTINFO.TITLE)); + + if(IsFormClosing){ + this->Close(); + } + } +} + +void MainForm::RunVersus() +{ + array^ send = gcnew array(7); + + try{ + // ‘Îí—v‹ + send[0] = PH_REQ_VS; + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, send, 1, 2); + Array::Copy(BitConverter::GetBytes((INT32)(Path::GetFileNameWithoutExtension(gcnew String(MTOPTION.GAME_EXE))->GetHashCode())), 0, send, 3, 4); + UDP->Send(send, 7, NetVS->IP_EP); + + NetVS->SLEEPING = true; + try{ + Thread::Sleep(TIME_OUT); + } + catch(ThreadInterruptedException^){ + } + NetVS->SLEEPING = false; + + if(NetVS->SEQUENCE != VS_PING){ + if(NetVS->SEQUENCE != VS_ERROR){ + WriteMessage("’§í‘ŠŽè‚©‚ç‚̉ž“š‚ª‚ ‚è‚Ü‚¹‚ñ‚Å‚µ‚½B\n", ErrorMessageColor); + } + return; + } + + // PING‚őш撲¸ + send[0] = PH_REQ_VS_PING; + + for(BYTE i = 0; i < 5; i++){ + NetVS->PING[i] = timeGetTime(); + send[1] = i; + UDP->Send(send, 2, NetVS->IP_EP); + + Thread::Sleep(10); + } + + if(NetVS->SEQUENCE == VS_PING){ + NetVS->SLEEPING = true; + try{ + // Å’á‚Å‚à‚P•bŠÔ‚ɃpƒP‚S‚‚͗~‚µ‚¢‚Æ‚±‚ë + Thread::Sleep(1000); + } + catch(ThreadInterruptedException^){ + } + NetVS->SLEEPING = false; + } + + if(NetVS->SEQUENCE != VS_SETTING){ + WriteMessage("’§í‘ŠŽè‚Ƃ̉ñü‚ª•sˆÀ’è‚Å‚·B\n", ErrorMessageColor); + return; + } + + // DELAY‚ÌÝ’è + send[0] = PH_REQ_VS_SETTING; + + if(MTOPTION.DELAY == 0){ + // ƒI[ƒgÝ’è + int d = 0, c = 0; + + for(int i = 0; i < 5; i++){ + if(NetVS->PONG[i] > 0){ + d += NetVS->PONG[i] - NetVS->PING[i]; + c++; + + if(c == 4) break; + } + } + + if(c < 4){ + WriteMessage("ƒfƒBƒŒƒC’l‚ÌŒvŽZ‚ª³í‚És‚í‚ê‚Ü‚¹‚ñ‚Å‚µ‚½B\n", ErrorMessageColor); + return; + } + + c = d/40 + 2; // Delay = PING/10 + 2 + + if(c > 12) c = 12; + + NetVS->DELAY = c; + } + else{ + NetVS->DELAY = MTOPTION.DELAY; + } + + send[1] = (BYTE)NetVS->DELAY; + UDP->Send(send, 2, NetVS->IP_EP); + + NetVS->SLEEPING = true; + try{ + Thread::Sleep(TIME_OUT); + } + catch(ThreadInterruptedException^){ + } + NetVS->SLEEPING = false; + + if(NetVS->SEQUENCE != VS_STANDBY){ + WriteMessage("‘Î퀔õ‚ªŠ®—¹‚µ‚Ü‚¹‚ñ‚Å‚µ‚½B\n", ErrorMessageColor); + return; + } + + NetVS->SEQUENCE = VS_DATA; + + // ‘ÎíŠJŽn + WriteMessage(String::Format("‘Îí‚ðŠJŽn‚µ‚Ü‚·B(delay:{0})\n", NetVS->DELAY), SystemMessageColor); + + GameThread = gcnew Thread(gcnew ParameterizedThreadStart(this, &MainForm::RunGame)); + GameThread->Start((UINT)RT_VS); + } + finally{ + if(NetVS->SEQUENCE < VS_DATA || NetVS->SEQUENCE == VS_ERROR){ + MemberList[0]->STATE = MS_FREE; + + delete NetVS; + NetVS = nullptr; + } + } +} + +void MainForm::RunSpectacle() +{ + int i, d; + UINT32 frame = 0, s_frame; + + // ŠJŽn‡} + array^ send = gcnew array(14); + send[0] = PH_RES_WATCH; + send[1] = 0; + Array::Copy(BitConverter::GetBytes(P1ID), 0, send, 2, 2); + Array::Copy(BitConverter::GetBytes(P2ID), 0, send, 4, 2); + Array::Copy(BitConverter::GetBytes(MTINFO.SEED), 0, send, 6, 4); + send[10] = MTINFO.MAX_STAGE; + send[11] = MTINFO.STAGE_SELECT; + send[12] = MTINFO.ROUND; + send[13] = MTINFO.TIMER; + + Monitor::Enter(InputHistory); + try{ + for(i = 0; i < SpectatorList->Count; i++){ + UDP->BeginSend(send, send->Length, SpectatorList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + finally{ + Monitor::Exit(InputHistory); + } + + Thread::Sleep(100); + + // ƒf[ƒ^‘—M€”õ + send = gcnew array(45){ PH_WATCH_DATA }; + + // €”õŠ®—¹ + AllowWatch = true; + + // ƒf[ƒ^‘—M + while(AllowWatch){ + Monitor::Enter(InputHistory); + try{ + frame = InputFrame; + + for(i = 0; i < SpectatorList->Count; i++){ + s_frame = SpectatorList[i]->FRAME; +/* + // ƒf[ƒ^‚ÍŠù‚Ƀoƒbƒtƒ@‚©‚ç‚È‚­‚È‚Á‚Ä‚é + if(frame > s_frame && (frame - s_frame) >= (UINT)InputHistory->Length - 20){ + if(MTINFO.DEBUG) WriteMessage(String::Format("ŠÏíŽÒ‚Ì’Ç‚¢o‚µ > {0} / {1}\n", SpectatorList[i]->ID, SpectatorList->Count), DebugMessageColor); + + send[0] = PH_WATCH_END; + Array::Copy(BitConverter::GetBytes(SpectatorList[i]->ID), 0, send, 1, 2); + UDP->BeginSend(send, 3, SpectatorList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + + SpectatorList->RemoveAt(i); + i--; + + send[0] = PH_WATCH_DATA; + continue; + } +*/ + // 5ƒtƒŒ[ƒ€‚²‚Æ‚É10ƒtƒŒ[ƒ€•ª‘—‚é + if(s_frame + 20 < frame){ + Array::Copy(BitConverter::GetBytes(s_frame), 0, send, 1, 4); + + for(d = 0; d < 20; d++){ + Array::Copy(BitConverter::GetBytes(InputHistory[(s_frame + d) % InputHistory->Length]), 0, send, 5 + d*2, 2); + } + + UDP->BeginSend(send, send->Length, SpectatorList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + + // 0frame‚ÌŽž‚Í”O‚Ì‚½‚ß‚QŒÂ‘—M + if(s_frame == 0){ + UDP->BeginSend(send, send->Length, SpectatorList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + SpectatorList[i]->FRAME += 10; + } + } + } + finally{ + Monitor::Exit(InputHistory); + } + + // ‚¿‚å‚Á‚Æ‚¾‚¯‹xŒe + Thread::Sleep(20); + } + + // I—¹‡} + send[0] = PH_WATCH_END; + + Monitor::Enter(InputHistory); + try{ + for(i = 0; i < SpectatorList->Count; i++){ + Array::Copy(BitConverter::GetBytes(SpectatorList[i]->ID), 0, send, 1, 2); + UDP->BeginSend(send, 3, SpectatorList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + SpectatorList->Clear(); + } + finally{ + Monitor::Exit(InputHistory); + } +} + +UINT16 MainForm::LocalInput(UINT16 eax) +{ + // ¶‰E“¯Žž‰Ÿ‚µ‹ÖŽ~ if((eax & 3) == 3) eax ^= 2 + if((eax & 0x0003) == 0x0003){ + eax &= 0xFFFD; + } + + Monitor::Enter(NetVS->LOCAL); + try{ + NetVS->LOCAL[(NetVS->L_READ + NetVS->DELAY) % NetVS->LOCAL->Length] = eax; + eax = NetVS->LOCAL[NetVS->L_READ]; + + bool send = true; + + if(NetVS->INTERVAL > 0){ + if(NetVS->INTERVAL == 1){ + // ŠÔŠu‚P(’èŠú‹xŒeƒ‚[ƒh) + if((NetVS->L_FRAME % NetVS->INTERVAL2) == (NetVS->INTERVAL2 - 1)){ + send = false; + } + } + else{ + // ŠÔŠu‚QˆÈã + if((NetVS->L_FRAME % NetVS->INTERVAL) != 0){ + send = false; + } + } + } + + if(send){ + // ‘—MŠJŽn + Array::Copy(BitConverter::GetBytes(NetVS->L_FRAME), 0, NetVS->SEND, 1, 4); + + UINT i; + for(i = 0; i <= NetVS->DELAY; i++){ + Array::Copy(BitConverter::GetBytes(NetVS->LOCAL[(NetVS->L_READ + i) % NetVS->LOCAL->Length]), 0, NetVS->SEND, 5 + i*2, 2); + } + + UDP->BeginSend(NetVS->SEND, 5 + i*2, NetVS->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + NetVS->L_FRAME++; + NetVS->L_READ++; + NetVS->L_READ %= NetVS->LOCAL->Length; + } + finally{ + Monitor::Exit(NetVS->LOCAL); + } + + return eax; +} + +UINT16 MainForm::RemoteInput() +{ + if(NetVS->SEQUENCE != VS_DATA) return 0; + + UINT16 eax; + + eax = NetVS->REMOTE[NetVS->R_READ]; + + // ƒpƒP—ˆ‚Ä‚È‚¢ + if(eax == 0xFFFF){ + Monitor::Enter(NetVS->REMOTE); + try{ + // ¡—ˆ‚Ä‚é‚©‚à + NetVS->WAITING = 2; + Monitor::Wait(NetVS->REMOTE, NetVS->DELAY*10); + eax = NetVS->REMOTE[NetVS->R_READ]; + } + finally{ + Monitor::Exit(NetVS->REMOTE); + } + } + + // ƒƒX‚Á‚½H + if(eax == 0xFFFF){ + NetVS->WAITING = 1; + + array^ send = gcnew array(5){ PH_REQ_VS_DATA }; + Array::Copy(BitConverter::GetBytes(NetVS->R_FRAME), 0, send, 1, 4); + + UINT i = 0; + + while(NetVS->SEQUENCE == VS_DATA){ + UDP->BeginSend(send, send->Length, NetVS->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + + Monitor::Enter(NetVS->REMOTE); + try{ + NetVS->WAITING = 2; + Monitor::Wait(NetVS->REMOTE, NetVS->DELAY*10); + } + finally{ + Monitor::Exit(NetVS->REMOTE); + } + + if(NetVS->WAITING == 2){ + NetVS->WAITING = 1; + if(++i > 100){ + NetVS->SEQUENCE = VS_TIMEOUT; + } + continue; + } + + eax = NetVS->REMOTE[NetVS->R_READ]; + + if(eax != 0xFFFF){ + break; + } + else{ + i = 0; + // ‚±‚±‚ª‚©‚Ì—L–¼‚ȃ‰ƒO‚̶ŽY’n‚Å‚· + // Delay*10 / 2 ƒfƒBƒŒƒC‚Ì”¼ƒtƒŒ[ƒ€•ª‚Í‘Ò‹@‚µ‚Ä‚à‚悳‚»‚¤H + Thread::Sleep(NetVS->DELAY*5); + } + } + + if(eax == 0xFFFF && NetVS->SEQUENCE == VS_TIMEOUT){ + WriteMessage("ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½‚½‚ß‘Îí‚ðI—¹‚µ‚Ü‚·B\n", ErrorMessageColor); + if(MTINFO.DEBUG){ + WriteMessage(String::Format("Frame > L:{0} / R:{1} (delay:{2})\n", NetVS->L_FRAME, NetVS->R_FRAME, NetVS->DELAY), DebugMessageColor); + } + + QuitGame(); + return 0; + } + + NetVS->WAITING = 0; + } + + if(NetVS->SEQUENCE != VS_DATA) return 0; + + if((eax & 0x0003) == 0x0003){ + WriteMessage("•s³ƒpƒPƒbƒg‚ÌŽóM > ¶‰E“¯Žž‰Ÿ‚µ\n", ErrorMessageColor); + if(MTINFO.DEBUG){ + WriteMessage(String::Format("IP = {0}\n", NetVS->IP_EP->Address), DebugMessageColor); + } + + QuitGame(); + return 0xFFFF; + } + + Monitor::Enter(NetVS->REMOTE); + try{ + NetVS->REMOTE[NetVS->R_READ] = 0xFFFF; + + NetVS->R_FRAME++; + NetVS->R_READ++; + NetVS->R_READ %= NetVS->REMOTE->Length; + } + finally{ + Monitor::Exit(NetVS->REMOTE); + } + + return eax; +} + +UINT16 MainForm::ReadReplayData(BinaryReader^ br, REPLAY_INFO& ri) +{ + if(br == nullptr){ + return 0; + } + + UINT16 eax; + + try{ + if(ri.VERSION == _T('1') || ri.VERSION == _T('3')){ + eax = br->ReadUInt16(); + } + else{ + // ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚ÌRLEƒfƒR[ƒh + if(ri.COUNT[ri.CONTROL] == 0){ + REPLAY_DATA rd; + bool ctrl; + + if(ri.DEQUE[ri.CONTROL].size() > 0){ + // ƒLƒ…[‚Ƀf[ƒ^‚ ‚è + rd = ri.DEQUE[ri.CONTROL].front(); + ri.DEQUE[ri.CONTROL].pop_front(); + } + else{ + rd.KEY = br->ReadUInt16(); + rd.COUNT = br->ReadByte(); + ctrl = (rd.KEY & 0x0800) > 0 ? true : false; + + while(ctrl != ri.CONTROL){ + // ƒLƒ…[‚É‘Þ”ð + ri.DEQUE[ctrl].push_back(rd); + + // Ä“Ç‚Ýž‚Ý + rd.KEY = br->ReadUInt16(); + rd.COUNT = br->ReadByte(); + ctrl = (rd.KEY & 0x0800) > 0 ? true : false; + } + } + + ri.KEY[ri.CONTROL] = rd.KEY & 0x07FF; + ri.COUNT[ri.CONTROL] = rd.COUNT; + } + else{ + ri.COUNT[ri.CONTROL]--; + } + + eax = ri.KEY[ri.CONTROL]; + + ri.CONTROL ^= 1; + } + } + catch(EndOfStreamException^){ + WriteMessage("ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚ÌĶ‚ªI—¹‚µ‚Ü‚µ‚½B\n", SystemMessageColor); + + br->Close(); + br = nullptr; + + QuitGame(); + return 0; + } + catch(ObjectDisposedException^){ + br = nullptr; + + return 0; + } + + return eax; +} + +void MainForm::RecordInput(UINT16 eax, BinaryWriter^ bw, REPLAY_INFO& ri, bool watch) +{ + // ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚Ì‹L˜^ + if(bw != nullptr){ + if(ri.VERSION == _T('3')){ + bw->Write(eax); + } + else{ + // RLE + if(ri.KEY[ri.CONTROL] == 0xFFFF){ + // ‰‰ñ + ri.KEY[ri.CONTROL] = eax; + } + else{ + if(eax == ri.KEY[ri.CONTROL]){ + // ˆêŽü‚µ‚Ä‚«‚½ + if(ri.COUNT[ri.CONTROL] == 0xFF){ + bw->Write((UINT16)(ri.KEY[ri.CONTROL] | ri.CONTROL << 11)); + bw->Write(ri.COUNT[ri.CONTROL]); + + ri.COUNT[ri.CONTROL] = 0; + } + else{ + ri.COUNT[ri.CONTROL]++; + } + } + else{ + bw->Write((UINT16)(ri.KEY[ri.CONTROL] | ri.CONTROL << 11)); + bw->Write(ri.COUNT[ri.CONTROL]); + + ri.KEY[ri.CONTROL] = eax; + ri.COUNT[ri.CONTROL] = 0; + } + } + + ri.CONTROL ^= 1; + } + } + + // ŠÏíOK + if(watch && UDP != nullptr){ + Monitor::Enter(InputHistory); + try{ + InputHistory[InputFrame % InputHistory->Length] = eax; + InputFrame++; + } + finally{ + Monitor::Exit(InputHistory); + } + } +} +void MainForm::RunAutoRest() { + // Ž©“®‹xŒe + LASTINPUTINFO li; + li.cbSize = sizeof(LASTINPUTINFO); + DWORD te; + int to = MTOPTION.AUTO_REST_TIME; // ƒ^ƒCƒ€ƒAƒEƒgŽw’莞ŠÔ + AutoRestRanging = true; + if(MTINFO.DEBUG){ + WriteMessage(String::Format("Ž©“®‹xŒeƒXƒŒƒbƒhŠJŽn {0}•ª\n", to), DebugMessageColor); + } + while(AutoRestRanging){ + AutoRestSleeping = true; + try{ + Thread::Sleep(1000*1); + } + catch(ThreadInterruptedException^){ + } + finally{ + AutoRestSleeping = false; + } + if(!AutoRestRanging) return; + GetLastInputInfo(&li); + te = GetTickCount(); + to = MTOPTION.AUTO_REST_TIME; + //WriteMessage(String::Format("{0}•bŒo‰ß\n", ((te-li.dwTime)/1000) ), DebugMessageColor); + if(((te-li.dwTime)/1000) >= UINT(to*60)){ + // ƒtƒŠ[ó‘Ô‚È‚ç‹xŒeó‘Ô‚É‚·‚é + if(UDP != nullptr && MemberList[0]->STATE == MS_FREE){ + ChangeState((BYTE)MS_REST); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒ“\n", SystemMessageColor); + } + AutoRestRanging = false; + AutoRestThread = nullptr; + } + } +} +void MainForm::ChangeSeek() { + if(MTOPTION.CONNECTION_TYPE == CT_FREE) return; + + if(MemberList[0]->STATE == MS_FREE){ + ChangeState((BYTE)MS_SEEK); + WriteMessage("‘Îí•åWó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒ“\n", SystemMessageColor); + WriteTime(0, SystemMessageColor); + WriteMessage(String::Format("{0}‚ª‘Îí•åWó‘Ô‚É‚È‚è‚Ü‚µ‚½B\n", MemberList[0]->NAME), SystemMessageColor); + } + else if(MemberList[0]->STATE == MS_SEEK){ + if(GameThread != nullptr && GameThread->IsAlive){ + ChangeState((BYTE)MS_VS); + }else{ + ChangeState((BYTE)MS_FREE); + } + + WriteMessage("‘Îí•åWó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒt\n", SystemMessageColor); + WriteTime(0, SystemMessageColor); + WriteMessage(String::Format("{0}‚ª‘Îí•åW‚ð’÷‚ßØ‚è‚Ü‚µ‚½B\n", MemberList[0]->NAME), SystemMessageColor); + } +} +void MainForm::ChangeLogWordWrap() { + MTOPTION.LOG_WORDWRAP ^= 1; + richTextBoxLog->WordWrap = MTOPTION.LOG_WORDWRAP; + toolStripMenuItemWordWrap->Checked = MTOPTION.LOG_WORDWRAP; + if(MTOPTION.LOG_WORDWRAP){ + WriteMessage("ƒeƒLƒXƒgÜ‚è•Ô‚µ > ƒIƒ“\n", SystemMessageColor); + }else{ + WriteMessage("ƒeƒLƒXƒgÜ‚è•Ô‚µ > ƒIƒt\n", SystemMessageColor); + } +} +void MainForm::ClearLog(){ + if(MessageBox::Show("ƒƒO‚ð10sŽc‚µ‚Ä휂µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "ƒƒO‚Ìíœ", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + Monitor::Enter(richTextBoxLog); + try{ + int len = richTextBoxLog->Lines->Length; // ‘S‘Ìs” + if(len > 10){ + int index = richTextBoxLog->GetFirstCharIndexFromLine(len-11); + richTextBoxLog->SelectionStart=0; + richTextBoxLog->Select(0, index); + richTextBoxLog->SelectedText="[휂³‚ê‚Ü‚µ‚½]\n"; + } + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "SaveLog"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } +} \ No newline at end of file diff --git a/LilithPort/MainForm.h b/LilithPort/MainForm.h new file mode 100644 index 0000000..c97472e --- /dev/null +++ b/LilithPort/MainForm.h @@ -0,0 +1,3256 @@ +#pragma once + +#include "stdafx.h" +#include "StartupForm.h" +#include "OptionForm.h" + +namespace LilithPort { + + 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 System::IO; + using namespace System::Net::Sockets; + using namespace System::Threading; + using namespace System::Diagnostics; + + /// + /// MainForm ‚ÌŠT—v + /// + /// Œx: ‚±‚̃Nƒ‰ƒX‚Ì–¼‘O‚ð•ÏX‚·‚éê‡A‚±‚̃Nƒ‰ƒX‚ªˆË‘¶‚·‚é‚·‚×‚Ä‚Ì .resx ƒtƒ@ƒCƒ‹‚ÉŠÖ˜A•t‚¯‚ç‚ꂽ + /// ƒ}ƒl[ƒW ƒŠƒ\[ƒX ƒRƒ“ƒpƒCƒ‰ ƒc[ƒ‹‚ɑ΂µ‚Ä 'Resource File Name' ƒvƒƒpƒeƒB‚ð + /// •ÏX‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B‚±‚Ì•ÏX‚ðs‚í‚È‚¢‚ÆA + /// ƒfƒUƒCƒi‚ÆA‚±‚̃tƒH[ƒ€‚ÉŠÖ˜A•t‚¯‚ç‚ꂽƒ[ƒJƒ‰ƒCƒYς݃Šƒ\[ƒX‚Æ‚ªA + /// ³‚µ‚­‘ŠŒÝ‚É—˜—p‚Å‚«‚È‚­‚È‚è‚Ü‚·B + /// + public ref class MainForm : public System::Windows::Forms::Form + { + public: + MainForm(void) + { + InitializeComponent(); + // + //TODO: ‚±‚±‚ɃRƒ“ƒXƒgƒ‰ƒNƒ^ ƒR[ƒh‚ð’ljÁ‚µ‚Ü‚· + // + + // ƒuƒbƒNƒ}[ƒN‚ðƒƒjƒ…[‚É“o˜^ + String^ tmpName; + if(MTOPTION.BOOKMARK_COUNT > 0) { + for(UINT i=0;i < MTOPTION.BOOKMARK_COUNT;i++) { + tmpName = gcnew String(MTOPTION.BOOKMARK_SERVER_NAME[i]); + + toolStripMenuItemBookMark = (gcnew System::Windows::Forms::ToolStripMenuItem()); + toolStripMenuItemBookMarkMenu->DropDownItems->Add(toolStripMenuItemBookMark); + toolStripMenuItemBookMark->Text = tmpName; + toolStripMenuItemBookMark->Name = L"toolStripMenuItemBookMark" + i; + toolStripMenuItemBookMark->Tag = i; + toolStripMenuItemBookMark->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemBookMark_Click); + + toolStripMenuItemDelBookMark = (gcnew System::Windows::Forms::ToolStripMenuItem()); + toolStripMenuItemBookMark->DropDownItems->Add(toolStripMenuItemDelBookMark); + toolStripMenuItemDelBookMark->Text = L"íœ(&D)"; + toolStripMenuItemDelBookMark->Tag = L"toolStripMenuItemBookMark" + i; + toolStripMenuItemDelBookMark->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelBookMark_Click); + } + } + + // ƒvƒƒtƒ@ƒCƒ‹‚ðƒRƒ“ƒ{ƒ{ƒbƒNƒX‚É“o˜^ + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(Profile::ProfileList[i] == gcnew String(MTOPTION.PROFILE)){ + toolStripDropDownButtonProfile->Text = Profile::ProfileList[i]; + } + toolStripDropDownButtonProfile->DropDownItems->Add(Profile::ProfileList[i]); + toolStripDropDownButtonProfile->DropDownItems[i]->Click += gcnew System::EventHandler(this, &MainForm::toolStripDropDownItemProfile_Click); + } + } + + protected: + /// + /// Žg—p’†‚̃Šƒ\[ƒX‚ð‚·‚×‚ÄƒNƒŠ[ƒ“ƒAƒbƒv‚µ‚Ü‚·B + /// + ~MainForm() + { + if (components) + { + delete components; + } + } + private: System::Windows::Forms::MenuStrip^ menuStrip1; + private: System::Windows::Forms::SplitContainer^ splitContainer1; + private: System::Windows::Forms::ListBox^ listBoxMember; + private: System::Windows::Forms::RichTextBox^ richTextBoxLog; + private: System::Windows::Forms::TextBox^ textBoxInput; + + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemFile; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemSaveLog; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemExit; + + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemOption; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemSetting; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator2; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelayAuto; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator4; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay2; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay3; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay4; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay5; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay6; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay7; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay8; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay9; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator3; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemRecordReplay; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAllowSpectator; + + + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemHelp; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemViewCommand; + + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator5; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemVersion; + + private: System::Windows::Forms::ContextMenuStrip^ contextMenuStripMember; + private: System::Windows::Forms::ContextMenuStrip^ contextMenuStripLog; + private: System::Windows::Forms::ToolStripMenuItem^ contextMenuItemCopy; + + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator6; + private: System::Windows::Forms::ToolStripMenuItem^ contxtMenuItemSaveLog; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemVS; + private: System::Windows::Forms::OpenFileDialog^ openFileDialog1; + private: System::Windows::Forms::ToolTip^ toolTipMember; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemPing; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemReplay; + + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemWatch; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator7; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAfterRest; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemChangeList; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay10; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay11; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelay12; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemBookMarkMenu; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAddBookMark; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemBookMark; + private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemDelBookMark; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator8; + + private: System::Windows::Forms::ToolStripMenuItem^ CommandToolStripMenuItem; + private: System::Windows::Forms::ToolStripMenuItem^ GameStartToolStripMenuItem; + private: System::Windows::Forms::ToolStripMenuItem^ RestartToolStripMenuItem; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator9; + private: System::Windows::Forms::ToolStripMenuItem^ LeaveToolStripMenuItem; + private: System::Windows::Forms::ToolStripMenuItem^ RestToolStripMenuItem; + private: System::Windows::Forms::ToolStripMenuItem^ SeekToolStripMenuItem; + private: System::Windows::Forms::ToolStripMenuItem^ ClearToolStripMenuItem; + private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator10; + +private: System::Windows::Forms::ToolStripMenuItem^ ToggleHitJudgeToolStripMenuItem; +private: System::Windows::Forms::ToolStripMenuItem^ LogLockToolStripMenuItem; + +private: System::Windows::Forms::ToolStripMenuItem^ GetIPToolStripMenuItem; +private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator11; +private: System::Windows::Forms::ToolStripMenuItem^ GameStartNoReplayToolStripMenuItem; +private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator12; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemKick; +private: System::Windows::Forms::StatusStrip^ statusStrip1; +private: System::Windows::Forms::ToolStripStatusLabel^ toolStripStatusLabel; + +private: System::Windows::Forms::ToolStripDropDownButton^ toolStripDropDownButtonProfile; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemSeek; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRest; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestEnable; +private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator13; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime5; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime10; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime15; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime20; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime30; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime60; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemAutoRestTime120; +private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItemWordWrap; + + + + + + + + private: + /// + /// •K—v‚ȃfƒUƒCƒi•Ï”‚Å‚·B + /// + System::ComponentModel::IContainer^ components; + +#pragma region Windows Form Designer generated code + /// + /// ƒfƒUƒCƒi ƒTƒ|[ƒg‚É•K—v‚ȃƒ\ƒbƒh‚Å‚·B‚±‚̃ƒ\ƒbƒh‚Ì“à—e‚ð + /// ƒR[ƒh ƒGƒfƒBƒ^‚Å•ÏX‚µ‚È‚¢‚Å‚­‚¾‚³‚¢B + /// + void InitializeComponent(void) + { + this->components = (gcnew System::ComponentModel::Container()); + System::Windows::Forms::ToolStripMenuItem^ ReloadListToolStripMenuItem; + System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(MainForm::typeid)); + this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip()); + this->toolStripMenuItemFile = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemReplay = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemSaveLog = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemExit = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemBookMarkMenu = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAddBookMark = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator8 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->CommandToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->GameStartToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->GameStartNoReplayToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator9 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->RestartToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->LeaveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->RestToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->SeekToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator10 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->ClearToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->ToggleHitJudgeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator11 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->GetIPToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemOption = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemSetting = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemDelay = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelayAuto = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemDelay2 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay3 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay4 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay5 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay6 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay7 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay8 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay9 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay10 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay11 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemDelay12 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemRecordReplay = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAllowSpectator = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemWordWrap = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->LogLockToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemAfterRest = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRest = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestEnable = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator13 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemAutoRestTime5 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestTime10 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestTime15 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestTime20 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestTime30 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestTime60 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemAutoRestTime120 = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemHelp = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemViewCommand = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemChangeList = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemVersion = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer()); + this->listBoxMember = (gcnew System::Windows::Forms::ListBox()); + this->contextMenuStripMember = (gcnew System::Windows::Forms::ContextMenuStrip(this->components)); + this->toolStripMenuItemVS = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemWatch = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemSeek = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripMenuItemPing = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator12 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripMenuItemKick = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->richTextBoxLog = (gcnew System::Windows::Forms::RichTextBox()); + this->contextMenuStripLog = (gcnew System::Windows::Forms::ContextMenuStrip(this->components)); + this->contextMenuItemCopy = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->contxtMenuItemSaveLog = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->textBoxInput = (gcnew System::Windows::Forms::TextBox()); + this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog()); + this->toolTipMember = (gcnew System::Windows::Forms::ToolTip(this->components)); + this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip()); + this->toolStripDropDownButtonProfile = (gcnew System::Windows::Forms::ToolStripDropDownButton()); + this->toolStripStatusLabel = (gcnew System::Windows::Forms::ToolStripStatusLabel()); + ReloadListToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->menuStrip1->SuspendLayout(); + this->splitContainer1->Panel1->SuspendLayout(); + this->splitContainer1->Panel2->SuspendLayout(); + this->splitContainer1->SuspendLayout(); + this->contextMenuStripMember->SuspendLayout(); + this->contextMenuStripLog->SuspendLayout(); + this->statusStrip1->SuspendLayout(); + this->SuspendLayout(); + // + // ReloadListToolStripMenuItem + // + ReloadListToolStripMenuItem->Name = L"ReloadListToolStripMenuItem"; + ReloadListToolStripMenuItem->ShortcutKeys = System::Windows::Forms::Keys::F5; + ReloadListToolStripMenuItem->Size = System::Drawing::Size(310, 22); + ReloadListToolStripMenuItem->Text = L"ƒƒ“ƒo[ƒŠƒXƒg‚ÌXV(&R)"; + ReloadListToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::ReloadListToolStripMenuItem_Click); + // + // menuStrip1 + // + this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(5) {this->toolStripMenuItemFile, + this->toolStripMenuItemBookMarkMenu, this->CommandToolStripMenuItem, this->toolStripMenuItemOption, this->toolStripMenuItemHelp}); + this->menuStrip1->Location = System::Drawing::Point(0, 0); + this->menuStrip1->Name = L"menuStrip1"; + this->menuStrip1->Size = System::Drawing::Size(528, 26); + this->menuStrip1->TabIndex = 0; + this->menuStrip1->Text = L"menuStrip1"; + // + // toolStripMenuItemFile + // + this->toolStripMenuItemFile->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(4) {this->toolStripMenuItemReplay, + this->toolStripMenuItemSaveLog, this->toolStripSeparator1, this->toolStripMenuItemExit}); + this->toolStripMenuItemFile->Name = L"toolStripMenuItemFile"; + this->toolStripMenuItemFile->Size = System::Drawing::Size(85, 22); + this->toolStripMenuItemFile->Text = L"ƒtƒ@ƒCƒ‹(&F)"; + // + // toolStripMenuItemReplay + // + this->toolStripMenuItemReplay->Name = L"toolStripMenuItemReplay"; + this->toolStripMenuItemReplay->Size = System::Drawing::Size(226, 22); + this->toolStripMenuItemReplay->Text = L"ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚ÌĶ(&R)"; + this->toolStripMenuItemReplay->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemReplay_Click); + // + // toolStripMenuItemSaveLog + // + this->toolStripMenuItemSaveLog->Name = L"toolStripMenuItemSaveLog"; + this->toolStripMenuItemSaveLog->ShortcutKeys = static_cast((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::S)); + this->toolStripMenuItemSaveLog->Size = System::Drawing::Size(226, 22); + this->toolStripMenuItemSaveLog->Text = L"ƒƒO‚Ì•Û‘¶(&S)"; + this->toolStripMenuItemSaveLog->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemSaveLog_Click); + // + // toolStripSeparator1 + // + this->toolStripSeparator1->Name = L"toolStripSeparator1"; + this->toolStripSeparator1->Size = System::Drawing::Size(223, 6); + // + // toolStripMenuItemExit + // + this->toolStripMenuItemExit->Name = L"toolStripMenuItemExit"; + this->toolStripMenuItemExit->Size = System::Drawing::Size(226, 22); + this->toolStripMenuItemExit->Text = L"I—¹(&X)"; + this->toolStripMenuItemExit->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemExit_Click); + // + // toolStripMenuItemBookMarkMenu + // + this->toolStripMenuItemBookMarkMenu->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->toolStripMenuItemAddBookMark, + this->toolStripSeparator8}); + this->toolStripMenuItemBookMarkMenu->Name = L"toolStripMenuItemBookMarkMenu"; + this->toolStripMenuItemBookMarkMenu->Size = System::Drawing::Size(110, 22); + this->toolStripMenuItemBookMarkMenu->Text = L"ƒuƒbƒNƒ}[ƒN(&B)"; + // + // toolStripMenuItemAddBookMark + // + this->toolStripMenuItemAddBookMark->Name = L"toolStripMenuItemAddBookMark"; + this->toolStripMenuItemAddBookMark->Size = System::Drawing::Size(166, 22); + this->toolStripMenuItemAddBookMark->Text = L"ƒT[ƒo‚̒ljÁ(&A)"; + this->toolStripMenuItemAddBookMark->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAddBookMark_Click); + // + // toolStripSeparator8 + // + this->toolStripSeparator8->Name = L"toolStripSeparator8"; + this->toolStripSeparator8->Size = System::Drawing::Size(163, 6); + // + // CommandToolStripMenuItem + // + this->CommandToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(13) {this->GameStartToolStripMenuItem, + this->GameStartNoReplayToolStripMenuItem, this->toolStripSeparator9, this->RestartToolStripMenuItem, this->LeaveToolStripMenuItem, + this->RestToolStripMenuItem, this->SeekToolStripMenuItem, ReloadListToolStripMenuItem, this->toolStripSeparator10, this->ClearToolStripMenuItem, + this->ToggleHitJudgeToolStripMenuItem, this->toolStripSeparator11, this->GetIPToolStripMenuItem}); + this->CommandToolStripMenuItem->Name = L"CommandToolStripMenuItem"; + this->CommandToolStripMenuItem->Size = System::Drawing::Size(86, 22); + this->CommandToolStripMenuItem->Text = L"ƒRƒ}ƒ“ƒh(&C)"; + // + // GameStartToolStripMenuItem + // + this->GameStartToolStripMenuItem->BackColor = System::Drawing::SystemColors::Control; + this->GameStartToolStripMenuItem->Name = L"GameStartToolStripMenuItem"; + this->GameStartToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->GameStartToolStripMenuItem->Text = L"ƒQ[ƒ€‚Ì‹N“®(&G)"; + this->GameStartToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::GameStartToolStripMenuItem_Click); + // + // GameStartNoReplayToolStripMenuItem + // + this->GameStartNoReplayToolStripMenuItem->Name = L"GameStartNoReplayToolStripMenuItem"; + this->GameStartNoReplayToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->GameStartNoReplayToolStripMenuItem->Text = L"ƒQ[ƒ€‚Ì‹N“®iƒŠƒvƒŒƒC‚ð•Û‘¶‚µ‚È‚¢j(&T)"; + this->GameStartNoReplayToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::GameStartNoReplayToolStripMenuItem_Click); + // + // toolStripSeparator9 + // + this->toolStripSeparator9->Name = L"toolStripSeparator9"; + this->toolStripSeparator9->Size = System::Drawing::Size(307, 6); + // + // RestartToolStripMenuItem + // + this->RestartToolStripMenuItem->Name = L"RestartToolStripMenuItem"; + this->RestartToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->RestartToolStripMenuItem->Text = L"Ä‹N“®(&R)"; + this->RestartToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::RestartToolStripMenuItem_Click); + // + // LeaveToolStripMenuItem + // + this->LeaveToolStripMenuItem->Name = L"LeaveToolStripMenuItem"; + this->LeaveToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->LeaveToolStripMenuItem->Text = L"‘ÞŽº(&L)"; + this->LeaveToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::LeaveToolStripMenuItem_Click); + // + // RestToolStripMenuItem + // + this->RestToolStripMenuItem->Name = L"RestToolStripMenuItem"; + this->RestToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->RestToolStripMenuItem->Text = L"‹xŒeó‘Ô‚ÌØ‚è‘Ö‚¦(&M)"; + this->RestToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::RestToolStripMenuItem_Click); + // + // SeekToolStripMenuItem + // + this->SeekToolStripMenuItem->Name = L"SeekToolStripMenuItem"; + this->SeekToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->SeekToolStripMenuItem->Text = L"‘Îí•åWó‘Ô‚ÌØ‚è‘Ö‚¦(&S)"; + this->SeekToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::SeekToolStripMenuItem_Click); + // + // toolStripSeparator10 + // + this->toolStripSeparator10->Name = L"toolStripSeparator10"; + this->toolStripSeparator10->Size = System::Drawing::Size(307, 6); + // + // ClearToolStripMenuItem + // + this->ClearToolStripMenuItem->Name = L"ClearToolStripMenuItem"; + this->ClearToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->ClearToolStripMenuItem->Text = L"ƒƒO‚Ìíœ(&C)"; + this->ClearToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::ClearToolStripMenuItem_Click); + // + // ToggleHitJudgeToolStripMenuItem + // + this->ToggleHitJudgeToolStripMenuItem->Name = L"ToggleHitJudgeToolStripMenuItem"; + this->ToggleHitJudgeToolStripMenuItem->ShortcutKeys = System::Windows::Forms::Keys::F1; + this->ToggleHitJudgeToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->ToggleHitJudgeToolStripMenuItem->Text = L"“–‚½‚è”»’è‚Ì•\Ž¦Ø‘Ö(&H)"; + this->ToggleHitJudgeToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::ToggleHitJudgeToolStripMenuItem_Click); + // + // toolStripSeparator11 + // + this->toolStripSeparator11->Name = L"toolStripSeparator11"; + this->toolStripSeparator11->Size = System::Drawing::Size(307, 6); + // + // GetIPToolStripMenuItem + // + this->GetIPToolStripMenuItem->Name = L"GetIPToolStripMenuItem"; + this->GetIPToolStripMenuItem->Size = System::Drawing::Size(310, 22); + this->GetIPToolStripMenuItem->Text = L"IPƒAƒhƒŒƒX‚̎擾(&I)"; + this->GetIPToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::GetIPToolStripMenuItem_Click); + // + // toolStripMenuItemOption + // + this->toolStripMenuItemOption->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(11) {this->toolStripMenuItemSetting, + this->toolStripSeparator2, this->toolStripMenuItemDelay, this->toolStripSeparator3, this->toolStripMenuItemRecordReplay, this->toolStripMenuItemAllowSpectator, + this->toolStripMenuItemWordWrap, this->LogLockToolStripMenuItem, this->toolStripSeparator7, this->toolStripMenuItemAfterRest, + this->toolStripMenuItemAutoRest}); + this->toolStripMenuItemOption->Name = L"toolStripMenuItemOption"; + this->toolStripMenuItemOption->Size = System::Drawing::Size(99, 22); + this->toolStripMenuItemOption->Text = L"ƒIƒvƒVƒ‡ƒ“(&O)"; + // + // toolStripMenuItemSetting + // + this->toolStripMenuItemSetting->Name = L"toolStripMenuItemSetting"; + this->toolStripMenuItemSetting->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemSetting->Text = L"Ý’è(&S)"; + this->toolStripMenuItemSetting->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemSetting_Click); + // + // toolStripSeparator2 + // + this->toolStripSeparator2->Name = L"toolStripSeparator2"; + this->toolStripSeparator2->Size = System::Drawing::Size(244, 6); + // + // toolStripMenuItemDelay + // + this->toolStripMenuItemDelay->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(13) {this->toolStripMenuItemDelayAuto, + this->toolStripSeparator4, this->toolStripMenuItemDelay2, this->toolStripMenuItemDelay3, this->toolStripMenuItemDelay4, this->toolStripMenuItemDelay5, + this->toolStripMenuItemDelay6, this->toolStripMenuItemDelay7, this->toolStripMenuItemDelay8, this->toolStripMenuItemDelay9, this->toolStripMenuItemDelay10, + this->toolStripMenuItemDelay11, this->toolStripMenuItemDelay12}); + this->toolStripMenuItemDelay->Name = L"toolStripMenuItemDelay"; + this->toolStripMenuItemDelay->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemDelay->Text = L"ƒfƒBƒŒƒC(&D)"; + // + // toolStripMenuItemDelayAuto + // + this->toolStripMenuItemDelayAuto->Checked = true; + this->toolStripMenuItemDelayAuto->CheckState = System::Windows::Forms::CheckState::Checked; + this->toolStripMenuItemDelayAuto->Name = L"toolStripMenuItemDelayAuto"; + this->toolStripMenuItemDelayAuto->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelayAuto->Text = L"Auto"; + this->toolStripMenuItemDelayAuto->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelayAuto_Click); + // + // toolStripSeparator4 + // + this->toolStripSeparator4->Name = L"toolStripSeparator4"; + this->toolStripSeparator4->Size = System::Drawing::Size(100, 6); + // + // toolStripMenuItemDelay2 + // + this->toolStripMenuItemDelay2->Name = L"toolStripMenuItemDelay2"; + this->toolStripMenuItemDelay2->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay2->Text = L"2"; + this->toolStripMenuItemDelay2->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay2_Click); + // + // toolStripMenuItemDelay3 + // + this->toolStripMenuItemDelay3->Name = L"toolStripMenuItemDelay3"; + this->toolStripMenuItemDelay3->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay3->Text = L"3"; + this->toolStripMenuItemDelay3->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay3_Click); + // + // toolStripMenuItemDelay4 + // + this->toolStripMenuItemDelay4->Name = L"toolStripMenuItemDelay4"; + this->toolStripMenuItemDelay4->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay4->Text = L"4"; + this->toolStripMenuItemDelay4->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay4_Click); + // + // toolStripMenuItemDelay5 + // + this->toolStripMenuItemDelay5->Name = L"toolStripMenuItemDelay5"; + this->toolStripMenuItemDelay5->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay5->Text = L"5"; + this->toolStripMenuItemDelay5->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay5_Click); + // + // toolStripMenuItemDelay6 + // + this->toolStripMenuItemDelay6->Name = L"toolStripMenuItemDelay6"; + this->toolStripMenuItemDelay6->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay6->Text = L"6"; + this->toolStripMenuItemDelay6->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay6_Click); + // + // toolStripMenuItemDelay7 + // + this->toolStripMenuItemDelay7->Name = L"toolStripMenuItemDelay7"; + this->toolStripMenuItemDelay7->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay7->Text = L"7"; + this->toolStripMenuItemDelay7->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay7_Click); + // + // toolStripMenuItemDelay8 + // + this->toolStripMenuItemDelay8->Name = L"toolStripMenuItemDelay8"; + this->toolStripMenuItemDelay8->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay8->Text = L"8"; + this->toolStripMenuItemDelay8->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay8_Click); + // + // toolStripMenuItemDelay9 + // + this->toolStripMenuItemDelay9->Name = L"toolStripMenuItemDelay9"; + this->toolStripMenuItemDelay9->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay9->Text = L"9"; + this->toolStripMenuItemDelay9->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay9_Click); + // + // toolStripMenuItemDelay10 + // + this->toolStripMenuItemDelay10->Name = L"toolStripMenuItemDelay10"; + this->toolStripMenuItemDelay10->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay10->Text = L"10"; + this->toolStripMenuItemDelay10->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay10_Click); + // + // toolStripMenuItemDelay11 + // + this->toolStripMenuItemDelay11->Name = L"toolStripMenuItemDelay11"; + this->toolStripMenuItemDelay11->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay11->Text = L"11"; + this->toolStripMenuItemDelay11->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay11_Click); + // + // toolStripMenuItemDelay12 + // + this->toolStripMenuItemDelay12->Name = L"toolStripMenuItemDelay12"; + this->toolStripMenuItemDelay12->Size = System::Drawing::Size(103, 22); + this->toolStripMenuItemDelay12->Text = L"12"; + this->toolStripMenuItemDelay12->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelay12_Click); + // + // toolStripSeparator3 + // + this->toolStripSeparator3->Name = L"toolStripSeparator3"; + this->toolStripSeparator3->Size = System::Drawing::Size(244, 6); + // + // toolStripMenuItemRecordReplay + // + this->toolStripMenuItemRecordReplay->Checked = true; + this->toolStripMenuItemRecordReplay->CheckState = System::Windows::Forms::CheckState::Checked; + this->toolStripMenuItemRecordReplay->Name = L"toolStripMenuItemRecordReplay"; + this->toolStripMenuItemRecordReplay->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemRecordReplay->Text = L"ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚Ì•Û‘¶(&R)"; + this->toolStripMenuItemRecordReplay->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemRecordReplay_Click); + // + // toolStripMenuItemAllowSpectator + // + this->toolStripMenuItemAllowSpectator->Checked = true; + this->toolStripMenuItemAllowSpectator->CheckState = System::Windows::Forms::CheckState::Checked; + this->toolStripMenuItemAllowSpectator->Name = L"toolStripMenuItemAllowSpectator"; + this->toolStripMenuItemAllowSpectator->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemAllowSpectator->Text = L"ŠÏí‚Ì‹–‰Â(&A)"; + this->toolStripMenuItemAllowSpectator->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAllowSpectator_Click); + // + // toolStripMenuItemWordWrap + // + this->toolStripMenuItemWordWrap->Name = L"toolStripMenuItemWordWrap"; + this->toolStripMenuItemWordWrap->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemWordWrap->Text = L"ƒƒO‚̃eƒLƒXƒg‚ðÜ‚è•Ô‚·(&W)"; + this->toolStripMenuItemWordWrap->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemWordWrap_Click); + // + // LogLockToolStripMenuItem + // + this->LogLockToolStripMenuItem->Checked = true; + this->LogLockToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Checked; + this->LogLockToolStripMenuItem->Name = L"LogLockToolStripMenuItem"; + this->LogLockToolStripMenuItem->ShortcutKeys = System::Windows::Forms::Keys::F3; + this->LogLockToolStripMenuItem->Size = System::Drawing::Size(247, 22); + this->LogLockToolStripMenuItem->Text = L"ƒƒO‚̃XƒNƒ[ƒ‹‚ðŒÅ’è(&L)"; + this->LogLockToolStripMenuItem->Click += gcnew System::EventHandler(this, &MainForm::LogLockToolStripMenuItem_Click); + // + // toolStripSeparator7 + // + this->toolStripSeparator7->Name = L"toolStripSeparator7"; + this->toolStripSeparator7->Size = System::Drawing::Size(244, 6); + // + // toolStripMenuItemAfterRest + // + this->toolStripMenuItemAfterRest->Name = L"toolStripMenuItemAfterRest"; + this->toolStripMenuItemAfterRest->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemAfterRest->Text = L"ƒlƒbƒg‘ÎíŒã‚Ɉꑧ“ü‚ê‚é(&N)"; + this->toolStripMenuItemAfterRest->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAfterRest_Click); + // + // toolStripMenuItemAutoRest + // + this->toolStripMenuItemAutoRest->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(9) {this->toolStripMenuItemAutoRestEnable, + this->toolStripSeparator13, this->toolStripMenuItemAutoRestTime5, this->toolStripMenuItemAutoRestTime10, this->toolStripMenuItemAutoRestTime15, + this->toolStripMenuItemAutoRestTime20, this->toolStripMenuItemAutoRestTime30, this->toolStripMenuItemAutoRestTime60, this->toolStripMenuItemAutoRestTime120}); + this->toolStripMenuItemAutoRest->Name = L"toolStripMenuItemAutoRest"; + this->toolStripMenuItemAutoRest->Size = System::Drawing::Size(247, 22); + this->toolStripMenuItemAutoRest->Text = L"Ž©“®‚Å‹xŒeó‘Ô‚É‚·‚é(&I)"; + // + // toolStripMenuItemAutoRestEnable + // + this->toolStripMenuItemAutoRestEnable->Name = L"toolStripMenuItemAutoRestEnable"; + this->toolStripMenuItemAutoRestEnable->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestEnable->Text = L"—LŒø"; + this->toolStripMenuItemAutoRestEnable->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestEnable_Click); + // + // toolStripSeparator13 + // + this->toolStripSeparator13->Name = L"toolStripSeparator13"; + this->toolStripSeparator13->Size = System::Drawing::Size(106, 6); + // + // toolStripMenuItemAutoRestTime5 + // + this->toolStripMenuItemAutoRestTime5->Name = L"toolStripMenuItemAutoRestTime5"; + this->toolStripMenuItemAutoRestTime5->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime5->Text = L"5•ª"; + this->toolStripMenuItemAutoRestTime5->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime5_Click); + // + // toolStripMenuItemAutoRestTime10 + // + this->toolStripMenuItemAutoRestTime10->Name = L"toolStripMenuItemAutoRestTime10"; + this->toolStripMenuItemAutoRestTime10->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime10->Text = L"10•ª"; + this->toolStripMenuItemAutoRestTime10->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime10_Click); + // + // toolStripMenuItemAutoRestTime15 + // + this->toolStripMenuItemAutoRestTime15->Name = L"toolStripMenuItemAutoRestTime15"; + this->toolStripMenuItemAutoRestTime15->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime15->Text = L"15•ª"; + this->toolStripMenuItemAutoRestTime15->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime15_Click); + // + // toolStripMenuItemAutoRestTime20 + // + this->toolStripMenuItemAutoRestTime20->Name = L"toolStripMenuItemAutoRestTime20"; + this->toolStripMenuItemAutoRestTime20->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime20->Text = L"20•ª"; + this->toolStripMenuItemAutoRestTime20->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime20_Click); + // + // toolStripMenuItemAutoRestTime30 + // + this->toolStripMenuItemAutoRestTime30->Name = L"toolStripMenuItemAutoRestTime30"; + this->toolStripMenuItemAutoRestTime30->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime30->Text = L"30•ª"; + this->toolStripMenuItemAutoRestTime30->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime30_Click); + // + // toolStripMenuItemAutoRestTime60 + // + this->toolStripMenuItemAutoRestTime60->Name = L"toolStripMenuItemAutoRestTime60"; + this->toolStripMenuItemAutoRestTime60->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime60->Text = L"60•ª"; + this->toolStripMenuItemAutoRestTime60->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime60_Click); + // + // toolStripMenuItemAutoRestTime120 + // + this->toolStripMenuItemAutoRestTime120->Name = L"toolStripMenuItemAutoRestTime120"; + this->toolStripMenuItemAutoRestTime120->Size = System::Drawing::Size(109, 22); + this->toolStripMenuItemAutoRestTime120->Text = L"120•ª"; + this->toolStripMenuItemAutoRestTime120->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemAutoRestTime120_Click); + // + // toolStripMenuItemHelp + // + this->toolStripMenuItemHelp->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(4) {this->toolStripMenuItemViewCommand, + this->toolStripMenuItemChangeList, this->toolStripSeparator5, this->toolStripMenuItemVersion}); + this->toolStripMenuItemHelp->Name = L"toolStripMenuItemHelp"; + this->toolStripMenuItemHelp->ShortcutKeyDisplayString = L"Ctrl+L"; + this->toolStripMenuItemHelp->Size = System::Drawing::Size(75, 22); + this->toolStripMenuItemHelp->Text = L"ƒwƒ‹ƒv(&H)"; + // + // toolStripMenuItemViewCommand + // + this->toolStripMenuItemViewCommand->Name = L"toolStripMenuItemViewCommand"; + this->toolStripMenuItemViewCommand->Size = System::Drawing::Size(211, 22); + this->toolStripMenuItemViewCommand->Text = L"ƒRƒ}ƒ“ƒh‚̈ꗗ(&C)"; + this->toolStripMenuItemViewCommand->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemViewCommand_Click); + // + // toolStripMenuItemChangeList + // + this->toolStripMenuItemChangeList->Name = L"toolStripMenuItemChangeList"; + this->toolStripMenuItemChangeList->ShortcutKeys = System::Windows::Forms::Keys::F2; + this->toolStripMenuItemChangeList->Size = System::Drawing::Size(211, 22); + this->toolStripMenuItemChangeList->Text = L"ƒŠƒXƒg‚ÌØ‚è‘Ö‚¦(&L)"; + this->toolStripMenuItemChangeList->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemChangeList_Click); + // + // toolStripSeparator5 + // + this->toolStripSeparator5->Name = L"toolStripSeparator5"; + this->toolStripSeparator5->Size = System::Drawing::Size(208, 6); + // + // toolStripMenuItemVersion + // + this->toolStripMenuItemVersion->Name = L"toolStripMenuItemVersion"; + this->toolStripMenuItemVersion->Size = System::Drawing::Size(211, 22); + this->toolStripMenuItemVersion->Text = L"ƒo[ƒWƒ‡ƒ“î•ñ(&A)"; + this->toolStripMenuItemVersion->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemVersion_Click); + // + // splitContainer1 + // + this->splitContainer1->Anchor = static_cast((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) + | System::Windows::Forms::AnchorStyles::Left) + | System::Windows::Forms::AnchorStyles::Right)); + this->splitContainer1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + this->splitContainer1->Location = System::Drawing::Point(0, 26); + this->splitContainer1->Name = L"splitContainer1"; + // + // splitContainer1.Panel1 + // + this->splitContainer1->Panel1->Controls->Add(this->listBoxMember); + // + // splitContainer1.Panel2 + // + this->splitContainer1->Panel2->Controls->Add(this->richTextBoxLog); + this->splitContainer1->Panel2->Controls->Add(this->textBoxInput); + this->splitContainer1->Size = System::Drawing::Size(528, 297); + this->splitContainer1->SplitterDistance = 90; + this->splitContainer1->TabIndex = 2; + this->splitContainer1->TabStop = false; + // + // listBoxMember + // + this->listBoxMember->BorderStyle = System::Windows::Forms::BorderStyle::None; + this->listBoxMember->ContextMenuStrip = this->contextMenuStripMember; + this->listBoxMember->Dock = System::Windows::Forms::DockStyle::Fill; + this->listBoxMember->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawFixed; + this->listBoxMember->FormattingEnabled = true; + this->listBoxMember->ItemHeight = 12; + this->listBoxMember->Location = System::Drawing::Point(0, 0); + this->listBoxMember->Name = L"listBoxMember"; + this->listBoxMember->Size = System::Drawing::Size(88, 288); + this->listBoxMember->TabIndex = 2; + this->listBoxMember->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseDoubleClick); + this->listBoxMember->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler(this, &MainForm::listBoxMember_DrawItem); + this->listBoxMember->MouseClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseClick); + // + // contextMenuStripMember + // + this->contextMenuStripMember->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(6) {this->toolStripMenuItemVS, + this->toolStripMenuItemWatch, this->toolStripMenuItemSeek, this->toolStripMenuItemPing, this->toolStripSeparator12, this->toolStripMenuItemKick}); + this->contextMenuStripMember->Name = L"contextMenuStrip1"; + this->contextMenuStripMember->ShowImageMargin = false; + this->contextMenuStripMember->Size = System::Drawing::Size(124, 120); + this->contextMenuStripMember->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &MainForm::contextMenuStripMember_Opening); + // + // toolStripMenuItemVS + // + this->toolStripMenuItemVS->Name = L"toolStripMenuItemVS"; + this->toolStripMenuItemVS->Size = System::Drawing::Size(123, 22); + this->toolStripMenuItemVS->Text = L"‘Îí‚·‚é"; + this->toolStripMenuItemVS->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemVS_Click); + // + // toolStripMenuItemWatch + // + this->toolStripMenuItemWatch->Name = L"toolStripMenuItemWatch"; + this->toolStripMenuItemWatch->Size = System::Drawing::Size(123, 22); + this->toolStripMenuItemWatch->Text = L"ŠÏí‚·‚é"; + this->toolStripMenuItemWatch->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemWatch_Click); + // + // toolStripMenuItemSeek + // + this->toolStripMenuItemSeek->Name = L"toolStripMenuItemSeek"; + this->toolStripMenuItemSeek->Size = System::Drawing::Size(123, 22); + this->toolStripMenuItemSeek->Text = L"‘Îí•åW‚·‚é"; + this->toolStripMenuItemSeek->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemSeek_Click); + // + // toolStripMenuItemPing + // + this->toolStripMenuItemPing->Name = L"toolStripMenuItemPing"; + this->toolStripMenuItemPing->Size = System::Drawing::Size(123, 22); + this->toolStripMenuItemPing->Text = L"PING"; + this->toolStripMenuItemPing->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemPing_Click); + // + // toolStripSeparator12 + // + this->toolStripSeparator12->Name = L"toolStripSeparator12"; + this->toolStripSeparator12->Size = System::Drawing::Size(120, 6); + // + // toolStripMenuItemKick + // + this->toolStripMenuItemKick->Name = L"toolStripMenuItemKick"; + this->toolStripMenuItemKick->Size = System::Drawing::Size(123, 22); + this->toolStripMenuItemKick->Text = L"KICK"; + this->toolStripMenuItemKick->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemKick_Click); + // + // richTextBoxLog + // + this->richTextBoxLog->BackColor = System::Drawing::SystemColors::Window; + this->richTextBoxLog->BorderStyle = System::Windows::Forms::BorderStyle::None; + this->richTextBoxLog->ContextMenuStrip = this->contextMenuStripLog; + this->richTextBoxLog->Dock = System::Windows::Forms::DockStyle::Fill; + this->richTextBoxLog->Location = System::Drawing::Point(0, 0); + this->richTextBoxLog->Name = L"richTextBoxLog"; + this->richTextBoxLog->ReadOnly = true; + this->richTextBoxLog->Size = System::Drawing::Size(432, 276); + this->richTextBoxLog->TabIndex = 0; + this->richTextBoxLog->TabStop = false; + this->richTextBoxLog->Text = L""; + this->richTextBoxLog->WordWrap = false; + this->richTextBoxLog->LinkClicked += gcnew System::Windows::Forms::LinkClickedEventHandler(this, &MainForm::richTextBoxLog_LinkClicked); + // + // contextMenuStripLog + // + this->contextMenuStripLog->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->contextMenuItemCopy, + this->toolStripSeparator6, this->contxtMenuItemSaveLog}); + this->contextMenuStripLog->Name = L"contextMenuStrip2"; + this->contextMenuStripLog->ShowImageMargin = false; + this->contextMenuStripLog->Size = System::Drawing::Size(177, 54); + // + // contextMenuItemCopy + // + this->contextMenuItemCopy->Name = L"contextMenuItemCopy"; + this->contextMenuItemCopy->ShortcutKeys = static_cast((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::C)); + this->contextMenuItemCopy->Size = System::Drawing::Size(176, 22); + this->contextMenuItemCopy->Text = L"ƒRƒs[(&C)"; + this->contextMenuItemCopy->Click += gcnew System::EventHandler(this, &MainForm::contextMenuItemCopy_Click); + // + // toolStripSeparator6 + // + this->toolStripSeparator6->Name = L"toolStripSeparator6"; + this->toolStripSeparator6->Size = System::Drawing::Size(173, 6); + // + // contxtMenuItemSaveLog + // + this->contxtMenuItemSaveLog->Name = L"contxtMenuItemSaveLog"; + this->contxtMenuItemSaveLog->ShortcutKeys = static_cast((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::S)); + this->contxtMenuItemSaveLog->Size = System::Drawing::Size(176, 22); + this->contxtMenuItemSaveLog->Text = L"ƒƒO‚Ì•Û‘¶(&S)"; + this->contxtMenuItemSaveLog->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemSaveLog_Click); + // + // textBoxInput + // + this->textBoxInput->BackColor = System::Drawing::SystemColors::Window; + this->textBoxInput->Dock = System::Windows::Forms::DockStyle::Bottom; + this->textBoxInput->Location = System::Drawing::Point(0, 276); + this->textBoxInput->MaxLength = 127; + this->textBoxInput->Name = L"textBoxInput"; + this->textBoxInput->Size = System::Drawing::Size(432, 19); + this->textBoxInput->TabIndex = 0; + this->textBoxInput->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &MainForm::textBoxInput_KeyDown); + // + // openFileDialog1 + // + this->openFileDialog1->Filter = L"MT Replay file (*.mtr)|*.mtr"; + this->openFileDialog1->Title = L"LilithPort—p‚̃ŠƒvƒŒƒCƒtƒ@ƒCƒ‹"; + // + // statusStrip1 + // + this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->toolStripDropDownButtonProfile, + this->toolStripStatusLabel}); + this->statusStrip1->Location = System::Drawing::Point(0, 328); + this->statusStrip1->Name = L"statusStrip1"; + this->statusStrip1->RightToLeft = System::Windows::Forms::RightToLeft::No; + this->statusStrip1->Size = System::Drawing::Size(528, 22); + this->statusStrip1->TabIndex = 3; + this->statusStrip1->Text = L"statusStrip1"; + // + // toolStripDropDownButtonProfile + // + this->toolStripDropDownButtonProfile->Alignment = System::Windows::Forms::ToolStripItemAlignment::Right; + this->toolStripDropDownButtonProfile->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text; + this->toolStripDropDownButtonProfile->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None; + this->toolStripDropDownButtonProfile->Name = L"toolStripDropDownButtonProfile"; + this->toolStripDropDownButtonProfile->RightToLeft = System::Windows::Forms::RightToLeft::No; + this->toolStripDropDownButtonProfile->Size = System::Drawing::Size(13, 20); + // + // toolStripStatusLabel + // + this->toolStripStatusLabel->BorderSides = System::Windows::Forms::ToolStripStatusLabelBorderSides::Left; + this->toolStripStatusLabel->BorderStyle = System::Windows::Forms::Border3DStyle::Raised; + this->toolStripStatusLabel->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text; + this->toolStripStatusLabel->Margin = System::Windows::Forms::Padding(5, 3, 0, 2); + this->toolStripStatusLabel->Name = L"toolStripStatusLabel"; + this->toolStripStatusLabel->Padding = System::Windows::Forms::Padding(5, 0, 0, 0); + this->toolStripStatusLabel->Size = System::Drawing::Size(9, 17); + // + // MainForm + // + this->AllowDrop = true; + this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->ClientSize = System::Drawing::Size(528, 350); + this->Controls->Add(this->statusStrip1); + this->Controls->Add(this->splitContainer1); + this->Controls->Add(this->menuStrip1); + this->Icon = (cli::safe_cast(resources->GetObject(L"$this.Icon"))); + this->MainMenuStrip = this->menuStrip1; + this->Name = L"MainForm"; + this->Text = L"LilithPort"; + this->Load += gcnew System::EventHandler(this, &MainForm::MainForm_Load); + this->Shown += gcnew System::EventHandler(this, &MainForm::MainForm_Shown); + this->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &MainForm::MainForm_DragDrop); + this->FormClosed += gcnew System::Windows::Forms::FormClosedEventHandler(this, &MainForm::MainForm_FormClosed); + this->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &MainForm::MainForm_DragEnter); + this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &MainForm::MainForm_FormClosing); + this->menuStrip1->ResumeLayout(false); + this->menuStrip1->PerformLayout(); + this->splitContainer1->Panel1->ResumeLayout(false); + this->splitContainer1->Panel2->ResumeLayout(false); + this->splitContainer1->Panel2->PerformLayout(); + this->splitContainer1->ResumeLayout(false); + this->contextMenuStripMember->ResumeLayout(false); + this->contextMenuStripLog->ResumeLayout(false); + this->statusStrip1->ResumeLayout(false); + this->statusStrip1->PerformLayout(); + this->ResumeLayout(false); + this->PerformLayout(); + + } +#pragma endregion + private: + static OptionForm^ Option; + + static bool IsFormClosing; + static SERVER_MODE ServerMode; + static LIST_VIEW ListView; + static String^ ReplayFilePath; + + // ƒuƒbƒNƒ}[ƒN + Object^ tmpIP; + IntPtr BookMarkServerName; + IntPtr BookMarkConnectIP; + + // ƒ`ƒƒƒbƒg—š—ð + static int ChatHistoryNumber; + static Generic::List^ ChatHistory; + + // ŠeF + static array^ NameColor; + static array^ StateRectColor; + static Color TalkMessageColor; + static Color SystemMessageColor; + static Color ErrorMessageColor; + static Color DebugMessageColor; + static Color NoticeBackColor; + static Color CommentBackColor; + static Color SecretColor; + + delegate void WriteMessageDelegate(String^ msg, Color color); + + // MemberInfo‚³‚ñ‚Ístdafx.h‚É‚¨ˆø‰z‚µ‚µ‚Ü‚µ‚½ + static Generic::List^ MemberList; + static Generic::List^ MemberListBackUp; + static UINT16 IDCounter; // Max 3FFF(16383) + static DWORD Ping; + + static Thread^ GameThread; + static UdpClient^ UDP; + static String^ ServerName; + static String^ ConnectIP; + static bool AfterCloseUDP; // ‘Îí’†‚ÌŽI—Ž‚¿‚ÉŠª‚«ž‚Ü‚ê‚È‚¢‚悤‚É + + // IPŽæ“¾—p + static WebClient^ GetIPClient; + static Uri^ GetIPUri = gcnew Uri("http://checkip.dyndns.org/"); + static Thread^ TimerGetIPThread; + static bool GetIPCancelled; + static bool GetIPSleeping; + + // ƒ`[ƒ€HPŽ‚¿‰z‚µ—p + static Thread^ SetTeamHPThread; + static UINT P_HP; + static UINT Winner; + + // ‰ñü‚̶Ž€”»’è + static Thread^ SonarThread; + static bool Ranging; + static bool SonarSleeping; + + // ƒlƒbƒg‘ÎíŠÖ˜A + ref struct VersusInfo + { + UINT SEQUENCE; // ‚â‚èŽæ‚蓯Šú—p + bool SLEEPING; // ƒXƒŒƒbƒh‘Ò‹@—p + int WAITING; // ƒpƒPŽóM‘Ò‹@—p 1-:Wait ON 2:Sleep + DWORD START_UP; // ‹N“®ŽžŠÔ + IPEndPoint^ IP_EP; + array^ PING; + array^ PONG; + UINT DELAY; // ƒfƒBƒŒƒC‚Í‘å‚«‚¢•û‚ɇ‚킹‚é + UINT INTERVAL; // ‘—MŠÔŠu ¬:1f‚ ‚½‚è‚Ì“ü—̓f[ƒ^‘—M‰ñ”‚ð4‚É ’†:3‰ñ ‘å:2‰ñ + UINT INTERVAL2; // ‘—MŠÔŠuŒvŽZ—p + array^ SEND; // ‘—M—pƒoƒbƒtƒ@ + array^ LOCAL; // ƒŠƒ“ƒOƒoƒbƒtƒ@ + UINT32 L_FRAME; // ‘ƒtƒŒ[ƒ€” + int L_READ; // “Ç‚ÝŽæ‚èˆÊ’u + array^ REMOTE; // ‚±‚Ì‚Q‚‚̓L[‚Ì—š—ð‚ð•ÛŽ‚·‚é + UINT32 R_FRAME; // ‘ƒtƒŒ[ƒ€” + int R_READ; // “Ç‚ÝŽæ‚èˆÊ’u + }; + + static Thread^ VersusThread; + static VersusInfo^ NetVS; + + // ŠÏíŠÖ˜A + ref struct SpectatorInfo + { + UINT16 ID; + IPEndPoint^ IP_EP; + UINT32 FRAME; + }; + + static Thread^ SpectacleThread; + static Generic::List^ SpectatorList; + static bool AllowWatch; // ƒXƒŒƒbƒh§Œä + static UINT WaitingWatch; // ƒpƒPƒbƒg‘Ò‚¿ 1:ŠJŽn‘Ò‚¿ 2:ƒf[ƒ^‘Ò‚¿ + static IPEndPoint^ WatchTarget; // ŠÏí‘ÎÛ + static UINT16 TargetID; + static UINT16 P1ID, P2ID; // P2‚ª0xFFFF‚ňêlƒvƒŒƒC + static UINT32 WatchFrame; // “Ç‚ÝŽæ‚èˆÊ’u + static array^ WatchHistory; // ƒoƒbƒtƒ@ TIME_OUT/5 * 3 = 1800‚Ì900ƒtƒŒ[ƒ€•ª + static UINT32 InputFrame; // ‘‚«ž‚݈ʒu + static array^ InputHistory; // ƒoƒbƒtƒ@ + + // Ž©“®‹xŒe + static Thread^ AutoRestThread; + static bool AutoRestRanging; + static bool AutoRestSleeping; + + // MainForm.cpp‚É‹Lq + void Begin(); + void TimerGetIP(); + void SetTeamHP(); + void RunSonar(); + void RunGame(Object^ obj); + void RunVersus(); + void RunSpectacle(); + UINT16 LocalInput(UINT16 eax); + UINT16 RemoteInput(); + UINT16 ReadReplayData(BinaryReader^ br, REPLAY_INFO& ri); + void RecordInput(UINT16 eax, BinaryWriter^ bw, REPLAY_INFO& ri, bool as); + void RunAutoRest(); + void ChangeSeek(); + void ChangeLogWordWrap(); + void ClearLog(); + + void PacketSendAllMember(array^% datagram, UINT received_id); + static void SendPackets(IAsyncResult^ asyncResult); + static void ReceivePackets(IAsyncResult^ asyncResult); + + protected: + void StartGame(UINT type){ + // ŠiƒcƒN‚¶‚á‚È‚¢‚æ + try{ + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(gcnew String(MTOPTION.GAME_EXE)); + + if(info->FileDescription != "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd." && info->FileDescription != "‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T"){ + throw gcnew Exception; + } + else{ + if(info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd."){ + MTINFO.KGT2K = true; + } + else{ + MTINFO.KGT2K = false; + } + } + } + catch(Exception^){ + WriteMessage("Ši“¬ƒcƒN[ƒ‹‚ÌŽÀsƒtƒ@ƒCƒ‹‚Å‚Í‚ ‚è‚Ü‚¹‚ñB\n", ErrorMessageColor); + WriteMessage("ƒIƒvƒVƒ‡ƒ“‚ÅŽÀsƒtƒ@ƒCƒ‹‚̃pƒX‚ðݒ肵‚Ä‚­‚¾‚³‚¢B\n", ErrorMessageColor); + return; + } + + if(MemberList[0]->STATE == MS_SEEK){ + QuitGame(); + GameThread = nullptr; + //Thread::Sleep(1000); + } + + if(GameThread != nullptr && GameThread->IsAlive == false){ + GameThread = nullptr; + } + + if(VersusThread != nullptr && VersusThread->IsAlive == false){ + VersusThread = nullptr; + } + + if(NetVS != nullptr && MemberList[0]->STATE == MS_READY){ + if((timeGetTime() - NetVS->START_UP) > TIME_OUT*2 + 1000){ + MemberList[0]->STATE = MS_FREE; + delete NetVS; + NetVS = nullptr; + } + } + + if(GameThread == nullptr){ + ZeroMemory(MTINFO.P1_NAME, sizeof(MTINFO.P1_NAME)); + ZeroMemory(MTINFO.P2_NAME, sizeof(MTINFO.P2_NAME)); + + if(type == RT_FREE){ + MTINFO.SEED = XorShift(); + MTINFO.MAX_STAGE = MTOPTION.MAX_STAGE; + MTINFO.STAGE_SELECT = MTOPTION.STAGE_SELECT; + MTINFO.ROUND = MTOPTION.ROUND; + MTINFO.TIMER = MTOPTION.TIMER; + MTINFO.TEAM_ROUND_HP = MTOPTION.TEAM_ROUND_HP; + + P1ID = MemberList[0]->ID; + P2ID = 0xFFFF; + + _tcscpy_s(MTINFO.P1_NAME, MTOPTION.NAME); + MTINFO.CONTROL = 0; + } + else if(type == RT_VS){ + Monitor::Enter(MemberList); + try{ + MemberList[0]->STATE = MS_READY; + + NetVS = gcnew VersusInfo; + NetVS->SEQUENCE = VS_REQ; + NetVS->SLEEPING = false; + NetVS->WAITING = false; + NetVS->START_UP = timeGetTime(); + NetVS->IP_EP = MemberList[listBoxMember->SelectedIndex]->IP_EP; + NetVS->PING = gcnew array(5){ 0, 0, 0, 0, 0 }; + NetVS->PONG = gcnew array(5){ 0, 0, 0, 0, 0 }; + NetVS->SEND = gcnew array(32){ PH_VS_DATA }; + NetVS->L_FRAME = 0; + NetVS->L_READ = 0; + NetVS->R_FRAME = 0; + NetVS->L_READ = 0; + + // ŠÏí—pID + P1ID = MemberList[listBoxMember->SelectedIndex]->ID; + P2ID = MemberList[0]->ID; + + // –¼‘O + ZeroMemory(MTINFO.P1_NAME, sizeof(MTINFO.P1_NAME)); + ZeroMemory(MTINFO.P2_NAME, sizeof(MTINFO.P2_NAME)); + + if(ListView != LV_BLIND){ + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(MemberList[listBoxMember->SelectedIndex]->NAME); + _tcscpy_s(MTINFO.P1_NAME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + _tcscpy_s(MTINFO.P2_NAME, MTOPTION.NAME); + } + + // ‘Îí‰ñ” + MemberList[listBoxMember->SelectedIndex]->NUM_VS++; + + // ƒlƒbƒg‘Î퀔õ—pƒXƒŒƒbƒh‚Ì‹N“® + MTINFO.CONTROL = 1; + VersusThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunVersus)); + VersusThread->Start(); + } + finally{ + Monitor::Exit(MemberList); + } + return; + } + else if(type == RT_PLAYBACK){ + if(ReplayFilePath == String::Empty){ + openFileDialog1->InitialDirectory = gcnew String(MTOPTION.REPLAY_FOLDER); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + ReplayFilePath = openFileDialog1->FileName; + } + else{ + return; + } + } + + // ƒtƒH[ƒ}ƒbƒg‚ÌŠm”F + TCHAR ver; + array^ header = gcnew array{'T', 'Y', 'M', 'T', 'R'}; + BinaryReader^ br = gcnew BinaryReader(File::OpenRead(ReplayFilePath)); + + try{ + // ƒwƒbƒ_ + array^ h = br->ReadChars(header->Length); + for(int i = 0; i < h->Length; i++){ + if(h[i] != header[i]){ + WriteMessage("—LŒø‚ȃŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚Å‚Í‚ ‚è‚Ü‚¹‚ñB\n", ErrorMessageColor); + return; + } + } + + ver = br->ReadChar(); + + if(ver < _T('1') || ver > _T('4')){ + WriteMessage("—LŒø‚ȃŠƒvƒŒƒC‚̃o[ƒWƒ‡ƒ“‚Å‚Í‚ ‚è‚Ü‚¹‚ñB\n", ErrorMessageColor); + return; + } + } + finally{ + br->Close(); + } + } + + GameThread = gcnew Thread(gcnew ParameterizedThreadStart(this, &MainForm::RunGame)); + GameThread->Start(type); + } + else{ + if(_tcslen(MTINFO.ORIGINAL_TITLE) > 0){ + WriteMessage(String::Format("{0}‚ª‹N“®’†‚Å‚·B\n", gcnew String(MTINFO.ORIGINAL_TITLE)), SystemMessageColor); + } + else{ + WriteMessage("‘¼‚̃Q[ƒ€‚ª‹N“®’†‚Å‚·B\n", SystemMessageColor); + } + } + } + + void QuitGame(){ + if(GameThread != nullptr && GameThread->IsAlive){ + if(MTINFO.DEBUG){ + WriteMessage("ƒQ[ƒ€ƒvƒƒZƒX‚ð’âŽ~‚µ‚Ü‚·B\n", DebugMessageColor); + } + try{ + Process::GetProcessById(MTINFO.PROCESS_ID)->CloseMainWindow(); + } + catch(ArgumentException^){ + if(MTINFO.DEBUG){ + WriteMessage("—áŠO > ArgumentException\n", DebugMessageColor); + } + GameThread->Abort(); + GameThread = nullptr; + } + } + /* + if(GameThread == nullptr){ + try{ + String^ game = Path::GetFileNameWithoutExtension(gcnew String(MTOPTION.GAME_EXE)); + array^ ps = Process::GetProcessesByName(game); + if(ps->Length > 0){ + for(int i=0; i < ps->Length; i++){ + if(ps[0]->MainWindowTitle == game){ + WriteMessage(String::Format("{0}‚ðI—¹‚µ‚Ü‚·B\n", ps[0]->MainWindowTitle), SystemMessageColor); + ps[0]->CloseMainWindow(); + } + } + }else{ + WriteMessage(String::Format("I—¹‚·‚éƒQ[ƒ€\"{0}\"‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½B\nƒIƒvƒVƒ‡ƒ“‚ÌŽÀsƒtƒ@ƒCƒ‹‚̃pƒXA‚Ü‚½‚̓vƒƒtƒ@ƒCƒ‹‚ª‡‚Á‚Ä‚¢‚é‚©Šm”F‚µ‚Ä‚­‚¾‚³‚¢B\n", game), ErrorMessageColor); + return; + } + } + catch(Exception^ e){ + WriteMessage("ƒQ[ƒ€‚ðI—¹‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B\n", ErrorMessageColor); + if(MTINFO.DEBUG){ + WriteMessage(String::Format("{0}\n", e->ToString()), DebugMessageColor); + } + } + } + */ + } + + void QuitWatch(bool send_packet){ + if(WaitingWatch > 0 && GameThread != nullptr && GameThread->IsAlive){ + bool w = WaitingWatch == 2 ? true : false; + WaitingWatch = 0; + + if(w){ + Monitor::Enter(WatchHistory); + try{ + Monitor::Pulse(WatchHistory); + } + finally{ + Monitor::Exit(WatchHistory); + } + } + + QuitGame(); + } + + if(WatchTarget != nullptr && UDP != nullptr){ + if(send_packet){ + array^ quit = gcnew array(3){ PH_WATCH_END }; + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, quit, 1, 2); + UDP->BeginSend(quit, quit->Length, WatchTarget, gcnew AsyncCallback(SendPackets), UDP); + } + + delete WatchTarget; + WatchTarget = nullptr; + } + + int state = MemberList[0]->STATE; + + if(state == MS_WATCH) ChangeState((BYTE)MS_FREE); + if(state == MS_COUCH) ChangeState((BYTE)MS_REST); + + toolStripMenuItemWatch->Text = gcnew String("ŠÏí‚·‚é"); + } + + void Restart(){ + // ƒtƒŠ[ƒvƒŒƒC‚¾‚¯‚Ç‘Îí’† + if(AfterCloseUDP) return; + + CloseUdp(true); + + MemberList->Clear(); + listBoxMember->Items->Clear(); + + // IPŽæ“¾‚̃Lƒƒƒ“ƒZƒ‹ + if(GetIPClient != nullptr){ + GetIPClient->CancelAsync(); + } + if(TimerGetIPThread != nullptr && TimerGetIPThread->IsAlive){ + if(GetIPSleeping){ + TimerGetIPThread->Interrupt(); + } + TimerGetIPThread->Join(); + } + + this->Text = gcnew String("LilithPort"); + + StartupForm^ s = gcnew StartupForm; + s->ShowDialog(this); + + ListView = LV_NAME; + + Begin(); + } + + void Leave(bool send_packet){ + CloseUdp(send_packet); + + Monitor::Enter(MemberList); + try{ + listBoxMember->BeginUpdate(); + + while(MemberList->Count > 1){ + MemberList->RemoveAt(1); + listBoxMember->Items->RemoveAt(1); + } + + listBoxMember->EndUpdate(); + } + finally{ + Monitor::Exit(MemberList); + } + + MTOPTION.CONNECTION_TYPE = CT_FREE; + MemberList[0]->TYPE = CT_FREE; + MemberList[0]->STATE = MS_FREE; + this->Text = gcnew String("LilithPort [Free Play]"); + listBoxMember->Refresh(); + } + + void ChangeState(Object^ obj){ + if(MTOPTION.CONNECTION_TYPE == CT_FREE || UDP == nullptr) return; + + BYTE state = (BYTE)obj; + + array^ send = gcnew array(4){ PH_CHANGE_STATE, 0, 0, state }; + MemberList[0]->STATE = state; + listBoxMember->Refresh(); + if(MemberList[0]->STATE == MS_FREE){ + if(MTOPTION.AUTO_REST){ + AutoRestThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunAutoRest)); + AutoRestThread->Start(); + } + } + if(MemberList[0]->STATE == MS_REST){ + if(AutoRestThread != nullptr){ + AutoRestRanging = false; + AutoRestThread->Abort(); + AutoRestThread = nullptr; + } + } + + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + PacketSendAllMember(send, 0); + } + else{ + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, send, 1, 2); + UDP->BeginSend(send, send->Length, MemberList[1]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + + void CloseUdp(bool send_packet){ + if(UDP != nullptr){ + array^ quit; + + // ƒ\ƒi[’âŽ~ + if(SonarThread != nullptr && SonarThread->IsAlive && Ranging){ + Ranging = false; + + if(SonarSleeping){ + SonarThread->Interrupt(); + } + + SonarThread->Join(); + } + // Ž©“®‹xŒeƒXƒŒƒbƒh’âŽ~ + if(AutoRestThread != nullptr && AutoRestThread->IsAlive && AutoRestRanging){ + AutoRestRanging = false; + AutoRestThread->Abort(); + AutoRestThread = nullptr; + } + + if(send_packet){ + // ‘ÞŽºƒƒbƒZ[ƒW‚ð‘—M + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + quit = gcnew array(3){ PH_QUIT, 0, 0 }; + PacketSendAllMember(quit, 0); + IDCounter = 0; + } + else if(MemberList->Count > 1){ + array^ quit = gcnew array(3){ PH_QUIT }; + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, quit, 1, 2); + UDP->BeginSend(quit, quit->Length, MemberList[1]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + + if(GameThread != nullptr && GameThread->IsAlive){ + AfterCloseUDP = true; + } + else{ + UDP->Close(); + } + } + } + + void TalkMessage(UINT16 id, array^ msg){ + int i; + String^ name; + Color col; + + // ‘—ŽóM + if(UDP != nullptr && MemberList->Count > 1){ + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + // –{l‚Æ”­MŽÒˆÈŠO‚É‘—M + PacketSendAllMember(msg, id); + } + else{ + // ŽóM‚Å‚È‚¯‚ê‚ÎAƒT[ƒo‚É‘—M + if(id != 0xFFFF){ + UDP->BeginSend(msg, msg->Length, MemberList[1]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + else{ + // ŽóMƒtƒ‰ƒO‚ðƒNƒŠƒA + id = BitConverter::ToUInt16(msg, 1); + } + } + } + + // ƒƒ“ƒo[ŒŸõ + Monitor::Enter(MemberList); + try{ + for(i = 0; i < MemberList->Count; i++){ + if(id == MemberList[i]->ID){ + name = MemberList[i]->NAME; + col = NameColor[MemberList[i]->TYPE]; + break; + } + } + + if(i >= MemberList->Count && MTOPTION.CONNECTION_TYPE != CT_SERVER){ + name = gcnew String(String::Format("Unknown(ID:{0})", id)); + col = ErrorMessageColor; + + // ƒƒ“ƒo[ƒŠƒXƒgŠO‚ÌID‚ª‚¢‚½‚Ì‚Å–â‚¢‡‚킹 + array^ send = gcnew array(3){ PH_REQ_LIST }; + Array::Copy(BitConverter::GetBytes(id), 0, send, 1, 2); + UDP->Send(send, 3, MemberList[1]->IP_EP); + } + } + finally{ + Monitor::Exit(MemberList); + } + + // ‰¹º—Dæ“x: ƒjƒbƒNƒl[ƒ€ > ƒL[ƒ[ƒh > ”­Œ¾ + // ƒjƒbƒNƒl[ƒ€‰¹ºÄ¶ + String ^tmpMsg = Encoding::Unicode->GetString(msg, 4, msg[3]); + bool inname = 0; + if(tmpMsg->Contains(gcnew String(MTOPTION.NAME))) { + // –¼‘O‚ªŒÄ‚΂ꂽ‚çƒEƒBƒ“ƒhƒE“_–Å + if(MTOPTION.NAME_FLASH) { + WindowFlash(); + } + if(MTOPTION.NAME_SOUND_ENABLE){ + inname = 1; + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.NAME_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + } + // ƒL[ƒ[ƒh”½‰ž + bool inkeyword = 0; + if(MTOPTION.KEYWORD_SOUND_ENABLE && !inname){ + // •ªŠ„ƒoƒbƒtƒ@ + TCHAR *tok, *next; + TCHAR s1[MAX_KEYWORD]; + _tcscpy_s(s1, MTOPTION.KEYWORD); + tok = wcstok_s(s1, _T(","), &next); + while(tok != NULL){ + if(tmpMsg->Contains(gcnew String(tok))) { + inkeyword = 1; + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.KEYWORD_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + break; + } + tok = wcstok_s(NULL, _T(","), &next); + } + } + // ”­Œ¾‚ŃEƒBƒ“ƒhƒE“_–Å + if(MemberList[0]->ID != id && !inname) { + if(MTOPTION.TALK_FLASH) { + WindowFlash(); + } + // ”­Œ¾‚ʼn¹‚ðĶ + if(MTOPTION.TALK_SOUND_ENABLE && !inkeyword){ + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.TALK_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + } + + // ŽžŠÔ + if(inname||inkeyword){ + WriteTime(1, DebugMessageColor); + }else{ + WriteTime(1, SystemMessageColor); + } + // •\Ž¦ + WriteMessage(String::Format("[ {0} ] ", name), col); + WriteMessage(String::Format("{0}\n", tmpMsg), TalkMessageColor); + } + + void WriteMessage(String^ msg, Color color){ + if(richTextBoxLog->InvokeRequired){ + WriteMessageDelegate^ wmd = gcnew WriteMessageDelegate(this, &MainForm::WriteMessage); + richTextBoxLog->Invoke(wmd, msg, color); + } + else{ + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + + richTextBoxLog->SelectionColor = color; + richTextBoxLog->AppendText(msg); + + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + + if(!MTOPTION.LOG_LOCK) { + richTextBoxLog->ScrollToCaret(); + } + } + finally{ + Monitor::Exit(richTextBoxLog); + } + } + } + void WriteTime(bool f, Color color){ + if(f){ + WriteMessage(String::Format("[{0}]", DateTime::Now.ToString("HH:mm")), color); + }else{ + WriteMessage(String::Format("[{0}] ", DateTime::Now.ToString("HH:mm")), color); + } + } + void WriteNotice(String^ msg){ + // ‰¹‚Å‚¨’m‚点 + if(MTOPTION.CONNECTION_TYPE != CT_SERVER){ + if(MTOPTION.NOTICE_SOUND_ENABLE){ + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.NOTICE_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + } + + // \n‚ʼnüs + msg = msg->Replace("\\n", "\n"); + + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + + richTextBoxLog->SelectionFont = gcnew Drawing::Font(richTextBoxLog->Font->FontFamily, richTextBoxLog->Font->Size + 2); + richTextBoxLog->SelectionColor = TalkMessageColor; + richTextBoxLog->SelectionBackColor = NoticeBackColor; + richTextBoxLog->AppendText(msg + "\n"); + + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + + if(!MTOPTION.LOG_LOCK) { + richTextBoxLog->ScrollToCaret(); + } + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "RichTextBox"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + + } + + void WriteComment(String^ name, int type, String^ comment){ + if(ListView == LV_BLIND){ + return; + } + + // ‰¹‚Å‚¨’m‚点 + if(MTOPTION.ENTER_SOUND_ENABLE){ + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.ENTER_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + + if(comment->Length > 0){ + // ŽžŠÔ + WriteTime(1, SystemMessageColor); + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + richTextBoxLog->SelectionColor = NameColor[type]; + richTextBoxLog->SelectionBackColor = CommentBackColor; + richTextBoxLog->AppendText(String::Format("[ {0} ] ", name)); + + richTextBoxLog->SelectionColor = TalkMessageColor; + richTextBoxLog->SelectionBackColor = CommentBackColor; + richTextBoxLog->AppendText(String::Format("{0}\n", comment)); + + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + if(!MTOPTION.LOG_LOCK) { + richTextBoxLog->ScrollToCaret(); + } + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "RichTextBox"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + } + else{ + WriteTime(0, SystemMessageColor); + WriteMessage(String::Format("{0}‚ª“üŽº‚µ‚Ü‚µ‚½B\n", name), SystemMessageColor); + } + } + + void WriteCommandList(){ + WriteMessage( + "/help F ƒRƒ}ƒ“ƒhˆê——‚Ì•\Ž¦\n" + "/clear F ƒƒO‚Ìíœ\n" + "/log F RTFŒ`Ž®‚ŃƒO‚Ì•Û‘¶\n" + "/debug F ƒfƒoƒbƒOƒ‚[ƒh‚ÌØ‚è‘Ö‚¦\n" + "/vs F ƒ‰ƒ“ƒ_ƒ€‚É‘Îí‚𒧂Þ\n" + "/game F ƒQ[ƒ€‚Ì‹N“®\n" + "/replay F ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚ÌĶ\n" + "/quit F ‹N“®’†‚̃Q[ƒ€‚ðI—¹\n" + "/reload F ƒƒ“ƒo[ƒŠƒXƒg‚ÌXV\n" + "/restart F ƒtƒŠ[ƒvƒŒƒC‚©‚çV‹K‚ɉñüÚ‘±\n" + "/rest F ‹xŒeó‘Ô‚ÌØ‚è‘Ö‚¦\n" + "/seek F ‘Îí•åWó‘Ô‚ÌØ‚è‘Ö‚¦\n" + "/list F ƒŠƒXƒg‚Ì•\Ž¦‚ðØ‚è‘Ö‚¦\n" + "/leave F ‘ÞŽº•ƒtƒŠ[ƒvƒŒƒC‚ɈÚs\n" + "/exit F ƒvƒƒOƒ‰ƒ€‚ÌI—¹\n", SystemMessageColor); + } + + void RandomVersus(){ + if(ServerMode == SM_MIX){ + return; + } + + if(MTOPTION.CONNECTION_TYPE != CT_FREE && MemberList[0]->STATE == MS_FREE){ + UINT n = 0; + Generic::List^ list = gcnew Generic::List; + + Monitor::Enter(MemberList); + try{ + for(int i = 1; i < MemberList->Count; i++){ + if(MemberList[i]->STATE == MS_FREE && MemberList[i]->TYPE != CT_CLIENT){ + list->Add(i); + } + } + + if(list->Count > 0){ + n = list[XorShift() % list->Count]; + } + } + finally{ + Monitor::Exit(MemberList); + } + + if(n > 0){ + listBoxMember->SelectedIndex = n; + StartGame(RT_VS); + } + else{ + WriteMessage("‘Îí‚Å‚«‚é‘ŠŽè‚ª‚¢‚Ü‚¹‚ñ‚Å‚µ‚½B\n", SystemMessageColor); + } + } + } + + void AnalyzeCommand(){ + if(textBoxInput->Text->StartsWith("/help", StringComparison::OrdinalIgnoreCase)){ + WriteCommandList(); + } + else if(textBoxInput->Text->StartsWith("/clear", StringComparison::OrdinalIgnoreCase)){ + ClearLog(); + } + else if(textBoxInput->Text->StartsWith("/log", StringComparison::OrdinalIgnoreCase)){ + String^ path = gcnew String(MTOPTION.PATH); + String^ file = String::Format("MT_{0}.rtf", DateTime::Now.ToString("yyMMdd-HHmmss")); + path += file; + + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SaveFile(path, RichTextBoxStreamType::RichText); + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "SaveLog"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + + WriteMessage(String::Format("\"{0}\"‚ɃƒO‚ð•Û‘¶‚µ‚Ü‚µ‚½B\n", file), SystemMessageColor); + } + else if(textBoxInput->Text->StartsWith("/debug", StringComparison::OrdinalIgnoreCase)){ + MTINFO.DEBUG ^= 1; + if(MTINFO.DEBUG){ + WriteMessage("ƒfƒoƒbƒOƒ‚[ƒh > ƒIƒ“\n", SystemMessageColor); + } + else{ + WriteMessage("ƒfƒoƒbƒOƒ‚[ƒh > ƒIƒt\n", SystemMessageColor); + } + } + else if(textBoxInput->Text->StartsWith("/vs", StringComparison::OrdinalIgnoreCase)){ + RandomVersus(); + } + else if(textBoxInput->Text->StartsWith("/game", StringComparison::OrdinalIgnoreCase)){ + StartGame(RT_FREE); + } + else if(textBoxInput->Text->StartsWith("/replay", StringComparison::OrdinalIgnoreCase)){ + ReplayFilePath = String::Empty; + StartGame(RT_PLAYBACK); + } + else if(textBoxInput->Text->StartsWith("/quit", StringComparison::OrdinalIgnoreCase)){ + QuitGame(); + } + else if(textBoxInput->Text->StartsWith("/restart", StringComparison::OrdinalIgnoreCase)){ + Restart(); + } + else if(textBoxInput->Text->StartsWith("/rest", StringComparison::OrdinalIgnoreCase)){ + if(MTOPTION.CONNECTION_TYPE == CT_FREE) return; + + if(MemberList[0]->STATE == MS_FREE){ + ChangeState((BYTE)MS_REST); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒ“\n", SystemMessageColor); + } + else if(MemberList[0]->STATE == MS_REST){ + ChangeState((BYTE)MS_FREE); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒt\n", SystemMessageColor); + } + } + else if(textBoxInput->Text->StartsWith("/seek", StringComparison::OrdinalIgnoreCase)){ + ChangeSeek(); + } + else if(textBoxInput->Text->StartsWith("/list", StringComparison::OrdinalIgnoreCase)){ + ChangeListView(true); + } + else if(textBoxInput->Text->StartsWith("/time", StringComparison::OrdinalIgnoreCase)){ + WriteMessage(String::Format("{0} {1}\n", DateTime::Now.ToLongDateString(), DateTime::Now.ToLongTimeString()), SecretColor); + } + else if(textBoxInput->Text->StartsWith("/dice", StringComparison::OrdinalIgnoreCase)){ + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + BYTE dice = (BYTE)(XorShift() % 101); + + array^ send = gcnew array(2){ PH_DICE, dice }; + PacketSendAllMember(send, 0); + + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + + richTextBoxLog->SelectionColor = TalkMessageColor; + richTextBoxLog->SelectionBackColor = NoticeBackColor; + richTextBoxLog->AppendText(Byte(dice).ToString() + "\n"); + + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + if(!MTOPTION.LOG_LOCK) { + richTextBoxLog->ScrollToCaret(); + } + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "RichTextBox"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + } + } + else if(textBoxInput->Text->StartsWith("/leave", StringComparison::OrdinalIgnoreCase)){ + Leave(true); + } + else if(textBoxInput->Text->StartsWith("/exit", StringComparison::OrdinalIgnoreCase)){ + this->Close(); + } + else if(textBoxInput->Text->StartsWith("/memberlist", StringComparison::OrdinalIgnoreCase)){ + // ƒfƒoƒbƒO—pƒRƒ}ƒ“ƒh + if(UDP == nullptr){ + return; + } + if(MTINFO.DEBUG){ + WriteMessage("NAME / ID / IP_EP / TYPE\n", DebugMessageColor); + for(int i = 0; i < MemberList->Count; i++){ + // TYPE 0:Server 1:Host 2:Client + WriteMessage(String::Format("{0} / {1} / {2} / {3}\n", MemberList[i]->NAME, MemberList[i]->ID, MemberList[i]->IP_EP, MemberList[i]->TYPE), DebugMessageColor); + } + } + } + else if(textBoxInput->Text->StartsWith("/memberhistory", StringComparison::OrdinalIgnoreCase)){ + // ƒfƒoƒbƒO—pƒRƒ}ƒ“ƒh + if(MTOPTION.CONNECTION_TYPE != CT_SERVER || UDP == nullptr){ + return; + } + if(MTINFO.DEBUG){ + WriteMessage("ID / IP_EP\n", DebugMessageColor); + for(int i = 0; i < MemberListBackUp->Count; i++){ + WriteMessage(String::Format("{0} / {1}\n", MemberListBackUp[i]->ID, MemberListBackUp[i]->IP_EP), DebugMessageColor); + } + } + } + else if(textBoxInput->Text->StartsWith("/reload")){ + ReloadList(); + } + else if(textBoxInput->Text->StartsWith("/test", StringComparison::OrdinalIgnoreCase)){ + // ƒfƒoƒbƒO—pƒRƒ}ƒ“ƒh + + //Debug::WriteLine("test"); + //Thread::Sleep(100 * 1000); + + //ChangeState((BYTE)MS_FREE); + + /* + richTextBoxLog->SelectionStart = richTextBoxLog->Text->Length; + richTextBoxLog->SelectionColor = ErrorMessageColor; + richTextBoxLog->AppendText("hogehoge\n"); + */ + + + + + // ‹­§ƒLƒbƒN + //array^ send = gcnew array(3){ PH_LOST, 0xFF, 0xFF }; + //IPEndPoint^ ep = gcnew IPEndPoint(IPAddress::Parse("221.79.20.188")->Address, 7500); + //UDP->BeginSend(send, send->Length, ep, gcnew AsyncCallback(SendPackets), UDP); + + // ping + //IPEndPoint^ ep = gcnew IPEndPoint(IPAddress::Parse("220.147.87.48")->Address, 4040); + //array^ ping = gcnew array(1){ PH_PING }; + //Ping = timeGetTime(); + //UDP->BeginSend(ping, 1, ep, gcnew AsyncCallback(SendPackets), UDP); + + // ‚È‚è‚«‚è + /* + IPEndPoint^ ep = gcnew IPEndPoint(IPAddress::Parse("220.147.87.48")->Address, 4040); + BYTE len = (BYTE)(16); + array^ msg = gcnew array(4 + len); + + msg[0] = PH_MESSAGE; + Array::Copy(BitConverter::GetBytes(207), 0, msg, 1, 2); + msg[3] = len; + Array::Copy(Encoding::Unicode->GetBytes("‚»‚ê‚Ù‚Ç‚Å‚à‚È‚¢"), 0, msg, 4, len); + + UDP->BeginSend(msg, msg->Length, ep, gcnew AsyncCallback(SendPackets), UDP); + */ + + + /*// MTSPƒAƒhƒŒƒXƒfƒR[ƒh + IPEndPoint^ ep = gcnew IPEndPoint(MTDecryptionIP(""), 7500); + WriteMessage(String::Format("{0}", ep), DebugMessageColor); + //*/ + + /*// LilithPortƒAƒhƒŒƒXƒfƒR[ƒh + IPEndPoint^ ep = gcnew IPEndPoint(DecryptionIP("", true), 7500); + WriteMessage(String::Format("{0}", ep), DebugMessageColor); + //*/ + + /*// ƒƒ“ƒo[ƒŠƒXƒgŽè“®íœ + MemberList->RemoveAt(listBoxMember->SelectedIndex); + listBoxMember->Items->RemoveAt(listBoxMember->SelectedIndex); + //*/ + } + } + + void AddListView(MemberInfo^% info){ + switch(ListView){ + case LV_NAME: + listBoxMember->Items->Add(info->NAME); + break; + + case LV_COMMENT: + if(info->COMMENT->Length > 0){ + listBoxMember->Items->Add(info->COMMENT); + } + else{ + listBoxMember->Items->Add(gcnew String("Ÿ")); + } + break; + + case LV_BLIND: + listBoxMember->Items->Add(gcnew String("Ÿ")); + break; + } + } + + void ChangeListView(bool auto_change){ + listBoxMember->SelectedIndex = -1; + + if(ListView == LV_BLIND){ + return; + } + + // –¼‘O‚ƃRƒƒ“ƒg‚ÌŽ©“®Ø‚è‘Ö‚¦ + if(auto_change){ + switch(ListView){ + case LV_NAME: + ListView = LV_COMMENT; + break; + + case LV_COMMENT: + ListView = LV_NAME; + break; + + case LV_BLIND: + break; + } + } + + Monitor::Enter(MemberList); + try{ + for(int i = 0; i < listBoxMember->Items->Count; i++){ + switch(ListView){ + case LV_NAME: + listBoxMember->Items[i] = MemberList[i]->NAME; + break; + + case LV_COMMENT: + if(MemberList[i]->COMMENT->Length > 0){ + listBoxMember->Items[i] = MemberList[i]->COMMENT; + } + else{ + listBoxMember->Items[i] = gcnew String("Ÿ"); + } + break; + + case LV_BLIND: + listBoxMember->Items[i] = gcnew String("Ÿ"); + break; + } + } + } + finally{ + Monitor::Exit(MemberList); + } + } + + void ResetDelay(UINT value){ + toolStripMenuItemDelayAuto->Checked = false; + toolStripMenuItemDelay2->Checked = false; + toolStripMenuItemDelay3->Checked = false; + toolStripMenuItemDelay4->Checked = false; + toolStripMenuItemDelay5->Checked = false; + toolStripMenuItemDelay6->Checked = false; + toolStripMenuItemDelay7->Checked = false; + toolStripMenuItemDelay8->Checked = false; + toolStripMenuItemDelay9->Checked = false; + toolStripMenuItemDelay10->Checked = false; + toolStripMenuItemDelay11->Checked = false; + toolStripMenuItemDelay12->Checked = false; + + switch(value){ + case 0: + default: + toolStripMenuItemDelayAuto->Checked = true; + MTOPTION.DELAY = 0; + break; + case 2: + toolStripMenuItemDelay2->Checked = true; + MTOPTION.DELAY = 2; + break; + case 3: + toolStripMenuItemDelay3->Checked = true; + MTOPTION.DELAY = 3; + break; + case 4: + toolStripMenuItemDelay4->Checked = true; + MTOPTION.DELAY = 4; + break; + case 5: + toolStripMenuItemDelay5->Checked = true; + MTOPTION.DELAY = 5; + break; + case 6: + toolStripMenuItemDelay6->Checked = true; + MTOPTION.DELAY = 6; + break; + case 7: + toolStripMenuItemDelay7->Checked = true; + MTOPTION.DELAY = 7; + break; + case 8: + toolStripMenuItemDelay8->Checked = true; + MTOPTION.DELAY = 8; + break; + case 9: + toolStripMenuItemDelay9->Checked = true; + MTOPTION.DELAY = 9; + break; + case 10: + toolStripMenuItemDelay10->Checked = true; + MTOPTION.DELAY = 10; + break; + case 11: + toolStripMenuItemDelay11->Checked = true; + MTOPTION.DELAY = 11; + break; + case 12: + toolStripMenuItemDelay12->Checked = true; + MTOPTION.DELAY = 12; + break; + } + } + + + void ReloadList(){ + // ƒƒ“ƒo[ƒŠƒXƒgXV + if(MTOPTION.CONNECTION_TYPE == CT_SERVER || UDP == nullptr){ + return; + } + int count = MemberList->Count; + if(count > 1){ + for(int i = 2; i < count; i++){ + MemberList->RemoveAt(2); + listBoxMember->Items->RemoveAt(2); + } + } + array^ send = gcnew array(3){ PH_REQ_LIST }; + Array::Copy(BitConverter::GetBytes(0), 0, send, 1, 2); + UDP->Send(send, 3, MemberList[1]->IP_EP); + + WriteMessage("ƒƒ“ƒo[ƒŠƒXƒg‚ðXV‚µ‚Ü‚µ‚½B(˜A‘±‚µ‚Ä‚ÌXV‚̓T[ƒo[‚É•‰‰×‚ª‚©‚©‚邽‚ßA’ˆÓ‚µ‚Ä‚­‚¾‚³‚¢B)\n", SystemMessageColor); + } + void WriteStatus(String^ msg){ + toolStripStatusLabel->Text = msg; + } + public: + // IPŽæ“¾Š®—¹ + void GetIPOpenReadCompleted(System::Object^ sender, System::Net::OpenReadCompletedEventArgs^ e) { + + // I—¹—p + if(GetIPClient == nullptr) return; + if(GetIPCancelled == true) { + GetIPCancelled = false; + GetIPClient = nullptr; + return; + } + // TimerGetIPƒ^ƒCƒ€ƒAƒEƒg + if(e->Cancelled) { + WriteMessage("IPƒAƒhƒŒƒXŽæ“¾‚Ì—v‹‚ªƒ^ƒCƒ€ƒAƒEƒg‚É‚æ‚èƒLƒƒƒ“ƒZƒ‹‚³‚ê‚Ü‚µ‚½B\n", ErrorMessageColor); + if(MTINFO.DEBUG){ + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + GetIPClient = nullptr; + return; + } + // ƒAƒhƒŒƒX‚Ì’Šo + String^ html; + _int64 Global_address; + array ^s1, ^s2, ^s3; + Stream^ reply = nullptr; + StreamReader^ sr = nullptr; + try{ + reply = dynamic_cast(e->Result); + sr = gcnew StreamReader(reply); + html = sr->ReadToEnd(); + s1 = html->Split(':'); + s2 = s1[1]->Split('<'); + s3 = s2[0]->Split(' '); + Global_address = Int64(Net::IPAddress::Parse(s3[1])->Address); + } + catch(Exception^ e) { + Global_address = 0; + WriteMessage("IPƒAƒhƒŒƒXî•ñ‚Ì’Šo‚ÉŽ¸”s‚µ‚Ü‚µ‚½B\nLilithPort‚̃o[ƒWƒ‡ƒ“‚ªŒÃ‚¢‰Â”\«‚ª‚ ‚è‚Ü‚·B\n", ErrorMessageColor); + + if(MTINFO.DEBUG){ + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + finally{ + // Stream‚Í‚µ‚Á‚©‚èŠJ•ú + if(sr != nullptr) sr->Close(); + if(reply != nullptr) reply->Close(); + } + if(Global_address > 0) { + WriteMessage(String::Format("IPƒAƒhƒŒƒX‚ðŽæ“¾‚µ‚Ü‚µ‚½B > {0}\n", s3[1]), SystemMessageColor); + WriteMessage("[•ÏŠ·ƒAƒhƒŒƒX:ƒ|[ƒg]\nLilithPort—p > ", SystemMessageColor); + + richTextBoxLog->SelectionColor = TalkMessageColor; + richTextBoxLog->SelectionBackColor = NoticeBackColor; + richTextBoxLog->AppendText(String::Format("{0}:{1}\n", EncryptionIP(s3[1]), MTOPTION.OPEN_PORT)); + + WriteMessage("MTSP—p > ", SystemMessageColor); + richTextBoxLog->SelectionColor = TalkMessageColor; + richTextBoxLog->SelectionBackColor = NoticeBackColor; + richTextBoxLog->AppendText(String::Format("{0}:{1}\n", MTEncryptionIP(s3[1]), MTOPTION.OPEN_PORT)); + + + WriteMessage("-------------------------------\n", SystemMessageColor); + } + GetIPClient = nullptr; + } + + void ChangeComment(String^ comment){ + if(UDP == nullptr || (MTOPTION.CONNECTION_TYPE != CT_FREE && ServerMode >= SM_MATCH)){ + return; + } + + MemberList[0]->COMMENT = comment; + + if(ListView == LV_COMMENT){ + if(comment->Length > 0){ + listBoxMember->Items[0] = comment; + } + else{ + listBoxMember->Items[0] = gcnew String("Ÿ"); + } + } + + BYTE len = (BYTE)(comment->Length * 2); + array^ send = gcnew array(4 + len); + + send[0] = PH_CHANGE_COMMENT; + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, send, 1, 2); + send[3] = len; + Array::Copy(Encoding::Unicode->GetBytes(comment), 0, send, 4, len); + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + PacketSendAllMember(send, 0); + } + else{ + UDP->BeginSend(send, send->Length, MemberList[1]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + } + + void ResetColor(){ + NameColor = gcnew array{ + Color::FromArgb(MTCOLOR.SERVER_NAME), + Color::FromArgb(MTCOLOR.HOST_NAME), + Color::FromArgb(MTCOLOR.CLIENT_NAME), + SystemColors::WindowText, + }; + + StateRectColor = gcnew array{ + Color::FromArgb(MTCOLOR.REST_STATE), + Color::FromArgb(MTCOLOR.VS_STATE), + Color::FromArgb(MTCOLOR.WATCH_STATE), + Color::FromArgb(MTCOLOR.SEEK_STATE), + }; + + TalkMessageColor = SystemColors::WindowText; + SystemMessageColor = Color::FromArgb(MTCOLOR.SYSTEM_MESSAGE); + ErrorMessageColor = Color::FromArgb(MTCOLOR.ERROR_MESSAGE); + DebugMessageColor = Color::FromArgb(MTCOLOR.DEBUG_MESSAGE); + NoticeBackColor = Color::FromArgb(MTCOLOR.NOTICE_BACK); + CommentBackColor = Color::FromArgb(MTCOLOR.COMMENT_BACK); + SecretColor = Color::FromArgb(MTCOLOR.SECRET); + } + + void GetIPAddress(){ + if(GetIPClient == nullptr){ + // ƒOƒ[ƒoƒ‹IP‚̎擾 + GetIPClient = gcnew WebClient(); + GetIPClient->OpenReadCompleted += gcnew OpenReadCompletedEventHandler(this, &MainForm::GetIPOpenReadCompleted); + + // ƒ^ƒCƒ€ƒAƒEƒgƒ^ƒCƒ}[ + WriteMessage("IPƒAƒhƒŒƒX‚ðŽæ“¾’†‚Å‚·...\n", SystemMessageColor); + TimerGetIPThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::TimerGetIP)); + TimerGetIPThread->Start(); + try{ + GetIPClient->OpenReadAsync(GetIPUri); + } + catch(WebException^ e) { + WriteMessage("IPƒAƒhƒŒƒX‚̎擾‚ÉŽ¸”s‚µ‚Ü‚µ‚½B\n", ErrorMessageColor); + + if(MTINFO.DEBUG){ + WriteMessage(e->ToString() + "\n", DebugMessageColor); + } + } + } + } + void ChangeProfileEnabled(){ + // ƒvƒƒtƒ@ƒCƒ‹ƒhƒƒbƒvƒ_ƒEƒ“XV + toolStripDropDownButtonProfile->DropDownItems->Clear(); + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(Profile::ProfileList[i] == gcnew String(MTOPTION.PROFILE)){ + toolStripDropDownButtonProfile->Text = Profile::ProfileList[i]; + } + toolStripDropDownButtonProfile->DropDownItems->Add(Profile::ProfileList[i]); + toolStripDropDownButtonProfile->DropDownItems[i]->Click += gcnew System::EventHandler(this, &MainForm::toolStripDropDownItemProfile_Click); + } + toolStripDropDownButtonProfile->Enabled = true; + } + void SetAutoRestTime(UINT time){ + MTOPTION.AUTO_REST_TIME = time; + toolStripMenuItemAutoRestTime5->Checked = 0; + toolStripMenuItemAutoRestTime10->Checked = 0; + toolStripMenuItemAutoRestTime15->Checked = 0; + toolStripMenuItemAutoRestTime20->Checked = 0; + toolStripMenuItemAutoRestTime30->Checked = 0; + toolStripMenuItemAutoRestTime60->Checked = 0; + toolStripMenuItemAutoRestTime120->Checked = 0; + } + private: + System::Void MainForm_Load(System::Object^ sender, System::EventArgs^ e) { + // sŠÔ‚ð‹l‚ß‚é + richTextBoxLog->LanguageOption = RichTextBoxLanguageOptions::UIFonts; + + // ƒXƒŒƒbƒhŠÔ‚̌ĂÑo‚µŠm”F‚𖳌ø‚É‚·‚é + Control::CheckForIllegalCrossThreadCalls = false; + + if(MTWS.LEFT > 0 && MTWS.TOP > 0){ + this->StartPosition = FormStartPosition::Manual; + this->Location = System::Drawing::Point(MTWS.LEFT, MTWS.TOP); + } + + if(MTWS.WIDTH > 0 && MTWS.HEIGHT > 0){ + this->ClientSize = System::Drawing::Size(MTWS.WIDTH, MTWS.HEIGHT); + } + + if(MTWS.SPLITTER > 0){ + splitContainer1->SplitterDistance = MTWS.SPLITTER; + } + + ResetDelay(MTOPTION.DELAY); + ResetColor(); + + toolStripMenuItemRecordReplay->Checked = MTOPTION.RECORD_REPLAY; + toolStripMenuItemAllowSpectator->Checked = MTOPTION.ALLOW_SPECTATOR; + LogLockToolStripMenuItem->Checked = MTOPTION.LOG_LOCK; + toolStripMenuItemWordWrap->Checked = MTOPTION.LOG_WORDWRAP; + richTextBoxLog->WordWrap = MTOPTION.LOG_WORDWRAP; + toolStripMenuItemAfterRest->Checked = MTOPTION.AFTER_REST; + toolStripMenuItemAutoRestEnable->Checked = MTOPTION.AUTO_REST; + switch(MTOPTION.AUTO_REST_TIME){ + case 5: + toolStripMenuItemAutoRestTime5->Checked = 1; + break; + case 10: + toolStripMenuItemAutoRestTime10->Checked = 1; + break; + case 15: + toolStripMenuItemAutoRestTime15->Checked = 1; + break; + case 20: + toolStripMenuItemAutoRestTime20->Checked = 1; + break; + case 30: + toolStripMenuItemAutoRestTime30->Checked = 1; + break; + case 60: + toolStripMenuItemAutoRestTime60->Checked = 1; + break; + case 120: + toolStripMenuItemAutoRestTime120->Checked = 1; + break; + } + + IsFormClosing = false; + ListView = LV_NAME; + + ChatHistoryNumber = 0; + ChatHistory = gcnew Generic::List; + + UDP = nullptr; + + MemberList = gcnew Generic::List; + MemberListBackUp = gcnew Generic::List; + SpectatorList = gcnew Generic::List; + WatchHistory = gcnew array(TIME_OUT/5 * 3); + InputHistory = gcnew array(TIME_OUT/5 * 3); + + // richtextbox‚̃fƒtƒHƒ‹ƒgfalseƒoƒO‘Îô + richTextBoxLog->AutoWordSelection = true; + richTextBoxLog->AutoWordSelection = false; + + timeBeginPeriod(1); + } + + System::Void MainForm_Shown(System::Object^ sender, System::EventArgs^ e) { + textBoxInput->Focus(); + + this->toolStripMenuItemVersion_Click(nullptr, nullptr); + + if(MTINFO.SERVER_MODE){ + // ƒT[ƒoƒ‚[ƒh‹N“® + MTOPTION.CONNECTION_TYPE = CT_SERVER; + if(MTINFO.SERVER_MODE_PORT > 0){ + MTOPTION.OPEN_PORT = MTINFO.SERVER_MODE_PORT; + } + }else{ + StartupForm^ s = gcnew StartupForm; + s->ShowDialog(this); + + if(!File::Exists(gcnew String(MTOPTION.GAME_EXE))){ + MessageBox::Show("ŽÀsƒtƒ@ƒCƒ‹‚̃pƒX‚ðݒ肵‚Ä‚­‚¾‚³‚¢B", "ƒQ[ƒ€‚ª‚ ‚è‚Ü‚¹‚ñ"); + + OptionForm^ o = gcnew OptionForm; + o->GameExePathError = true; + o->ShowDialog(this); + } + } + + Begin(); + } + + System::Void MainForm_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) { + if(IsFormClosing == false && GameThread != nullptr && GameThread->IsAlive){ + IsFormClosing = true; + + QuitGame(); + + e->Cancel = true; + return; + } + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER && MTINFO.ERRORED == false){ + if(MessageBox::Show("ƒT[ƒo‚ð—Ž‚Æ‚µ‚Ü‚·‚©H", "I—¹‚ÌŠm”F", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::No){ + IsFormClosing = false; + e->Cancel = true; + return; + } + } + + QuitWatch(true); + CloseUdp(true); + + // IPŽæ“¾‚̃Lƒƒƒ“ƒZƒ‹ + if(GetIPClient != nullptr){ + GetIPCancelled = true; + GetIPClient->CancelAsync(); + } + if(TimerGetIPThread != nullptr && TimerGetIPThread->IsAlive){ + if(GetIPSleeping){ + TimerGetIPThread->Interrupt(); + } + TimerGetIPThread->Join(); + } + + if(MTINFO.DEBUG){ + String^ path = gcnew String(MTOPTION.PATH); + path += "log.rtf"; + + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SaveFile(path, RichTextBoxStreamType::RichText); + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "SaveLog"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + } + } + + System::Void MainForm_FormClosed(System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e) { + MTWS.LEFT = this->Location.X; + MTWS.TOP = this->Location.Y; + MTWS.WIDTH = this->ClientSize.Width; + MTWS.HEIGHT = this->ClientSize.Height; + MTWS.SPLITTER = splitContainer1->SplitterDistance; + + timeEndPeriod(1); + } + + System::Void textBoxInput_KeyDown( Object^ sender, System::Windows::Forms::KeyEventArgs^ e ) { + // ƒ`ƒƒƒbƒg—š—ð‚©‚ç‘I‘ð + if(ChatHistory->Count > 0){ + if(e->KeyCode == Keys::Up){ + ChatHistoryNumber--; + if(ChatHistoryNumber < 0){ + ChatHistoryNumber = 0; + } + + textBoxInput->Text = ChatHistory[ChatHistoryNumber]; + textBoxInput->SelectAll(); + e->SuppressKeyPress = true; + } + else if(e->KeyCode == Keys::Down){ + ChatHistoryNumber++; + if(ChatHistoryNumber > ChatHistory->Count){ + ChatHistoryNumber = ChatHistory->Count; + } + + if(ChatHistoryNumber == ChatHistory->Count){ + textBoxInput->Clear(); + } + else{ + textBoxInput->Text = ChatHistory[ChatHistoryNumber]; + textBoxInput->SelectAll(); + e->SuppressKeyPress = true; + } + } + } + + // ƒƒbƒZ[ƒW‘—M + if(e->KeyCode == Keys::Enter && textBoxInput->Text->Length > 0){ + // ƒ`ƒƒƒbƒg—š—ðXV + if(ChatHistoryNumber < ChatHistory->Count){ + if(ChatHistory[ChatHistoryNumber] != textBoxInput->Text){ + ChatHistory->Add(textBoxInput->Text); + } + } + else{ + ChatHistory->Add(textBoxInput->Text); + } + + if(MTOPTION.CHAT_HISTORY > 0 && (UINT)ChatHistory->Count > MTOPTION.CHAT_HISTORY){ + ChatHistory->RemoveAt(0); + } + ChatHistoryNumber = ChatHistory->Count; + + try{ + if(e->Control && MTOPTION.CONNECTION_TYPE == CT_SERVER){ + // ’m + BYTE len = (BYTE)(textBoxInput->Text->Length * 2); + array^ msg = gcnew array(2 + len); + + msg[0] = PH_NOTICE; + msg[1] = len; + Array::Copy(Encoding::Unicode->GetBytes(textBoxInput->Text), 0, msg, 2, len); + + PacketSendAllMember(msg, 0); + + WriteMessage("[ƒT[ƒo[’m]-------------------\n", SystemMessageColor); + WriteNotice(textBoxInput->Text); + WriteMessage("-------------------------------\n", SystemMessageColor); + } + else if(textBoxInput->Text[0] == '/'){ + AnalyzeCommand(); + } + else if(UDP != nullptr && ServerMode >= SM_MATCH){ + WriteMessage("ƒ`ƒƒƒbƒg‚Í‹ÖŽ~‚³‚ê‚Ä‚¢‚Ü‚·B\n", SystemMessageColor); + } + else if(UDP != nullptr){ + // ƒ`ƒƒƒbƒg”­Œ¾ + BYTE len = (BYTE)(textBoxInput->Text->Length * 2); + array^ msg = gcnew array(4 + len); + + msg[0] = PH_MESSAGE; + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, msg, 1, 2); + msg[3] = len; + Array::Copy(Encoding::Unicode->GetBytes(textBoxInput->Text), 0, msg, 4, len); + + TalkMessage(MemberList[0]->ID, msg); + } + else{ + WriteMessage(textBoxInput->Text + "\n", TalkMessageColor); + } + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage(String::Format("{0}\n", e->ToString()), DebugMessageColor); + } + } + + textBoxInput->Clear(); + e->SuppressKeyPress = true; + } + } + + System::Void listBoxMember_DrawItem(System::Object^ sender, System::Windows::Forms::DrawItemEventArgs^ e) { + if(e->Index == -1) return; + try{ + UINT state = MemberList[e->Index]->STATE; + Brush^ b = gcnew SolidBrush(NameColor[MemberList[e->Index]->TYPE]); + + switch(state){ + case MS_REST: + e->Graphics->FillRectangle(gcnew SolidBrush(StateRectColor[0]), e->Bounds); + break; + + case MS_VS: + e->Graphics->FillRectangle(gcnew SolidBrush(StateRectColor[1]), e->Bounds); + break; + + case MS_WATCH: + case MS_COUCH: + e->Graphics->FillRectangle(gcnew SolidBrush(StateRectColor[2]), e->Bounds); + break; + case MS_SEEK: + e->Graphics->FillRectangle(gcnew SolidBrush(StateRectColor[3]), e->Bounds); + break; + default: + e->DrawBackground(); + } + + e->Graphics->DrawString(listBoxMember->Items[e->Index]->ToString(), e->Font, b, e->Bounds); + e->DrawFocusRectangle(); + } + catch(ArgumentOutOfRangeException^){ + } + } + + System::Void listBoxMember_MouseDoubleClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { + int index = listBoxMember->IndexFromPoint(e->X, e->Y); + + if(index == -1){ + ChangeListView(true); + } + + if(MTOPTION.CONNECTION_TYPE == CT_FREE){ + return; + } + + if(index == 0){ + int state = MemberList[0]->STATE; + + // ‹xŒeó‘Ô‚Ì•ÏX + if(state == MS_FREE){ + ChangeState((BYTE)MS_REST); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒ“\n", SystemMessageColor); + } + else if(state == MS_REST){ + ChangeState((BYTE)MS_FREE); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒt\n", SystemMessageColor); + } + else if(state == MS_VS){ + WriteMessage("‘Îí‚𒆎~‚µ‚Ü‚·B\n", SystemMessageColor); + QuitGame(); + } + else if(state == MS_WATCH || state == MS_COUCH){ + WriteMessage("ŠÏí‚𒆎~‚µ‚Ü‚·B\n", SystemMessageColor); + QuitWatch(true); + } + } + else if(index > 0 && UDP != nullptr){ + // ó‘Ô‚ÌĎ擾 + array^ send = gcnew array(3){ PH_REQ_STATE }; + Array::Copy(BitConverter::GetBytes(MemberList[index]->ID), 0, send, 1, 2); + + if(MTOPTION.CONNECTION_TYPE == CT_SERVER){ + UDP->BeginSend(send, send->Length, MemberList[index]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + else{ + UDP->BeginSend(send, send->Length, MemberList[1]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + // Ping + this->toolStripMenuItemPing_Click(nullptr, nullptr); + } + } + + System::Void listBoxMember_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { + int index = listBoxMember->IndexFromPoint(e->X, e->Y); + + if(index == -1 || MTOPTION.CONNECTION_TYPE == CT_FREE || ListView == LV_BLIND){ + toolTipMember->Active = false; + return; + } + else{ + toolTipMember->Active = true; + } + String^ cap = String::Format("ID = {0}", MemberList[index]->ID); + if(index > 0){ + cap += String::Format(", VS = {0}", MemberList[index]->NUM_VS); + } + if(ListView == LV_NAME){ + if(MemberList[index]->COMMENT->Length > 0){ + cap += "\n" + MemberList[index]->COMMENT; + } + } + else if(ListView == LV_COMMENT){ + cap += "\n" + MemberList[index]->NAME; + } + toolTipMember->SetToolTip(listBoxMember, cap); + } + System::Void toolStripMenuItemSetting_Click(System::Object^ sender, System::EventArgs^ e) { + if(Option == nullptr || Option->IsDisposed){ + toolStripDropDownButtonProfile->Enabled = false; + Option = gcnew OptionForm; + Option->Show(this); + } + else{ + Option->Activate(); + } + } + + System::Void toolStripMenuItemViewCommand_Click(System::Object^ sender, System::EventArgs^ e) { + WriteCommandList(); + } + + System::Void toolStripMenuItemChangeList_Click(System::Object^ sender, System::EventArgs^ e) { + ChangeListView(true); + } + + System::Void toolStripMenuItemVersion_Click(System::Object^ sender, System::EventArgs^ e) { + WriteMessage("LilithPort v1.07\n", SystemMessageColor); + } + + System::Void toolStripMenuItemExit_Click(System::Object^ sender, System::EventArgs^ e) { + this->Close(); + } + + // ƒuƒbƒNƒ}[ƒN’ljÁ + System::Void toolStripMenuItemAddBookMark_Click(System::Object^ sender, System::EventArgs^ e) { + if((MTOPTION.BOOKMARK_COUNT - MTOPTION.BOOKMARK_DELETED_COUNT) > 9) { + MessageBox::Show("‚±‚êˆÈãƒuƒbƒNƒ}[ƒN‚ð’ljÁ‚Å‚«‚Ü‚¹‚ñB\nƒuƒbƒNƒ}[ƒN‚ÍÅ‘å10ŒÂ‚Ü‚Å“o˜^‚Å‚«‚Ü‚·B\n\n’ljÁ‚·‚é‚É‚ÍAƒuƒbƒNƒ}[ƒN‚Ì휂ðs‚Á‚Ä‚­‚¾‚³‚¢B", "ƒuƒbƒNƒ}[ƒN‚̒ljÁ", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + if(MTOPTION.CONNECTION_TYPE == CT_SERVER || MTOPTION.CONNECTION_TYPE == CT_FREE ){ + MessageBox::Show("SERVERƒ‚[ƒhA\nFREEƒ‚[ƒh‚̓uƒbƒNƒ}[ƒN‚ɒljÁ‚Å‚«‚Ü‚¹‚ñB", "ƒuƒbƒNƒ}[ƒN‚̒ljÁ", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + + String^ tmpName = ServerName; + String^ tmpIP = ConnectIP; + UINT tmpInt = MTOPTION.BOOKMARK_COUNT; + + toolStripMenuItemBookMark = (gcnew System::Windows::Forms::ToolStripMenuItem()); + toolStripMenuItemBookMarkMenu->DropDownItems->Add(toolStripMenuItemBookMark); + toolStripMenuItemBookMark->Text = ServerName; + toolStripMenuItemBookMark->Name = L"toolStripMenuItemBookMark" + MTOPTION.BOOKMARK_COUNT; + toolStripMenuItemBookMark->Tag = MTOPTION.BOOKMARK_COUNT; + toolStripMenuItemBookMark->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemBookMark_Click); + + // 휃ƒjƒ…[ + toolStripMenuItemDelBookMark = (gcnew System::Windows::Forms::ToolStripMenuItem()); + toolStripMenuItemBookMark->DropDownItems->Add(toolStripMenuItemDelBookMark); + toolStripMenuItemDelBookMark->Text = L"íœ(&D)"; + toolStripMenuItemDelBookMark->Tag = L"toolStripMenuItemBookMark" + MTOPTION.BOOKMARK_COUNT; + toolStripMenuItemDelBookMark->Click += gcnew System::EventHandler(this, &MainForm::toolStripMenuItemDelBookMark_Click); + + BookMarkServerName = Runtime::InteropServices::Marshal::StringToHGlobalAuto(tmpName); + _tcscpy_s(MTOPTION.BOOKMARK_SERVER_NAME[tmpInt], static_cast(BookMarkServerName.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(BookMarkServerName); + + BookMarkConnectIP = Runtime::InteropServices::Marshal::StringToHGlobalAuto(tmpIP); + _tcscpy_s(MTOPTION.BOOKMARK_CONNECTION_IP[tmpInt], static_cast(BookMarkConnectIP.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(BookMarkConnectIP); + + _itot_s(MTOPTION.CONNECTION_TYPE, MTOPTION.BOOKMARK_CONNECTION_TYPE[tmpInt], 10); + _itot_s(MTOPTION.OPEN_PORT, MTOPTION.BOOKMARK_PORT[tmpInt], 10); + + MTOPTION.BOOKMARK_COUNT++; + + SaveMTOption(); + } + // ƒuƒbƒNƒ}[ƒNÚ‘± + System::Void toolStripMenuItemBookMark_Click(System::Object^ sender, System::EventArgs^ e) { + UINT tmpInt = (UINT)((ToolStripMenuItem^)sender)->Tag; + + if(MessageBox::Show(((ToolStripMenuItem^)sender)->Text+" ‚ÉÚ‘±‚µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "ƒuƒbƒNƒ}[ƒNÚ‘±", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + + _tcscpy_s(MTOPTION.CONNECTION_IP, MTOPTION.BOOKMARK_CONNECTION_IP[tmpInt]); + MTOPTION.CONNECTION_TYPE = (UINT)_ttoi(MTOPTION.BOOKMARK_CONNECTION_TYPE[tmpInt]); + MTOPTION.OPEN_PORT = (UINT)_ttoi(MTOPTION.BOOKMARK_PORT[tmpInt]); + + Restart(); + } + // ƒuƒbƒNƒ}[ƒNíœ + System::Void toolStripMenuItemDelBookMark_Click(System::Object^ sender, System::EventArgs^ e) { + Object^ tmpTag; + tmpTag = ((ToolStripMenuItem^)sender)->Tag; + UINT tmpInt = (UINT)toolStripMenuItemBookMarkMenu->DropDownItems[(String^)tmpTag]->Tag; + if(MessageBox::Show((String^)toolStripMenuItemBookMarkMenu->DropDownItems[(String^)tmpTag]->Text+" ‚ðƒuƒbƒNƒ}[ƒN‚©‚ç휂µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "ƒuƒbƒNƒ}[ƒN‚Ìíœ", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + toolStripMenuItemBookMarkMenu->DropDownItems->Remove(toolStripMenuItemBookMarkMenu->DropDownItems[(String^)tmpTag]); + MTOPTION.BOOKMARK_DELETED_COUNT++; + + ZeroMemory(MTOPTION.BOOKMARK_SERVER_NAME[tmpInt], sizeof(MTOPTION.BOOKMARK_SERVER_NAME[tmpInt])); + ZeroMemory(MTOPTION.BOOKMARK_CONNECTION_IP[tmpInt], sizeof(MTOPTION.BOOKMARK_CONNECTION_IP[tmpInt])); + ZeroMemory(MTOPTION.BOOKMARK_CONNECTION_TYPE[tmpInt], sizeof(MTOPTION.BOOKMARK_CONNECTION_TYPE[tmpInt])); + ZeroMemory(MTOPTION.BOOKMARK_PORT[tmpInt], sizeof(MTOPTION.BOOKMARK_PORT[tmpInt])); + + SaveMTOption(); + } + } + + // ƒQ[ƒ€‚Ì‹N“® + System::Void GameStartToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + StartGame(RT_FREE); + } + // ƒQ[ƒ€‚Ì‹N“®(ƒŠƒvƒŒƒC‚ð•Û‘¶‚µ‚È‚¢) + System::Void GameStartNoReplayToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + bool primary = 0; + // ƒŠƒvƒŒƒC•Û‘¶ON‚È‚çˆêŽž“I–³Œø‰» + if(toolStripMenuItemRecordReplay->Checked == 1) { + primary = 1; + MTOPTION.RECORD_REPLAY = 0; + } + + StartGame(RT_FREE); + + if(primary == 1) { + // ‹N“®‘O‚É–ß‚µ‚Ä‚µ‚Ü‚¤‚Ì–hŽ~ + Thread::Sleep(100); + MTOPTION.RECORD_REPLAY = toolStripMenuItemRecordReplay->Checked; + } + } + // Ä‹N“® + System::Void RestartToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + if(MTOPTION.CONNECTION_TYPE == CT_SERVER) { + if(MessageBox::Show("ƒT[ƒo‚ð—Ž‚Æ‚µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "Ä‹N“®", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + } + + if(MTOPTION.CONNECTION_TYPE == CT_HOST || MTOPTION.CONNECTION_TYPE == CT_CLIENT){ + if(MessageBox::Show("‰ñü‚ðØ’f‚µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "Ä‹N“®", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + } + + Restart(); + } + + // ‘ÞŽº + System::Void LeaveToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + if(MTOPTION.CONNECTION_TYPE == CT_SERVER) { + if(MessageBox::Show("ƒT[ƒo‚ð—Ž‚Æ‚µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "‘ÞŽº", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + } + + if(MTOPTION.CONNECTION_TYPE == CT_HOST || MTOPTION.CONNECTION_TYPE == CT_CLIENT){ + if(MessageBox::Show("‰ñü‚ðØ’f‚µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", "‘ÞŽº", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + } + + Leave(true); + } + + // ‹xŒeó‘Ô‚ÌØ‚è‘Ö‚¦ + System::Void RestToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + if(MTOPTION.CONNECTION_TYPE == CT_FREE) return; + + if(MemberList[0]->STATE == MS_FREE){ + ChangeState((BYTE)MS_REST); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒ“\n", SystemMessageColor); + } + else if(MemberList[0]->STATE == MS_REST){ + ChangeState((BYTE)MS_FREE); + WriteMessage("‹xŒeó‘Ô‚ð•ÏX‚µ‚Ü‚µ‚½B > ƒIƒt\n", SystemMessageColor); + } + } + + // ‘Îí•åWó‘Ô‚ÌØ‚è‘Ö‚¦ + System::Void SeekToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + ChangeSeek(); + } + + // ƒƒO‚Ì‘Síœ + System::Void ClearToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + ClearLog(); + } + + // “–‚½‚è”»’è‚Ì•\Ž¦Ø‘Ö + System::Void ToggleHitJudgeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + // ƒQ[ƒ€‹N“®’†‚Ȃ瑦Žž•ÏX + MTOPTION.HIT_JUDGE ^= 1; + if(MTINFO.INITIALIZED && MTINFO.PROCESS != NULL){ + DWORD b = MTOPTION.HIT_JUDGE; + + if(MTINFO.KGT2K){ + WriteProcessMemory(MTINFO.PROCESS, (LPVOID)HIT_JUDGE, &b, 4, NULL); + } + else{ + WriteProcessMemory(MTINFO.PROCESS, (LPVOID)HIT_JUDGE_95, &b, 4, NULL); + } + } + } + + System::Void toolStripMenuItemSaveLog_Click(System::Object^ sender, System::EventArgs^ e) { + String^ path = gcnew String(MTOPTION.PATH); + String^ file = String::Format("LilithPort_{0}.log", DateTime::Now.ToString("yyMMdd-HHmmss")); + path += file; + + Monitor::Enter(richTextBoxLog); + try{ + richTextBoxLog->SaveFile(path, RichTextBoxStreamType::PlainText); + } + catch(Exception ^e){ + WriteErrorLog(e->ToString(), "SaveLog"); + } + finally{ + Monitor::Exit(richTextBoxLog); + } + + WriteMessage(String::Format("\"{0}\"‚ɃƒO‚ð•Û‘¶‚µ‚Ü‚µ‚½B\n", file), SystemMessageColor); + } + + System::Void toolStripMenuItemReplay_Click(System::Object^ sender, System::EventArgs^ e) { + ReplayFilePath = String::Empty; + StartGame(RT_PLAYBACK); + } + + System::Void toolStripMenuItemRecordReplay_Click(System::Object^ sender, System::EventArgs^ e) { + toolStripMenuItemRecordReplay->Checked ^= 1; + + MTOPTION.RECORD_REPLAY = toolStripMenuItemRecordReplay->Checked; + } + + System::Void toolStripMenuItemAllowSpectator_Click(System::Object^ sender, System::EventArgs^ e) { + toolStripMenuItemAllowSpectator->Checked ^= 1; + + MTOPTION.ALLOW_SPECTATOR = toolStripMenuItemAllowSpectator->Checked; + + if(toolStripMenuItemAllowSpectator->Checked == false && UDP != nullptr){ + array^ send = gcnew array(3){ PH_WATCH_END }; + + Monitor::Enter(InputHistory); + try{ + for(int i = 0; i < SpectatorList->Count; i++){ + Array::Copy(BitConverter::GetBytes(SpectatorList[i]->ID), 0, send, 1, 2); + UDP->BeginSend(send, send->Length, SpectatorList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + SpectatorList->Clear(); + } + finally{ + Monitor::Exit(InputHistory); + } + } + } + + // IPƒAƒhƒŒƒX‚̎擾ƒRƒ}ƒ“ƒh + System::Void GetIPToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + GetIPAddress(); + } + // ƒƒO‚̃XƒNƒ[ƒ‹‚ðŒÅ’è + System::Void LogLockToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + LogLockToolStripMenuItem->Checked ^= 1; + MTOPTION.LOG_LOCK = LogLockToolStripMenuItem->Checked; + } + // ƒƒ“ƒo[ƒŠƒXƒg‚ÌXVƒRƒ}ƒ“ƒh + System::Void ReloadListToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + ReloadList(); + } + + System::Void toolStripMenuItemAfterRest_Click(System::Object^ sender, System::EventArgs^ e) { + toolStripMenuItemAfterRest->Checked ^= 1; + MTOPTION.AFTER_REST = toolStripMenuItemAfterRest->Checked; + } + + System::Void toolStripMenuItemDelayAuto_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(0); + } + + System::Void toolStripMenuItemDelay2_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(2); + } + + System::Void toolStripMenuItemDelay3_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(3); + } + + System::Void toolStripMenuItemDelay4_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(4); + } + + System::Void toolStripMenuItemDelay5_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(5); + } + + System::Void toolStripMenuItemDelay6_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(6); + } + + System::Void toolStripMenuItemDelay7_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(7); + } + + System::Void toolStripMenuItemDelay8_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(8); + } + + System::Void toolStripMenuItemDelay9_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(9); + } + + System::Void toolStripMenuItemDelay10_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(10); + } + + System::Void toolStripMenuItemDelay11_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(11); + } + + System::Void toolStripMenuItemDelay12_Click(System::Object^ sender, System::EventArgs^ e) { + ResetDelay(12); + } + + System::Void contextMenuItemCopy_Click(System::Object^ sender, System::EventArgs^ e) { + richTextBoxLog->Copy(); + } + + System::Void richTextBoxLog_LinkClicked(System::Object^ sender, System::Windows::Forms::LinkClickedEventArgs^ e) { + // ‹­§I—¹‘Îô + try{ + Process::Start(e->LinkText); + } + catch(Exception^){ + WriteMessage("•s³‚È•¶Žš—ñƒŠƒ“ƒN‚Å‚·B\n", ErrorMessageColor); + } + } + + System::Void toolStripMenuItemVS_Click(System::Object^ sender, System::EventArgs^ e) { + if(listBoxMember->SelectedIndex == -1){ + return; + } + + if(ListView == LV_BLIND){ + RandomVersus(); + } + else if(MTOPTION.CONNECTION_TYPE == CT_FREE || listBoxMember->SelectedIndex == 0){ + StartGame(RT_FREE); + } + else{ + StartGame(RT_VS); + } + + } + + // “_–ÅŠÖ” + System::Void WindowFlash() { + // ƒEƒBƒ“ƒhƒE“_–Å + FLASHWINFO stfi; + ZeroMemory(&stfi, sizeof(FLASHWINFO)); + stfi.cbSize = sizeof(FLASHWINFO); + stfi.hwnd = reinterpret_cast(this->Handle); + stfi.dwFlags = FLASHW_ALL; + stfi.uCount = 3; + stfi.dwTimeout = 0; + FlashWindowEx(&stfi); + } + + System::Void toolStripMenuItemWatch_Click(System::Object^ sender, System::EventArgs^ e) { + if(listBoxMember->SelectedIndex == -1){ + return; + } + + int state = MemberList[0]->STATE; + array^ send = gcnew array(3); + + if(state == MS_FREE || state == MS_REST){ + // ŠÏíŠJŽn + if(state == MS_FREE) ChangeState((BYTE)MS_WATCH); + if(state == MS_REST) ChangeState((BYTE)MS_COUCH); + + WatchTarget = MemberList[listBoxMember->SelectedIndex]->IP_EP; + TargetID = MemberList[listBoxMember->SelectedIndex]->ID; + WatchFrame = 0; + + send[0] = PH_REQ_WATCH; + Array::Copy(BitConverter::GetBytes(MemberList[0]->ID), 0, send, 1, 2); + UDP->BeginSend(send, send->Length, WatchTarget, gcnew AsyncCallback(SendPackets), UDP); + + toolStripMenuItemWatch->Text = gcnew String("ŠÏí‚ð‚â‚ß‚é"); + } + else{ + QuitWatch(true); + } + } + + System::Void toolStripMenuItemPing_Click(System::Object^ sender, System::EventArgs^ e) { + if(listBoxMember->SelectedIndex == -1){ + return; + } + + int si = listBoxMember->SelectedIndex; + array^ ping = gcnew array(1){ PH_PING }; + + Ping = timeGetTime(); + UDP->BeginSend(ping, 1, MemberList[si]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + } + + // ƒLƒbƒN + System::Void toolStripMenuItemKick_Click(System::Object^ sender, System::EventArgs^ e) { + if(listBoxMember->SelectedIndex == -1 || MTOPTION.CONNECTION_TYPE != CT_SERVER){ + return; + } + + int index = listBoxMember->SelectedIndex; + int id = MemberList[index]->ID; + + if(MessageBox::Show(String::Format("[ {0} ](ID:{1})‚ðƒLƒbƒN‚µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", MemberList[index]->NAME, MemberList[index]->ID), "KICK", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + }else{ + return; + } + + try{ + // –{l‚É’Ê’m + array^ send = gcnew array(3){ PH_LOST, 0xFF, 0xFF }; + UDP->BeginSend(send, send->Length, MemberList[index]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + + if(ListView != LV_BLIND){ + WriteTime(0, SystemMessageColor); + WriteMessage(String::Format("{0}(ID:{1})‚ðƒLƒbƒN‚µ‚Ü‚µ‚½B\n", MemberList[index]->NAME, MemberList[index]->ID), SystemMessageColor); + } + if(MemberList[0]->STATE == MS_WATCH || MemberList[0]->STATE == MS_COUCH){ + if(TargetID == MemberList[index]->ID){ + QuitWatch(false); + } + } + + // ƒOƒbƒoƒC + MemberList->RemoveAt(index); + listBoxMember->Items->RemoveAt(index); + + // ‘¼‚̃ƒ“ƒo[‚É’Ê’m + array^ quit = gcnew array(3){ PH_QUIT }; + Array::Copy(BitConverter::GetBytes(id), 0, quit, 1, 2); + + for(int i = 1; i < MemberList->Count; i++){ + UDP->BeginSend(quit, quit->Length, MemberList[i]->IP_EP, gcnew AsyncCallback(SendPackets), UDP); + if(MTINFO.DEBUG){ + WriteMessage(String::Format("{0}‚É’Ê’m\n", MemberList[i]->ID), DebugMessageColor); + } + } + } + catch(Exception^ e){ + if(MTINFO.DEBUG){ + WriteMessage(String::Format("{0}\n", e->ToString()), DebugMessageColor); + } + } + + } + + System::Void contextMenuStripMember_Opening(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) { + + toolStripMenuItemKick->Enabled = false; + + if(listBoxMember->SelectedIndex == -1){ + toolStripMenuItemVS->Enabled = false; + toolStripMenuItemWatch->Enabled = false; + toolStripMenuItemPing->Enabled = false; + return; + } + + int state = MemberList[listBoxMember->SelectedIndex]->STATE; + + toolStripMenuItemVS->Enabled = false; + toolStripMenuItemWatch->Enabled = true; + toolStripMenuItemPing->Enabled = true; + + if(( ( state == MS_FREE || state == MS_SEEK) && ( MemberList[0]->STATE == MS_FREE || MemberList[0]->STATE == MS_SEEK )) || ListView == LV_BLIND){ + toolStripMenuItemVS->Enabled = true; + } + if(listBoxMember->SelectedIndex == 0){ + if(state != MS_WATCH && state != MS_COUCH){ + toolStripMenuItemWatch->Enabled = false; + } + toolStripMenuItemPing->Enabled = false; + toolStripMenuItemKick->Enabled = false; + }else if(MemberList[listBoxMember->SelectedIndex]->TYPE == CT_SERVER || MTOPTION.CONNECTION_TYPE != CT_SERVER){ + toolStripMenuItemKick->Enabled = false; + }else { + toolStripMenuItemKick->Enabled = true; + } + + } + + System::Void MainForm_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + e->Effect = DragDropEffects::None; + + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + array^ file = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false)); + String^ extension = Path::GetExtension(file[0])->ToLower(); + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(file[0]); + + if(extension == ".mtr" || (extension == ".exe" && (info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd." || info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T"))){ + e->Effect = DragDropEffects::All; + } + } + } + + System::Void MainForm_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + array^ file = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false)); + String^ extension = Path::GetExtension(file[0])->ToLower(); + + if(extension == ".mtr"){ + ReplayFilePath = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + StartGame(RT_PLAYBACK); + } + else if(extension == ".exe"){ + if(Option == nullptr || Option->IsDisposed){ + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(file[0]); + bool b2nd; + + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(file[0]); + _tcscpy_s(MTOPTION.GAME_EXE, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + // ini‚̃pƒX‚𒲂ׂé + TCHAR ini[_MAX_PATH], dir[_MAX_PATH], drive[_MAX_DRIVE]; + + _tsplitpath_s(MTOPTION.GAME_EXE, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL, 0, NULL, 0); + + if(info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd."){ + b2nd = true; + _stprintf_s(ini, _T("%s%sgame.ini"), drive, dir); + } + else{ + b2nd = false; + _stprintf_s(ini, _T("%s%s‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T.ini"), drive, dir); + } + + if(File::Exists(gcnew String(ini))){ + if(b2nd){ + MTOPTION.MAX_STAGE = GetPrivateProfileInt(_T("GamePlay"), _T("Editor.TestPlay.StageNb"), 0, ini) + 1; + MTOPTION.ROUND = GetPrivateProfileInt(_T("GamePlay"), _T("Editor.TestPlay.VSSinglePlay"), 0, ini); + MTOPTION.TIMER = GetPrivateProfileInt(_T("GamePlay"), _T("Editor.TestPlay.time"), 0, ini); + } + else{ + MTOPTION.MAX_STAGE = GetPrivateProfileInt(_T("ƒQ[ƒ€Ý’è"), _T("Editer.TestPlay.BackGroundNb"), 0, ini) + 1; + MTOPTION.ROUND = 2; + MTOPTION.TIMER = GetPrivateProfileInt(_T("ƒQ[ƒ€Ý’è"), _T("Editer.TestPlay.time"), 0, ini); + } + + MTOPTION.STAGE_SELECT = MTOPTION.MAX_STAGE == 1 ? 1 : 0; + } + + WriteMessage(String::Format("ƒvƒŒƒC‚·‚éƒQ[ƒ€‚ð\"{0}\"‚É•ÏX‚µ‚Ü‚µ‚½B\n", Path::GetFileNameWithoutExtension(file[0])), SystemMessageColor); + } + else{ + Option->SetGameExePath(file[0]); + } + } + } + } + + // ƒvƒƒtƒ@ƒCƒ‹•ÏX + System::Void toolStripDropDownItemProfile_Click(System::Object^ sender, System::EventArgs^ e) { + if(((ToolStripDropDownItem^)sender)->Text == gcnew String(MTOPTION.PROFILE)){ + return; + } + String^ buf = ((ToolStripDropDownItem^)sender)->Text; + + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(buf); + _tcscpy_s(MTOPTION.PROFILE, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + toolStripDropDownButtonProfile->Text = buf; + + LoadMTOption(); + } + System::Void toolStripMenuItemSeek_Click(System::Object^ sender, System::EventArgs^ e) { + this->SeekToolStripMenuItem_Click(nullptr, nullptr); + } + // Ž©“®‹xŒe—LŒø + System::Void toolStripMenuItemAutoRestEnable_Click(System::Object^ sender, System::EventArgs^ e) { + toolStripMenuItemAutoRestEnable->Checked ^= 1; + MTOPTION.AUTO_REST = toolStripMenuItemAutoRestEnable->Checked; + if(MTOPTION.AUTO_REST){ + if(UDP != nullptr && AutoRestThread == nullptr && MemberList[0]->STATE == MS_FREE){ + AutoRestThread = gcnew Thread(gcnew ThreadStart(this, &MainForm::RunAutoRest)); + AutoRestThread->Start(); + } + }else{ + if(AutoRestThread != nullptr && AutoRestThread->IsAlive){ + AutoRestRanging = false; + AutoRestThread->Abort(); + AutoRestThread = nullptr; + } + } + } + System::Void toolStripMenuItemAutoRestTime5_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(5); + toolStripMenuItemAutoRestTime5->Checked = 1; + } + System::Void toolStripMenuItemAutoRestTime10_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(10); + toolStripMenuItemAutoRestTime10->Checked = 1; + } + System::Void toolStripMenuItemAutoRestTime15_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(15); + toolStripMenuItemAutoRestTime15->Checked = 1; + } + System::Void toolStripMenuItemAutoRestTime20_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(20); + toolStripMenuItemAutoRestTime20->Checked = 1; + } + System::Void toolStripMenuItemAutoRestTime30_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(30); + toolStripMenuItemAutoRestTime30->Checked = 1; + } + System::Void toolStripMenuItemAutoRestTime60_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(60); + toolStripMenuItemAutoRestTime60->Checked = 1; + } + System::Void toolStripMenuItemAutoRestTime120_Click(System::Object^ sender, System::EventArgs^ e) { + SetAutoRestTime(120); + toolStripMenuItemAutoRestTime120->Checked = 1; + } + // ƒƒO‚̃eƒLƒXƒg‚ðÜ‚è•Ô‚· + System::Void toolStripMenuItemWordWrap_Click(System::Object^ sender, System::EventArgs^ e) { + ChangeLogWordWrap(); + } + }; +} diff --git a/LilithPort/MainForm.resX b/LilithPort/MainForm.resX new file mode 100644 index 0000000..a062f14 --- /dev/null +++ b/LilithPort/MainForm.resX @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 17, 17 + + + 127, 17 + + + 277, 17 + + + 439, 17 + + + 571, 17 + + + 713, 17 + + + + + AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAABtMauCNqtwMKxyMa1uK6lJDH0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB9NszU3f/Y + nv/YqP/VpP88AHR+NMKgZdp3OL9RHH8AAAAAAAAAAAAAAAAAAAAAAABzLcHyvf/ExP/Qmv/Gk/lYFJfM + mP/Wpv/Wpv+2buhCAH0AAAAAAAAAAAAAAAAAAACENbTyuP/Or/7WoP+hWd2mYeLLmf/Ekf/UpP+5dehK + A4IAAAAAAAAAAAAAAAAAAACGVqvbqf/MpP7iqP+bSMi5hf3Hlf+ZTtXSo/+vZuo9AHgAAAAAAAAmAHZG + AoFFAH83AHGBPra5rvG9fO+TRca8iP+6gfaTQ8nGjftUA44AAAAAAACEVa+vb+zQmf+7ivasfd9fF5W9 + cduUTNVBAX66gP+DNrqmau96QLoAAAAAAABsPJV2MKr8vv/cxv/uwP/wzv/Miek2AHJ8La5NCIWbT9M1 + AG2QR8s1AGoAAAAAAABHAIbCpf/rxP/qvv/ex//R0P/uuP9mGJ5CAHk+AHg9AHVqH6CXQ8iOOsFZC5QA + AABYHo7/0f/Itv7RhunZk+yxa+qfXemeVN3Wrfy+d+BSDYq8fvrSo//Xqf/Vo/9CAIRVHY320//Li/6i + j+GNO86LM7qOOb+pWdTewf/Mmf1WF5PXp//Sov/OnP/crP9WF41dGY3wzP/ktf3vwf/epP2yeveSPMan + fd734P+ZR8tHAIClX+OudvjSov/fr/9REIpHEYjqz//Zz//uv//Pyf/krv9qGKRdGIqfXdZREpLKlv+p + Y96dTsq9iP+mZuZtOKAAAACLPsXOgerIfuqQSM1UDKMAAAAAAAAAAABkIaXFhffMmv/Pnf+aTs1qLpYA + AAAAAAAAAABAAHxBAH0AAAAAAAAAAAAAAAAAAAAAAAA8AHtPD41LCIpqMZcAAAAAAAD//wAA+B8AAPgB + AAD4AAAA+AAAAPgAAADAAQAAgAMAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAIOBAADPwwAA + + + \ No newline at end of file diff --git a/LilithPort/OptionForm.cpp b/LilithPort/OptionForm.cpp new file mode 100644 index 0000000..9967dba --- /dev/null +++ b/LilithPort/OptionForm.cpp @@ -0,0 +1,222 @@ +#include "stdafx.h" +#include "OptionForm.h" +#include "MainForm.h" + +using namespace LilithPort; + +void OptionForm::SaveOption(bool apply){ + MainForm^ parent = safe_cast(this->Owner); + + try{ + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(textBoxGameExe->Text); + + if(info->FileDescription != "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd." && info->FileDescription != "‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T"){ + throw gcnew Exception; + } + } + catch(Exception^){ + textBoxGameExe->Text = gcnew String("Ši“¬ƒcƒN[ƒ‹‚ÌŽÀsƒtƒ@ƒCƒ‹‚Å‚Í‚ ‚è‚Ü‚¹‚ñ"); + } + + IntPtr mp; + // ƒpƒX + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxGameExe->Text); + _tcscpy_s(MTOPTION.GAME_EXE, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxReplayFolder->Text); + _tcscpy_s(MTOPTION.REPLAY_FOLDER, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxVSSound->Text); + _tcscpy_s(MTOPTION.VS_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxNoticeSound->Text); + _tcscpy_s(MTOPTION.NOTICE_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxEnterSound->Text); + _tcscpy_s(MTOPTION.ENTER_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxNameSound->Text); + _tcscpy_s(MTOPTION.NAME_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxTalkSound->Text); + _tcscpy_s(MTOPTION.TALK_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxSeekSound->Text); + _tcscpy_s(MTOPTION.SEEK_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxKeywordSoundPath->Text); + _tcscpy_s(MTOPTION.KEYWORD_SOUND, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxKeyword->Text); + _tcscpy_s(MTOPTION.KEYWORD, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + + MTOPTION.ENTER_SOUND_ENABLE = checkBoxEnterSound->Checked; + MTOPTION.VS_SOUND_ENABLE = checkBoxVSSound->Checked; + MTOPTION.NOTICE_SOUND_ENABLE = checkBoxNoticeSound->Checked; + MTOPTION.NAME_SOUND_ENABLE = checkBoxNameSound->Checked; + MTOPTION.TALK_SOUND_ENABLE = checkBoxTalkSound->Checked; + MTOPTION.SEEK_SOUND_ENABLE = checkBoxSeekSound->Checked; + MTOPTION.KEYWORD_SOUND_ENABLE = checkBoxKeywordSound->Checked; + + MTOPTION.GET_IP_ENABLE = checkBoxGetIP->Checked; + MTOPTION.SHOW_GAME_OPTION = checkBoxShowGameOption->Checked; + MTOPTION.SHOW_RESULT = checkBoxShowResult->Checked; + + // ƒRƒƒ“ƒg + if(textBoxComment->Text != gcnew String(MTOPTION.COMMENT)){ + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxComment->Text); + _tcscpy_s(MTOPTION.COMMENT, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + parent->ChangeComment(textBoxComment->Text); + } + + // ƒQ[ƒ€ + MTOPTION.MAX_STAGE = (UINT)numericUpDownMaxStage->Value; + MTOPTION.STAGE_SELECT = (UINT)numericUpDownStageSelect->Value; + MTOPTION.ROUND = (UINT)numericUpDownRound->Value; + MTOPTION.TIMER = (UINT)numericUpDownTimer->Value; + MTOPTION.SIMULATE_DELAY = (UINT)numericUpDownSimDelay->Value; + + MTOPTION.TEAM_ROUND_HP = checkBoxTeamRoundHP->Checked; + MTOPTION.DISPLAY_NAME = checkBoxName->Checked; + MTOPTION.DISPLAY_VERSUS = checkBoxVersus->Checked; + MTOPTION.DISPLAY_FRAMERATE = checkBoxFramerate->Checked; + MTOPTION.DISPLAY_RAND = checkBoxRand->Checked; + + MTOPTION.REPLAY_DIVIDE = checkBoxDivide->Checked; + MTOPTION.CHANGE_WINDOW_SIZE = checkBoxWindowSize->Checked; + + MTOPTION.MAX_CONNECTION = (UINT)numericUpDownMaxConnection->Value; + MTOPTION.BGM_VOLUME = (UINT)trackBarBGM->Value * 5; + MTOPTION.SE_VOLUME = (UINT)trackBarSE->Value * 5; + + if(radioButtonReplayVersion2->Checked){ + MTOPTION.REPLAY_VERSION = 2; + } + else{ + MTOPTION.REPLAY_VERSION = 1; + } + + // “–‚½‚è”»’è + if(MTOPTION.HIT_JUDGE != checkBoxHitJudge->Checked){ + MTOPTION.HIT_JUDGE = checkBoxHitJudge->Checked; + + // ƒQ[ƒ€‹N“®’†‚Ȃ瑦Žž•ÏX + if(MTINFO.INITIALIZED && MTINFO.PROCESS != NULL){ + DWORD b = MTOPTION.HIT_JUDGE; + + if(MTINFO.KGT2K){ + WriteProcessMemory(MTINFO.PROCESS, (LPVOID)HIT_JUDGE, &b, 4, NULL); + } + else{ + WriteProcessMemory(MTINFO.PROCESS, (LPVOID)HIT_JUDGE_95, &b, 4, NULL); + } + } + } + + // Ú×Ý’è + // ”­Œ¾‚ŃEƒBƒ“ƒhƒE‚ð“_–Å + MTOPTION.TALK_FLASH = checkBoxTalkFlash->Checked; + // –¼‘O‚ªŒÄ‚΂ꂽ‚çƒEƒBƒ“ƒhƒE‚ð“_–Å + MTOPTION.NAME_FLASH = checkBoxNameFlash->Checked; + + //@F + MTCOLOR.SERVER_NAME = buttonServerName->ForeColor.ToArgb(); + MTCOLOR.HOST_NAME = buttonHostName->ForeColor.ToArgb(); + MTCOLOR.CLIENT_NAME = buttonClientName->ForeColor.ToArgb(); + MTCOLOR.REST_STATE = buttonRestState->BackColor.ToArgb(); + MTCOLOR.VS_STATE = buttonVSState->BackColor.ToArgb(); + MTCOLOR.WATCH_STATE = buttonWatchState->BackColor.ToArgb(); + MTCOLOR.SEEK_STATE = buttonSeekState->BackColor.ToArgb(); + + MTCOLOR.SYSTEM_MESSAGE = buttonSystemMessage->ForeColor.ToArgb(); + MTCOLOR.ERROR_MESSAGE = buttonErrorMessage->ForeColor.ToArgb(); + MTCOLOR.DEBUG_MESSAGE = buttonDebugMessage->ForeColor.ToArgb(); + MTCOLOR.NOTICE_BACK = buttonNoticeBack->BackColor.ToArgb(); + MTCOLOR.COMMENT_BACK = buttonCommentBack->BackColor.ToArgb(); + MTCOLOR.SECRET = buttonSecret->ForeColor.ToArgb(); + + // F‚𔽉f‚³‚¹‚é + parent->ResetColor(); + + // ’l‚̃`ƒFƒbƒN + CheckMTOption(); + + if(apply){ + textBoxGameExe->Text = gcnew String(MTOPTION.GAME_EXE); + textBoxReplayFolder->Text = gcnew String(MTOPTION.REPLAY_FOLDER); + textBoxVSSound->Text = gcnew String(MTOPTION.VS_SOUND); + textBoxNoticeSound->Text = gcnew String(MTOPTION.NOTICE_SOUND); + textBoxEnterSound->Text = gcnew String(MTOPTION.ENTER_SOUND); + textBoxNameSound->Text = gcnew String(MTOPTION.NAME_SOUND); + textBoxTalkSound->Text = gcnew String(MTOPTION.TALK_SOUND); + textBoxSeekSound->Text = gcnew String(MTOPTION.SEEK_SOUND); + textBoxKeywordSoundPath->Text = gcnew String(MTOPTION.KEYWORD_SOUND); + } + + SaveMTOption(); +} +void OptionForm::CloseOption(){ + MainForm^ parent = safe_cast(this->Owner); + parent->ChangeProfileEnabled(); +} +bool OptionForm::CheckTextProfileName(String^ buf){ + // ƒvƒƒtƒ@ƒCƒ‹–¼ƒoƒŠƒf[ƒVƒ‡ƒ“ + String^ mes; + if(buf == gcnew String(MTOPTION.PROFILE)){ + return true; + } + if(buf->Length == 0){ + mes = "ƒvƒƒtƒ@ƒCƒ‹–¼‚ª‹ó—“‚Å‚·B"; + } + if(buf->Contains(",") || buf->Contains("[") || buf->Contains("]")){ + mes = "ƒvƒƒtƒ@ƒCƒ‹–¼‚ÉŽg—p‚Å‚«‚È‚¢•¶Žši, [ ]j‚ªŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚·B"; + } + for(int i=0; i < Profile::SystemSection->Length; i++){ + if(buf == Profile::SystemSection[i]){ + mes = "‚»‚̃vƒƒtƒ@ƒCƒ‹–¼‚ÍŽg—p‚Å‚«‚Ü‚¹‚ñB"; + } + } + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(buf == Profile::ProfileList[i]){ + mes = "‚»‚̃vƒƒtƒ@ƒCƒ‹–¼‚ÍŠù‚É‘¶Ý‚µ‚Ü‚·B"; + } + } + if(mes != nullptr){ + MessageBox::Show(mes, "ƒvƒƒtƒ@ƒCƒ‹•Û‘¶", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return true; + } + return false; +} +void OptionForm::DeleteProfile(String^ buf){ + // ƒvƒƒtƒ@ƒCƒ‹íœ + TCHAR bufProfile[MAX_ARRAY]; + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(buf); + _tcscpy_s(bufProfile, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + DeleteSection(bufProfile); + SaveProfileOption(); +} +void OptionForm::OverWriteProfile(String^ buf){ + // ã‘‚«•Û‘¶ + DeleteSection(MTOPTION.PROFILE); + + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(buf); + _tcscpy_s(MTOPTION.PROFILE, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + SaveMTOption(); +} \ No newline at end of file diff --git a/LilithPort/OptionForm.h b/LilithPort/OptionForm.h new file mode 100644 index 0000000..f18bfd5 --- /dev/null +++ b/LilithPort/OptionForm.h @@ -0,0 +1,2799 @@ +#pragma once + +#include "stdafx.h" + +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 System::IO; +using namespace System::Diagnostics; + +namespace LilithPort { + + /// + /// OptionForm ‚ÌŠT—v + /// + /// Œx: ‚±‚̃Nƒ‰ƒX‚Ì–¼‘O‚ð•ÏX‚·‚éê‡A‚±‚̃Nƒ‰ƒX‚ªˆË‘¶‚·‚é‚·‚×‚Ä‚Ì .resx ƒtƒ@ƒCƒ‹‚ÉŠÖ˜A•t‚¯‚ç‚ꂽ + /// ƒ}ƒl[ƒW ƒŠƒ\[ƒX ƒRƒ“ƒpƒCƒ‰ ƒc[ƒ‹‚ɑ΂µ‚Ä 'Resource File Name' ƒvƒƒpƒeƒB‚ð + /// •ÏX‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B‚±‚Ì•ÏX‚ðs‚í‚È‚¢‚ÆA + /// ƒfƒUƒCƒi‚ÆA‚±‚̃tƒH[ƒ€‚ÉŠÖ˜A•t‚¯‚ç‚ꂽƒ[ƒJƒ‰ƒCƒYς݃Šƒ\[ƒX‚Æ‚ªA + /// ³‚µ‚­‘ŠŒÝ‚É—˜—p‚Å‚«‚È‚­‚È‚è‚Ü‚·B + /// + public ref class OptionForm : public System::Windows::Forms::Form + { + public: + OptionForm(void) + { + InitializeComponent(); + // + //TODO: ‚±‚±‚ɃRƒ“ƒXƒgƒ‰ƒNƒ^ ƒR[ƒh‚ð’ljÁ‚µ‚Ü‚· + // + } + + protected: + /// + /// Žg—p’†‚̃Šƒ\[ƒX‚ð‚·‚×‚ÄƒNƒŠ[ƒ“ƒAƒbƒv‚µ‚Ü‚·B + /// + ~OptionForm() + { + if (components) + { + delete components; + } + } + private: System::Windows::Forms::Button^ buttonOK; + private: System::Windows::Forms::Button^ buttonApply; + private: System::Windows::Forms::Button^ buttonCancel; + + private: System::Windows::Forms::OpenFileDialog^ openFileDialog1; + private: System::Windows::Forms::FolderBrowserDialog^ folderBrowserDialog1; + + private: System::Windows::Forms::ColorDialog^ colorDialog1; + private: System::Windows::Forms::TabPage^ tabPageSound; + private: System::Windows::Forms::TabPage^ tabPagePath; + private: System::Windows::Forms::TextBox^ textBoxGameExe; + private: System::Windows::Forms::Button^ buttonReplayFolder; + private: System::Windows::Forms::Button^ buttonGameExe; + private: System::Windows::Forms::TextBox^ textBoxReplayFolder; + private: System::Windows::Forms::TextBox^ textBoxVSSound; + private: System::Windows::Forms::Button^ buttonNoticeSound; + private: System::Windows::Forms::Button^ buttonVSSound; + private: System::Windows::Forms::TextBox^ textBoxNoticeSound; + private: System::Windows::Forms::TabControl^ tabControlOption; + private: System::Windows::Forms::TabPage^ tabPageGame; + + + + + + private: System::Windows::Forms::GroupBox^ groupBoxRun; + private: System::Windows::Forms::CheckBox^ checkBoxWindowSize; + private: System::Windows::Forms::CheckBox^ checkBoxHitJudge; + private: System::Windows::Forms::GroupBox^ groupBoxNet; + private: System::Windows::Forms::NumericUpDown^ numericUpDownMaxConnection; + private: System::Windows::Forms::Label^ label5; + private: System::Windows::Forms::GroupBox^ groupBoxView; + private: System::Windows::Forms::CheckBox^ checkBoxVersus; + private: System::Windows::Forms::CheckBox^ checkBoxName; + private: System::Windows::Forms::CheckBox^ checkBoxFramerate; + private: System::Windows::Forms::CheckBox^ checkBoxRand; + private: System::Windows::Forms::GroupBox^ groupBoxSetting; + + private: System::Windows::Forms::NumericUpDown^ numericUpDownMaxStage; + private: System::Windows::Forms::Label^ labelMaxStage; + private: System::Windows::Forms::Label^ labelStageSelect; + + private: System::Windows::Forms::NumericUpDown^ numericUpDownStageSelect; + + private: System::Windows::Forms::CheckBox^ checkBoxDivide; + private: System::Windows::Forms::RadioButton^ radioButtonReplayVersion2; + private: System::Windows::Forms::RadioButton^ radioButtonReplayVersion1; + private: System::Windows::Forms::TabPage^ tabPageColor; + private: System::Windows::Forms::GroupBox^ groupBoxMessageColor; + private: System::Windows::Forms::Button^ buttonDebugMessage; + private: System::Windows::Forms::Button^ buttonErrorMessage; + private: System::Windows::Forms::Button^ buttonSystemMessage; + private: System::Windows::Forms::GroupBox^ groupBoxOthersColor; + private: System::Windows::Forms::Button^ buttonSecret; + private: System::Windows::Forms::Button^ buttonCommentBack; + private: System::Windows::Forms::Button^ buttonNoticeBack; + private: System::Windows::Forms::GroupBox^ groupBoxStateColor; + private: System::Windows::Forms::Button^ buttonWatchState; + private: System::Windows::Forms::Button^ buttonVSState; + private: System::Windows::Forms::Button^ buttonRestState; + private: System::Windows::Forms::Button^ buttonSeekState; + private: System::Windows::Forms::GroupBox^ groupBoxNameColor; + private: System::Windows::Forms::Button^ buttonClientName; + private: System::Windows::Forms::Button^ buttonHostName; + private: System::Windows::Forms::Button^ buttonServerName; + private: System::Windows::Forms::GroupBox^ groupBoxNoticeSound; + private: System::Windows::Forms::GroupBox^ groupBoxVSSound; + private: System::Windows::Forms::GroupBox^ groupBoxEnterSound; + private: System::Windows::Forms::TextBox^ textBoxEnterSound; + private: System::Windows::Forms::Button^ buttonEnterSound; + private: System::Windows::Forms::GroupBox^ groupBoxReplayFolder; + private: System::Windows::Forms::GroupBox^ groupBoxGameExe; + private: System::Windows::Forms::GroupBox^ groupBoxSimulate; + private: System::Windows::Forms::NumericUpDown^ numericUpDownSimDelay; + private: System::Windows::Forms::Label^ labelSimDelay; + + + private: System::Windows::Forms::TextBox^ textBoxComment; + private: System::Windows::Forms::Label^ labelComment; + private: System::Windows::Forms::GroupBox^ groupBoxSave; + private: System::Windows::Forms::NumericUpDown^ numericUpDownRound; + private: System::Windows::Forms::Label^ labelRound; + private: System::Windows::Forms::Label^ labelTimer; + private: System::Windows::Forms::NumericUpDown^ numericUpDownTimer; + + private: System::Windows::Forms::TabPage^ tabPageVolume; + private: System::Windows::Forms::GroupBox^ groupBoxSE; + private: System::Windows::Forms::Label^ labelSE; + private: System::Windows::Forms::TrackBar^ trackBarSE; + private: System::Windows::Forms::GroupBox^ groupBoxBGM; + private: System::Windows::Forms::Label^ labelBGM; + private: System::Windows::Forms::TrackBar^ trackBarBGM; + private: System::Windows::Forms::GroupBox^ groupBoxMidi; + private: System::Windows::Forms::Label^ labelMidi; + private: System::Windows::Forms::TrackBar^ trackBarMidi; +private: System::Windows::Forms::TabPage^ tabPageIP; +private: System::Windows::Forms::GroupBox^ Base64groupBox; +private: System::Windows::Forms::TextBox^ Base64textBox; + +private: System::Windows::Forms::GroupBox^ IPgroupBox; +private: System::Windows::Forms::Button^ Convertbutton; +private: System::Windows::Forms::TextBox^ IPtextBox; +private: System::Windows::Forms::Label^ discriptionlabel; +private: System::Windows::Forms::Button^ AddPortbutton; +private: System::Windows::Forms::GroupBox^ groupBoxName; +private: System::Windows::Forms::Button^ buttonNameSound; + + + +private: System::Windows::Forms::TextBox^ textBoxNameSound; +private: System::Windows::Forms::TabPage^ tabPageDetails; +private: System::Windows::Forms::GroupBox^ groupBoxDetails; +private: System::Windows::Forms::CheckBox^ checkBoxTalkFlash; + +private: System::Windows::Forms::CheckBox^ checkBoxNameFlash; +private: System::Windows::Forms::GroupBox^ groupBoxTalkSound; +private: System::Windows::Forms::CheckBox^ checkBoxNameSound; +private: System::Windows::Forms::CheckBox^ checkBoxEnterSound; +private: System::Windows::Forms::CheckBox^ checkBoxNoticeSound; +private: System::Windows::Forms::CheckBox^ checkBoxVSSound; +private: System::Windows::Forms::CheckBox^ checkBoxTalkSound; +private: System::Windows::Forms::Button^ buttonTalkSound; +private: System::Windows::Forms::TextBox^ textBoxTalkSound; +private: System::Windows::Forms::CheckBox^ checkBoxGetIP; +private: System::Windows::Forms::Button^ buttonNoticeSoundPlay; + +private: System::Windows::Forms::Button^ buttonVSSoundPlay; +private: System::Windows::Forms::Button^ buttonEnterSoundPlay; +private: System::Windows::Forms::Button^ buttonTalkSoundPlay; +private: System::Windows::Forms::Button^ buttonNameSoundPlay; +private: System::Windows::Forms::GroupBox^ groupBoxSeekSound; +private: System::Windows::Forms::Button^ buttonSeekSound; + +private: System::Windows::Forms::TextBox^ textBoxSeekSound; +private: System::Windows::Forms::Button^ buttonSeekSoundPlay; +private: System::Windows::Forms::CheckBox^ checkBoxSeekSound; +private: System::Windows::Forms::GroupBox^ groupBoxKeywordSound; +private: System::Windows::Forms::TextBox^ textBoxKeywordSoundPath; + +private: System::Windows::Forms::Label^ labelKeywordSound; +private: System::Windows::Forms::TextBox^ textBoxKeyword; + +private: System::Windows::Forms::Button^ buttonKeywordSound; +private: System::Windows::Forms::Button^ buttonKeywordSoundPlay; +private: System::Windows::Forms::CheckBox^ checkBoxKeywordSound; +private: System::Windows::Forms::GroupBox^ groupBoxTeamOption; +private: System::Windows::Forms::CheckBox^ checkBoxTeamRoundHP; +private: System::Windows::Forms::Label^ labelTeamRoundHP; +private: System::Windows::Forms::CheckBox^ checkBoxShowGameOption; +private: System::Windows::Forms::GroupBox^ groupBoxProfile; +private: System::Windows::Forms::ComboBox^ comboBoxProfile; +private: System::Windows::Forms::Button^ buttonCopyProfile; +private: System::Windows::Forms::Button^ buttonDeleteProfile; +private: System::Windows::Forms::TextBox^ textBoxProfileName; + +private: System::Windows::Forms::Button^ buttonAddProfile; +private: System::Windows::Forms::Label^ labelProfileName; +private: System::Windows::Forms::Button^ buttonSaveProfile; +private: System::Windows::Forms::TextBox^ textBoxMTAddr; + +private: System::Windows::Forms::Label^ labelAddrBase64; +private: System::Windows::Forms::Label^ labelAddrMT; +private: System::Windows::Forms::CheckBox^ checkBoxShowResult; + + + + + private: + /// + /// •K—v‚ȃfƒUƒCƒi•Ï”‚Å‚·B + /// + System::ComponentModel::Container ^components; + +#pragma region Windows Form Designer generated code + /// + /// ƒfƒUƒCƒi ƒTƒ|[ƒg‚É•K—v‚ȃƒ\ƒbƒh‚Å‚·B‚±‚̃ƒ\ƒbƒh‚Ì“à—e‚ð + /// ƒR[ƒh ƒGƒfƒBƒ^‚Å•ÏX‚µ‚È‚¢‚Å‚­‚¾‚³‚¢B + /// + void InitializeComponent(void) + { + System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(OptionForm::typeid)); + this->buttonOK = (gcnew System::Windows::Forms::Button()); + this->buttonApply = (gcnew System::Windows::Forms::Button()); + this->buttonCancel = (gcnew System::Windows::Forms::Button()); + this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog()); + this->folderBrowserDialog1 = (gcnew System::Windows::Forms::FolderBrowserDialog()); + this->colorDialog1 = (gcnew System::Windows::Forms::ColorDialog()); + this->tabPageSound = (gcnew System::Windows::Forms::TabPage()); + this->groupBoxKeywordSound = (gcnew System::Windows::Forms::GroupBox()); + this->buttonKeywordSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxKeywordSound = (gcnew System::Windows::Forms::CheckBox()); + this->buttonKeywordSound = (gcnew System::Windows::Forms::Button()); + this->textBoxKeywordSoundPath = (gcnew System::Windows::Forms::TextBox()); + this->labelKeywordSound = (gcnew System::Windows::Forms::Label()); + this->textBoxKeyword = (gcnew System::Windows::Forms::TextBox()); + this->groupBoxSeekSound = (gcnew System::Windows::Forms::GroupBox()); + this->buttonSeekSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxSeekSound = (gcnew System::Windows::Forms::CheckBox()); + this->buttonSeekSound = (gcnew System::Windows::Forms::Button()); + this->textBoxSeekSound = (gcnew System::Windows::Forms::TextBox()); + this->groupBoxTalkSound = (gcnew System::Windows::Forms::GroupBox()); + this->buttonTalkSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxTalkSound = (gcnew System::Windows::Forms::CheckBox()); + this->buttonTalkSound = (gcnew System::Windows::Forms::Button()); + this->textBoxTalkSound = (gcnew System::Windows::Forms::TextBox()); + this->groupBoxName = (gcnew System::Windows::Forms::GroupBox()); + this->buttonNameSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxNameSound = (gcnew System::Windows::Forms::CheckBox()); + this->buttonNameSound = (gcnew System::Windows::Forms::Button()); + this->textBoxNameSound = (gcnew System::Windows::Forms::TextBox()); + this->groupBoxEnterSound = (gcnew System::Windows::Forms::GroupBox()); + this->buttonEnterSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxEnterSound = (gcnew System::Windows::Forms::CheckBox()); + this->textBoxEnterSound = (gcnew System::Windows::Forms::TextBox()); + this->buttonEnterSound = (gcnew System::Windows::Forms::Button()); + this->groupBoxNoticeSound = (gcnew System::Windows::Forms::GroupBox()); + this->buttonNoticeSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxNoticeSound = (gcnew System::Windows::Forms::CheckBox()); + this->textBoxNoticeSound = (gcnew System::Windows::Forms::TextBox()); + this->buttonNoticeSound = (gcnew System::Windows::Forms::Button()); + this->groupBoxVSSound = (gcnew System::Windows::Forms::GroupBox()); + this->buttonVSSoundPlay = (gcnew System::Windows::Forms::Button()); + this->checkBoxVSSound = (gcnew System::Windows::Forms::CheckBox()); + this->textBoxVSSound = (gcnew System::Windows::Forms::TextBox()); + this->buttonVSSound = (gcnew System::Windows::Forms::Button()); + this->tabPagePath = (gcnew System::Windows::Forms::TabPage()); + this->groupBoxProfile = (gcnew System::Windows::Forms::GroupBox()); + this->buttonSaveProfile = (gcnew System::Windows::Forms::Button()); + this->buttonAddProfile = (gcnew System::Windows::Forms::Button()); + this->labelProfileName = (gcnew System::Windows::Forms::Label()); + this->buttonDeleteProfile = (gcnew System::Windows::Forms::Button()); + this->textBoxProfileName = (gcnew System::Windows::Forms::TextBox()); + this->buttonCopyProfile = (gcnew System::Windows::Forms::Button()); + this->comboBoxProfile = (gcnew System::Windows::Forms::ComboBox()); + this->groupBoxReplayFolder = (gcnew System::Windows::Forms::GroupBox()); + this->textBoxReplayFolder = (gcnew System::Windows::Forms::TextBox()); + this->buttonReplayFolder = (gcnew System::Windows::Forms::Button()); + this->checkBoxDivide = (gcnew System::Windows::Forms::CheckBox()); + this->groupBoxNet = (gcnew System::Windows::Forms::GroupBox()); + this->labelComment = (gcnew System::Windows::Forms::Label()); + this->numericUpDownMaxConnection = (gcnew System::Windows::Forms::NumericUpDown()); + this->textBoxComment = (gcnew System::Windows::Forms::TextBox()); + this->label5 = (gcnew System::Windows::Forms::Label()); + this->groupBoxGameExe = (gcnew System::Windows::Forms::GroupBox()); + this->textBoxGameExe = (gcnew System::Windows::Forms::TextBox()); + this->buttonGameExe = (gcnew System::Windows::Forms::Button()); + this->groupBoxSave = (gcnew System::Windows::Forms::GroupBox()); + this->radioButtonReplayVersion1 = (gcnew System::Windows::Forms::RadioButton()); + this->radioButtonReplayVersion2 = (gcnew System::Windows::Forms::RadioButton()); + this->tabControlOption = (gcnew System::Windows::Forms::TabControl()); + this->tabPageGame = (gcnew System::Windows::Forms::TabPage()); + this->groupBoxTeamOption = (gcnew System::Windows::Forms::GroupBox()); + this->labelTeamRoundHP = (gcnew System::Windows::Forms::Label()); + this->checkBoxTeamRoundHP = (gcnew System::Windows::Forms::CheckBox()); + this->groupBoxSimulate = (gcnew System::Windows::Forms::GroupBox()); + this->numericUpDownSimDelay = (gcnew System::Windows::Forms::NumericUpDown()); + this->labelSimDelay = (gcnew System::Windows::Forms::Label()); + this->groupBoxRun = (gcnew System::Windows::Forms::GroupBox()); + this->checkBoxWindowSize = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxHitJudge = (gcnew System::Windows::Forms::CheckBox()); + this->groupBoxView = (gcnew System::Windows::Forms::GroupBox()); + this->checkBoxVersus = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxName = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxFramerate = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxRand = (gcnew System::Windows::Forms::CheckBox()); + this->groupBoxSetting = (gcnew System::Windows::Forms::GroupBox()); + this->numericUpDownRound = (gcnew System::Windows::Forms::NumericUpDown()); + this->labelRound = (gcnew System::Windows::Forms::Label()); + this->labelTimer = (gcnew System::Windows::Forms::Label()); + this->numericUpDownTimer = (gcnew System::Windows::Forms::NumericUpDown()); + this->numericUpDownMaxStage = (gcnew System::Windows::Forms::NumericUpDown()); + this->labelMaxStage = (gcnew System::Windows::Forms::Label()); + this->labelStageSelect = (gcnew System::Windows::Forms::Label()); + this->numericUpDownStageSelect = (gcnew System::Windows::Forms::NumericUpDown()); + this->tabPageColor = (gcnew System::Windows::Forms::TabPage()); + this->groupBoxMessageColor = (gcnew System::Windows::Forms::GroupBox()); + this->buttonDebugMessage = (gcnew System::Windows::Forms::Button()); + this->buttonErrorMessage = (gcnew System::Windows::Forms::Button()); + this->buttonSystemMessage = (gcnew System::Windows::Forms::Button()); + this->groupBoxOthersColor = (gcnew System::Windows::Forms::GroupBox()); + this->buttonSecret = (gcnew System::Windows::Forms::Button()); + this->buttonCommentBack = (gcnew System::Windows::Forms::Button()); + this->buttonNoticeBack = (gcnew System::Windows::Forms::Button()); + this->groupBoxStateColor = (gcnew System::Windows::Forms::GroupBox()); + this->buttonSeekState = (gcnew System::Windows::Forms::Button()); + this->buttonWatchState = (gcnew System::Windows::Forms::Button()); + this->buttonVSState = (gcnew System::Windows::Forms::Button()); + this->buttonRestState = (gcnew System::Windows::Forms::Button()); + this->groupBoxNameColor = (gcnew System::Windows::Forms::GroupBox()); + this->buttonClientName = (gcnew System::Windows::Forms::Button()); + this->buttonHostName = (gcnew System::Windows::Forms::Button()); + this->buttonServerName = (gcnew System::Windows::Forms::Button()); + this->tabPageVolume = (gcnew System::Windows::Forms::TabPage()); + this->groupBoxMidi = (gcnew System::Windows::Forms::GroupBox()); + this->labelMidi = (gcnew System::Windows::Forms::Label()); + this->trackBarMidi = (gcnew System::Windows::Forms::TrackBar()); + this->groupBoxSE = (gcnew System::Windows::Forms::GroupBox()); + this->labelSE = (gcnew System::Windows::Forms::Label()); + this->trackBarSE = (gcnew System::Windows::Forms::TrackBar()); + this->groupBoxBGM = (gcnew System::Windows::Forms::GroupBox()); + this->labelBGM = (gcnew System::Windows::Forms::Label()); + this->trackBarBGM = (gcnew System::Windows::Forms::TrackBar()); + this->tabPageIP = (gcnew System::Windows::Forms::TabPage()); + this->AddPortbutton = (gcnew System::Windows::Forms::Button()); + this->discriptionlabel = (gcnew System::Windows::Forms::Label()); + this->Convertbutton = (gcnew System::Windows::Forms::Button()); + this->Base64groupBox = (gcnew System::Windows::Forms::GroupBox()); + this->labelAddrMT = (gcnew System::Windows::Forms::Label()); + this->textBoxMTAddr = (gcnew System::Windows::Forms::TextBox()); + this->labelAddrBase64 = (gcnew System::Windows::Forms::Label()); + this->Base64textBox = (gcnew System::Windows::Forms::TextBox()); + this->IPgroupBox = (gcnew System::Windows::Forms::GroupBox()); + this->IPtextBox = (gcnew System::Windows::Forms::TextBox()); + this->tabPageDetails = (gcnew System::Windows::Forms::TabPage()); + this->groupBoxDetails = (gcnew System::Windows::Forms::GroupBox()); + this->checkBoxShowGameOption = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxNameFlash = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxGetIP = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxTalkFlash = (gcnew System::Windows::Forms::CheckBox()); + this->checkBoxShowResult = (gcnew System::Windows::Forms::CheckBox()); + this->tabPageSound->SuspendLayout(); + this->groupBoxKeywordSound->SuspendLayout(); + this->groupBoxSeekSound->SuspendLayout(); + this->groupBoxTalkSound->SuspendLayout(); + this->groupBoxName->SuspendLayout(); + this->groupBoxEnterSound->SuspendLayout(); + this->groupBoxNoticeSound->SuspendLayout(); + this->groupBoxVSSound->SuspendLayout(); + this->tabPagePath->SuspendLayout(); + this->groupBoxProfile->SuspendLayout(); + this->groupBoxReplayFolder->SuspendLayout(); + this->groupBoxNet->SuspendLayout(); + (cli::safe_cast(this->numericUpDownMaxConnection))->BeginInit(); + this->groupBoxGameExe->SuspendLayout(); + this->groupBoxSave->SuspendLayout(); + this->tabControlOption->SuspendLayout(); + this->tabPageGame->SuspendLayout(); + this->groupBoxTeamOption->SuspendLayout(); + this->groupBoxSimulate->SuspendLayout(); + (cli::safe_cast(this->numericUpDownSimDelay))->BeginInit(); + this->groupBoxRun->SuspendLayout(); + this->groupBoxView->SuspendLayout(); + this->groupBoxSetting->SuspendLayout(); + (cli::safe_cast(this->numericUpDownRound))->BeginInit(); + (cli::safe_cast(this->numericUpDownTimer))->BeginInit(); + (cli::safe_cast(this->numericUpDownMaxStage))->BeginInit(); + (cli::safe_cast(this->numericUpDownStageSelect))->BeginInit(); + this->tabPageColor->SuspendLayout(); + this->groupBoxMessageColor->SuspendLayout(); + this->groupBoxOthersColor->SuspendLayout(); + this->groupBoxStateColor->SuspendLayout(); + this->groupBoxNameColor->SuspendLayout(); + this->tabPageVolume->SuspendLayout(); + this->groupBoxMidi->SuspendLayout(); + (cli::safe_cast(this->trackBarMidi))->BeginInit(); + this->groupBoxSE->SuspendLayout(); + (cli::safe_cast(this->trackBarSE))->BeginInit(); + this->groupBoxBGM->SuspendLayout(); + (cli::safe_cast(this->trackBarBGM))->BeginInit(); + this->tabPageIP->SuspendLayout(); + this->Base64groupBox->SuspendLayout(); + this->IPgroupBox->SuspendLayout(); + this->tabPageDetails->SuspendLayout(); + this->groupBoxDetails->SuspendLayout(); + this->SuspendLayout(); + // + // buttonOK + // + this->buttonOK->Location = System::Drawing::Point(160, 327); + this->buttonOK->Name = L"buttonOK"; + this->buttonOK->Size = System::Drawing::Size(64, 24); + this->buttonOK->TabIndex = 7; + this->buttonOK->Text = L"OK"; + this->buttonOK->UseVisualStyleBackColor = true; + this->buttonOK->Click += gcnew System::EventHandler(this, &OptionForm::buttonOK_Click); + // + // buttonApply + // + this->buttonApply->Location = System::Drawing::Point(230, 327); + this->buttonApply->Name = L"buttonApply"; + this->buttonApply->Size = System::Drawing::Size(64, 24); + this->buttonApply->TabIndex = 8; + this->buttonApply->Text = L"“K—p"; + this->buttonApply->UseVisualStyleBackColor = true; + this->buttonApply->Click += gcnew System::EventHandler(this, &OptionForm::buttonApply_Click); + // + // buttonCancel + // + this->buttonCancel->Location = System::Drawing::Point(300, 327); + this->buttonCancel->Name = L"buttonCancel"; + this->buttonCancel->Size = System::Drawing::Size(64, 24); + this->buttonCancel->TabIndex = 9; + this->buttonCancel->Text = L"ƒLƒƒƒ“ƒZƒ‹"; + this->buttonCancel->UseVisualStyleBackColor = true; + this->buttonCancel->Click += gcnew System::EventHandler(this, &OptionForm::buttonCancel_Click); + // + // folderBrowserDialog1 + // + this->folderBrowserDialog1->Description = L"ƒŠƒvƒŒƒC•Û‘¶ƒtƒHƒ‹ƒ_"; + // + // colorDialog1 + // + this->colorDialog1->FullOpen = true; + // + // tabPageSound + // + this->tabPageSound->AutoScroll = true; + this->tabPageSound->AutoScrollMinSize = System::Drawing::Size(0, 460); + this->tabPageSound->Controls->Add(this->groupBoxKeywordSound); + this->tabPageSound->Controls->Add(this->groupBoxSeekSound); + this->tabPageSound->Controls->Add(this->groupBoxTalkSound); + this->tabPageSound->Controls->Add(this->groupBoxName); + this->tabPageSound->Controls->Add(this->groupBoxEnterSound); + this->tabPageSound->Controls->Add(this->groupBoxNoticeSound); + this->tabPageSound->Controls->Add(this->groupBoxVSSound); + this->tabPageSound->Location = System::Drawing::Point(4, 22); + this->tabPageSound->Name = L"tabPageSound"; + this->tabPageSound->Padding = System::Windows::Forms::Padding(3); + this->tabPageSound->Size = System::Drawing::Size(369, 295); + this->tabPageSound->TabIndex = 3; + this->tabPageSound->Text = L"‰¹º"; + this->tabPageSound->UseVisualStyleBackColor = true; + // + // groupBoxKeywordSound + // + this->groupBoxKeywordSound->Controls->Add(this->buttonKeywordSoundPlay); + this->groupBoxKeywordSound->Controls->Add(this->checkBoxKeywordSound); + this->groupBoxKeywordSound->Controls->Add(this->buttonKeywordSound); + this->groupBoxKeywordSound->Controls->Add(this->textBoxKeywordSoundPath); + this->groupBoxKeywordSound->Controls->Add(this->labelKeywordSound); + this->groupBoxKeywordSound->Controls->Add(this->textBoxKeyword); + this->groupBoxKeywordSound->Location = System::Drawing::Point(9, 346); + this->groupBoxKeywordSound->Name = L"groupBoxKeywordSound"; + this->groupBoxKeywordSound->Size = System::Drawing::Size(335, 96); + this->groupBoxKeywordSound->TabIndex = 7; + this->groupBoxKeywordSound->TabStop = false; + this->groupBoxKeywordSound->Text = L"ƒL[ƒ[ƒh‚ÅĶ"; + // + // buttonKeywordSoundPlay + // + this->buttonKeywordSoundPlay->Location = System::Drawing::Point(260, 62); + this->buttonKeywordSoundPlay->Name = L"buttonKeywordSoundPlay"; + this->buttonKeywordSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonKeywordSoundPlay->TabIndex = 5; + this->buttonKeywordSoundPlay->Text = L"Ķ"; + this->buttonKeywordSoundPlay->UseVisualStyleBackColor = true; + this->buttonKeywordSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonKeywordSoundPlay_Click); + // + // checkBoxKeywordSound + // + this->checkBoxKeywordSound->AutoSize = true; + this->checkBoxKeywordSound->Location = System::Drawing::Point(197, 65); + this->checkBoxKeywordSound->Name = L"checkBoxKeywordSound"; + this->checkBoxKeywordSound->Size = System::Drawing::Size(48, 16); + this->checkBoxKeywordSound->TabIndex = 4; + this->checkBoxKeywordSound->Text = L"—LŒø"; + this->checkBoxKeywordSound->UseVisualStyleBackColor = true; + this->checkBoxKeywordSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonKeywordSound + // + this->buttonKeywordSound->Location = System::Drawing::Point(166, 62); + this->buttonKeywordSound->Name = L"buttonKeywordSound"; + this->buttonKeywordSound->Size = System::Drawing::Size(24, 20); + this->buttonKeywordSound->TabIndex = 3; + this->buttonKeywordSound->Text = L"..."; + this->buttonKeywordSound->UseVisualStyleBackColor = true; + this->buttonKeywordSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonKeywordSound_Click); + // + // textBoxKeywordSoundPath + // + this->textBoxKeywordSoundPath->AllowDrop = true; + this->textBoxKeywordSoundPath->Location = System::Drawing::Point(10, 63); + this->textBoxKeywordSoundPath->Name = L"textBoxKeywordSoundPath"; + this->textBoxKeywordSoundPath->Size = System::Drawing::Size(150, 19); + this->textBoxKeywordSoundPath->TabIndex = 2; + this->textBoxKeywordSoundPath->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxKeywordSoundPath->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxKeywordSound_DragDrop); + this->textBoxKeywordSoundPath->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // labelKeywordSound + // + this->labelKeywordSound->AutoSize = true; + this->labelKeywordSound->Location = System::Drawing::Point(10, 16); + this->labelKeywordSound->Name = L"labelKeywordSound"; + this->labelKeywordSound->Size = System::Drawing::Size(141, 12); + this->labelKeywordSound->TabIndex = 1; + this->labelKeywordSound->Text = L"ƒRƒ“ƒ}( , )‚Å•¡”“o˜^‚ª‰Â”\"; + // + // textBoxKeyword + // + this->textBoxKeyword->Location = System::Drawing::Point(10, 35); + this->textBoxKeyword->Name = L"textBoxKeyword"; + this->textBoxKeyword->Size = System::Drawing::Size(315, 19); + this->textBoxKeyword->TabIndex = 0; + this->textBoxKeyword->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // groupBoxSeekSound + // + this->groupBoxSeekSound->Controls->Add(this->buttonSeekSoundPlay); + this->groupBoxSeekSound->Controls->Add(this->checkBoxSeekSound); + this->groupBoxSeekSound->Controls->Add(this->buttonSeekSound); + this->groupBoxSeekSound->Controls->Add(this->textBoxSeekSound); + this->groupBoxSeekSound->Location = System::Drawing::Point(8, 287); + this->groupBoxSeekSound->Name = L"groupBoxSeekSound"; + this->groupBoxSeekSound->Size = System::Drawing::Size(336, 52); + this->groupBoxSeekSound->TabIndex = 6; + this->groupBoxSeekSound->TabStop = false; + this->groupBoxSeekSound->Text = L"‘Îí•åW‚ÅĶ"; + // + // buttonSeekSoundPlay + // + this->buttonSeekSoundPlay->Location = System::Drawing::Point(261, 19); + this->buttonSeekSoundPlay->Name = L"buttonSeekSoundPlay"; + this->buttonSeekSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonSeekSoundPlay->TabIndex = 3; + this->buttonSeekSoundPlay->Text = L"Ķ"; + this->buttonSeekSoundPlay->UseVisualStyleBackColor = true; + this->buttonSeekSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonSeekSoundPlay_Click); + // + // checkBoxSeekSound + // + this->checkBoxSeekSound->AutoSize = true; + this->checkBoxSeekSound->Location = System::Drawing::Point(197, 21); + this->checkBoxSeekSound->Name = L"checkBoxSeekSound"; + this->checkBoxSeekSound->Size = System::Drawing::Size(48, 16); + this->checkBoxSeekSound->TabIndex = 2; + this->checkBoxSeekSound->Text = L"—LŒø"; + this->checkBoxSeekSound->UseVisualStyleBackColor = true; + this->checkBoxSeekSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonSeekSound + // + this->buttonSeekSound->Location = System::Drawing::Point(167, 18); + this->buttonSeekSound->Name = L"buttonSeekSound"; + this->buttonSeekSound->Size = System::Drawing::Size(24, 20); + this->buttonSeekSound->TabIndex = 1; + this->buttonSeekSound->Text = L"..."; + this->buttonSeekSound->UseVisualStyleBackColor = true; + this->buttonSeekSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonSeekSound_Click); + // + // textBoxSeekSound + // + this->textBoxSeekSound->AllowDrop = true; + this->textBoxSeekSound->Location = System::Drawing::Point(10, 19); + this->textBoxSeekSound->Name = L"textBoxSeekSound"; + this->textBoxSeekSound->Size = System::Drawing::Size(151, 19); + this->textBoxSeekSound->TabIndex = 0; + this->textBoxSeekSound->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxSeekSound->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSeekSound_DragDrop); + this->textBoxSeekSound->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // groupBoxTalkSound + // + this->groupBoxTalkSound->Controls->Add(this->buttonTalkSoundPlay); + this->groupBoxTalkSound->Controls->Add(this->checkBoxTalkSound); + this->groupBoxTalkSound->Controls->Add(this->buttonTalkSound); + this->groupBoxTalkSound->Controls->Add(this->textBoxTalkSound); + this->groupBoxTalkSound->Location = System::Drawing::Point(8, 228); + this->groupBoxTalkSound->Name = L"groupBoxTalkSound"; + this->groupBoxTalkSound->Size = System::Drawing::Size(336, 52); + this->groupBoxTalkSound->TabIndex = 5; + this->groupBoxTalkSound->TabStop = false; + this->groupBoxTalkSound->Text = L"”­Œ¾‚ÅĶ"; + // + // buttonTalkSoundPlay + // + this->buttonTalkSoundPlay->Location = System::Drawing::Point(261, 19); + this->buttonTalkSoundPlay->Name = L"buttonTalkSoundPlay"; + this->buttonTalkSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonTalkSoundPlay->TabIndex = 3; + this->buttonTalkSoundPlay->Text = L"Ķ"; + this->buttonTalkSoundPlay->UseVisualStyleBackColor = true; + this->buttonTalkSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonTalkSoundPlay_Click); + // + // checkBoxTalkSound + // + this->checkBoxTalkSound->AutoSize = true; + this->checkBoxTalkSound->Location = System::Drawing::Point(197, 21); + this->checkBoxTalkSound->Name = L"checkBoxTalkSound"; + this->checkBoxTalkSound->Size = System::Drawing::Size(48, 16); + this->checkBoxTalkSound->TabIndex = 2; + this->checkBoxTalkSound->Text = L"—LŒø"; + this->checkBoxTalkSound->UseVisualStyleBackColor = true; + this->checkBoxTalkSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonTalkSound + // + this->buttonTalkSound->Location = System::Drawing::Point(167, 18); + this->buttonTalkSound->Name = L"buttonTalkSound"; + this->buttonTalkSound->Size = System::Drawing::Size(24, 20); + this->buttonTalkSound->TabIndex = 1; + this->buttonTalkSound->Text = L"..."; + this->buttonTalkSound->UseVisualStyleBackColor = true; + this->buttonTalkSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonTalkSound_Click); + // + // textBoxTalkSound + // + this->textBoxTalkSound->AllowDrop = true; + this->textBoxTalkSound->Location = System::Drawing::Point(10, 19); + this->textBoxTalkSound->Name = L"textBoxTalkSound"; + this->textBoxTalkSound->Size = System::Drawing::Size(151, 19); + this->textBoxTalkSound->TabIndex = 0; + this->textBoxTalkSound->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxTalkSound->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxTalkSound_DragDrop); + this->textBoxTalkSound->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // groupBoxName + // + this->groupBoxName->Controls->Add(this->buttonNameSoundPlay); + this->groupBoxName->Controls->Add(this->checkBoxNameSound); + this->groupBoxName->Controls->Add(this->buttonNameSound); + this->groupBoxName->Controls->Add(this->textBoxNameSound); + this->groupBoxName->Location = System::Drawing::Point(8, 173); + this->groupBoxName->Name = L"groupBoxName"; + this->groupBoxName->Size = System::Drawing::Size(336, 52); + this->groupBoxName->TabIndex = 4; + this->groupBoxName->TabStop = false; + this->groupBoxName->Text = L"ƒjƒbƒNƒl[ƒ€‚ªŒÄ‚΂ꂽ‚çĶ"; + // + // buttonNameSoundPlay + // + this->buttonNameSoundPlay->Location = System::Drawing::Point(261, 19); + this->buttonNameSoundPlay->Name = L"buttonNameSoundPlay"; + this->buttonNameSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonNameSoundPlay->TabIndex = 5; + this->buttonNameSoundPlay->Text = L"Ķ"; + this->buttonNameSoundPlay->UseVisualStyleBackColor = true; + this->buttonNameSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonNameSoundPlay_Click); + // + // checkBoxNameSound + // + this->checkBoxNameSound->AutoSize = true; + this->checkBoxNameSound->Location = System::Drawing::Point(197, 21); + this->checkBoxNameSound->Name = L"checkBoxNameSound"; + this->checkBoxNameSound->Size = System::Drawing::Size(48, 16); + this->checkBoxNameSound->TabIndex = 4; + this->checkBoxNameSound->Text = L"—LŒø"; + this->checkBoxNameSound->UseVisualStyleBackColor = true; + this->checkBoxNameSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonNameSound + // + this->buttonNameSound->Location = System::Drawing::Point(167, 18); + this->buttonNameSound->Name = L"buttonNameSound"; + this->buttonNameSound->Size = System::Drawing::Size(24, 20); + this->buttonNameSound->TabIndex = 3; + this->buttonNameSound->Text = L"..."; + this->buttonNameSound->UseVisualStyleBackColor = true; + this->buttonNameSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonNameSound_Click); + // + // textBoxNameSound + // + this->textBoxNameSound->AllowDrop = true; + this->textBoxNameSound->Location = System::Drawing::Point(11, 19); + this->textBoxNameSound->Name = L"textBoxNameSound"; + this->textBoxNameSound->Size = System::Drawing::Size(150, 19); + this->textBoxNameSound->TabIndex = 2; + this->textBoxNameSound->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxNameSound->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxNameSound_DragDrop); + this->textBoxNameSound->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // groupBoxEnterSound + // + this->groupBoxEnterSound->Controls->Add(this->buttonEnterSoundPlay); + this->groupBoxEnterSound->Controls->Add(this->checkBoxEnterSound); + this->groupBoxEnterSound->Controls->Add(this->textBoxEnterSound); + this->groupBoxEnterSound->Controls->Add(this->buttonEnterSound); + this->groupBoxEnterSound->Location = System::Drawing::Point(8, 118); + this->groupBoxEnterSound->Name = L"groupBoxEnterSound"; + this->groupBoxEnterSound->Size = System::Drawing::Size(336, 52); + this->groupBoxEnterSound->TabIndex = 3; + this->groupBoxEnterSound->TabStop = false; + this->groupBoxEnterSound->Text = L"“üŽº‚Ì‚¨’m‚点"; + // + // buttonEnterSoundPlay + // + this->buttonEnterSoundPlay->Location = System::Drawing::Point(261, 20); + this->buttonEnterSoundPlay->Name = L"buttonEnterSoundPlay"; + this->buttonEnterSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonEnterSoundPlay->TabIndex = 4; + this->buttonEnterSoundPlay->Text = L"Ķ"; + this->buttonEnterSoundPlay->UseVisualStyleBackColor = true; + this->buttonEnterSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonEnterSoundPlay_Click); + // + // checkBoxEnterSound + // + this->checkBoxEnterSound->AutoSize = true; + this->checkBoxEnterSound->Location = System::Drawing::Point(197, 22); + this->checkBoxEnterSound->Name = L"checkBoxEnterSound"; + this->checkBoxEnterSound->Size = System::Drawing::Size(48, 16); + this->checkBoxEnterSound->TabIndex = 3; + this->checkBoxEnterSound->Text = L"—LŒø"; + this->checkBoxEnterSound->UseVisualStyleBackColor = true; + this->checkBoxEnterSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // textBoxEnterSound + // + this->textBoxEnterSound->AllowDrop = true; + this->textBoxEnterSound->Location = System::Drawing::Point(11, 20); + this->textBoxEnterSound->Name = L"textBoxEnterSound"; + this->textBoxEnterSound->Size = System::Drawing::Size(150, 19); + this->textBoxEnterSound->TabIndex = 1; + this->textBoxEnterSound->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxEnterSound->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxEnterSound_DragDrop); + this->textBoxEnterSound->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // buttonEnterSound + // + this->buttonEnterSound->Location = System::Drawing::Point(167, 19); + this->buttonEnterSound->Name = L"buttonEnterSound"; + this->buttonEnterSound->Size = System::Drawing::Size(24, 20); + this->buttonEnterSound->TabIndex = 2; + this->buttonEnterSound->Text = L"..."; + this->buttonEnterSound->UseVisualStyleBackColor = true; + this->buttonEnterSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonEnterSound_Click); + // + // groupBoxNoticeSound + // + this->groupBoxNoticeSound->Controls->Add(this->buttonNoticeSoundPlay); + this->groupBoxNoticeSound->Controls->Add(this->checkBoxNoticeSound); + this->groupBoxNoticeSound->Controls->Add(this->textBoxNoticeSound); + this->groupBoxNoticeSound->Controls->Add(this->buttonNoticeSound); + this->groupBoxNoticeSound->Location = System::Drawing::Point(8, 63); + this->groupBoxNoticeSound->Name = L"groupBoxNoticeSound"; + this->groupBoxNoticeSound->Size = System::Drawing::Size(336, 52); + this->groupBoxNoticeSound->TabIndex = 2; + this->groupBoxNoticeSound->TabStop = false; + this->groupBoxNoticeSound->Text = L"’m‚Ì‚¨’m‚点"; + // + // buttonNoticeSoundPlay + // + this->buttonNoticeSoundPlay->Location = System::Drawing::Point(261, 20); + this->buttonNoticeSoundPlay->Name = L"buttonNoticeSoundPlay"; + this->buttonNoticeSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonNoticeSoundPlay->TabIndex = 4; + this->buttonNoticeSoundPlay->Text = L"Ķ"; + this->buttonNoticeSoundPlay->UseVisualStyleBackColor = true; + this->buttonNoticeSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonNoticeSoundPlay_Click); + // + // checkBoxNoticeSound + // + this->checkBoxNoticeSound->AutoSize = true; + this->checkBoxNoticeSound->Location = System::Drawing::Point(197, 22); + this->checkBoxNoticeSound->Name = L"checkBoxNoticeSound"; + this->checkBoxNoticeSound->Size = System::Drawing::Size(48, 16); + this->checkBoxNoticeSound->TabIndex = 3; + this->checkBoxNoticeSound->Text = L"—LŒø"; + this->checkBoxNoticeSound->UseVisualStyleBackColor = true; + this->checkBoxNoticeSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // textBoxNoticeSound + // + this->textBoxNoticeSound->AllowDrop = true; + this->textBoxNoticeSound->Location = System::Drawing::Point(11, 20); + this->textBoxNoticeSound->Name = L"textBoxNoticeSound"; + this->textBoxNoticeSound->Size = System::Drawing::Size(150, 19); + this->textBoxNoticeSound->TabIndex = 1; + this->textBoxNoticeSound->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxNoticeSound->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxNoticeSound_DragDrop); + this->textBoxNoticeSound->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // buttonNoticeSound + // + this->buttonNoticeSound->Location = System::Drawing::Point(167, 19); + this->buttonNoticeSound->Name = L"buttonNoticeSound"; + this->buttonNoticeSound->Size = System::Drawing::Size(24, 20); + this->buttonNoticeSound->TabIndex = 2; + this->buttonNoticeSound->Text = L"..."; + this->buttonNoticeSound->UseVisualStyleBackColor = true; + this->buttonNoticeSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonNoticeSound_Click); + // + // groupBoxVSSound + // + this->groupBoxVSSound->Controls->Add(this->buttonVSSoundPlay); + this->groupBoxVSSound->Controls->Add(this->checkBoxVSSound); + this->groupBoxVSSound->Controls->Add(this->textBoxVSSound); + this->groupBoxVSSound->Controls->Add(this->buttonVSSound); + this->groupBoxVSSound->Location = System::Drawing::Point(8, 8); + this->groupBoxVSSound->Name = L"groupBoxVSSound"; + this->groupBoxVSSound->Size = System::Drawing::Size(336, 52); + this->groupBoxVSSound->TabIndex = 1; + this->groupBoxVSSound->TabStop = false; + this->groupBoxVSSound->Text = L"‘Îí‚Ì‚¨’m‚点"; + // + // buttonVSSoundPlay + // + this->buttonVSSoundPlay->Location = System::Drawing::Point(261, 19); + this->buttonVSSoundPlay->Name = L"buttonVSSoundPlay"; + this->buttonVSSoundPlay->Size = System::Drawing::Size(65, 20); + this->buttonVSSoundPlay->TabIndex = 4; + this->buttonVSSoundPlay->Text = L"Ķ"; + this->buttonVSSoundPlay->UseVisualStyleBackColor = true; + this->buttonVSSoundPlay->Click += gcnew System::EventHandler(this, &OptionForm::buttonVSSoundPlay_Click); + // + // checkBoxVSSound + // + this->checkBoxVSSound->AutoSize = true; + this->checkBoxVSSound->Location = System::Drawing::Point(197, 22); + this->checkBoxVSSound->Name = L"checkBoxVSSound"; + this->checkBoxVSSound->Size = System::Drawing::Size(48, 16); + this->checkBoxVSSound->TabIndex = 3; + this->checkBoxVSSound->Text = L"—LŒø"; + this->checkBoxVSSound->UseVisualStyleBackColor = true; + this->checkBoxVSSound->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // textBoxVSSound + // + this->textBoxVSSound->AllowDrop = true; + this->textBoxVSSound->Location = System::Drawing::Point(11, 20); + this->textBoxVSSound->Name = L"textBoxVSSound"; + this->textBoxVSSound->Size = System::Drawing::Size(150, 19); + this->textBoxVSSound->TabIndex = 1; + this->textBoxVSSound->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxVSSound->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxVSSound_DragDrop); + this->textBoxVSSound->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxSound_DragEnter); + // + // buttonVSSound + // + this->buttonVSSound->Location = System::Drawing::Point(167, 19); + this->buttonVSSound->Name = L"buttonVSSound"; + this->buttonVSSound->Size = System::Drawing::Size(24, 20); + this->buttonVSSound->TabIndex = 2; + this->buttonVSSound->Text = L"..."; + this->buttonVSSound->UseVisualStyleBackColor = true; + this->buttonVSSound->Click += gcnew System::EventHandler(this, &OptionForm::buttonVSSound_Click); + // + // tabPagePath + // + this->tabPagePath->AutoScroll = true; + this->tabPagePath->AutoScrollMinSize = System::Drawing::Size(0, 330); + this->tabPagePath->Controls->Add(this->groupBoxProfile); + this->tabPagePath->Controls->Add(this->groupBoxReplayFolder); + this->tabPagePath->Controls->Add(this->groupBoxNet); + this->tabPagePath->Controls->Add(this->groupBoxGameExe); + this->tabPagePath->Location = System::Drawing::Point(4, 22); + this->tabPagePath->Name = L"tabPagePath"; + this->tabPagePath->Padding = System::Windows::Forms::Padding(3); + this->tabPagePath->Size = System::Drawing::Size(369, 295); + this->tabPagePath->TabIndex = 0; + this->tabPagePath->Text = L"Šî–{"; + this->tabPagePath->UseVisualStyleBackColor = true; + // + // groupBoxProfile + // + this->groupBoxProfile->Controls->Add(this->buttonSaveProfile); + this->groupBoxProfile->Controls->Add(this->buttonAddProfile); + this->groupBoxProfile->Controls->Add(this->labelProfileName); + this->groupBoxProfile->Controls->Add(this->buttonDeleteProfile); + this->groupBoxProfile->Controls->Add(this->textBoxProfileName); + this->groupBoxProfile->Controls->Add(this->buttonCopyProfile); + this->groupBoxProfile->Controls->Add(this->comboBoxProfile); + this->groupBoxProfile->Location = System::Drawing::Point(8, 8); + this->groupBoxProfile->Name = L"groupBoxProfile"; + this->groupBoxProfile->Size = System::Drawing::Size(330, 85); + this->groupBoxProfile->TabIndex = 4; + this->groupBoxProfile->TabStop = false; + this->groupBoxProfile->Text = L"ƒvƒƒtƒ@ƒCƒ‹"; + // + // buttonSaveProfile + // + this->buttonSaveProfile->Location = System::Drawing::Point(275, 50); + this->buttonSaveProfile->Name = L"buttonSaveProfile"; + this->buttonSaveProfile->Size = System::Drawing::Size(45, 22); + this->buttonSaveProfile->TabIndex = 7; + this->buttonSaveProfile->Text = L"•Û‘¶"; + this->buttonSaveProfile->UseVisualStyleBackColor = true; + this->buttonSaveProfile->Click += gcnew System::EventHandler(this, &OptionForm::buttonSaveProfile_Click); + // + // buttonAddProfile + // + this->buttonAddProfile->Location = System::Drawing::Point(223, 50); + this->buttonAddProfile->Name = L"buttonAddProfile"; + this->buttonAddProfile->Size = System::Drawing::Size(45, 22); + this->buttonAddProfile->TabIndex = 6; + this->buttonAddProfile->Text = L"’ljÁ"; + this->buttonAddProfile->UseVisualStyleBackColor = true; + this->buttonAddProfile->Click += gcnew System::EventHandler(this, &OptionForm::buttonAddProfile_Click); + // + // labelProfileName + // + this->labelProfileName->AutoSize = true; + this->labelProfileName->Location = System::Drawing::Point(10, 55); + this->labelProfileName->Name = L"labelProfileName"; + this->labelProfileName->Size = System::Drawing::Size(69, 12); + this->labelProfileName->TabIndex = 5; + this->labelProfileName->Text = L"ƒvƒƒtƒ@ƒCƒ‹–¼"; + // + // buttonDeleteProfile + // + this->buttonDeleteProfile->Location = System::Drawing::Point(275, 18); + this->buttonDeleteProfile->Name = L"buttonDeleteProfile"; + this->buttonDeleteProfile->Size = System::Drawing::Size(45, 22); + this->buttonDeleteProfile->TabIndex = 4; + this->buttonDeleteProfile->Text = L"íœ"; + this->buttonDeleteProfile->UseVisualStyleBackColor = true; + this->buttonDeleteProfile->Click += gcnew System::EventHandler(this, &OptionForm::buttonDeleteProfile_Click); + // + // textBoxProfileName + // + this->textBoxProfileName->Location = System::Drawing::Point(85, 52); + this->textBoxProfileName->MaxLength = 63; + this->textBoxProfileName->Name = L"textBoxProfileName"; + this->textBoxProfileName->Size = System::Drawing::Size(127, 19); + this->textBoxProfileName->TabIndex = 3; + this->textBoxProfileName->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonCopyProfile + // + this->buttonCopyProfile->Location = System::Drawing::Point(223, 18); + this->buttonCopyProfile->Name = L"buttonCopyProfile"; + this->buttonCopyProfile->Size = System::Drawing::Size(45, 22); + this->buttonCopyProfile->TabIndex = 2; + this->buttonCopyProfile->Text = L"•¡»"; + this->buttonCopyProfile->UseVisualStyleBackColor = true; + this->buttonCopyProfile->Click += gcnew System::EventHandler(this, &OptionForm::buttonCopyProfile_Click); + // + // comboBoxProfile + // + this->comboBoxProfile->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList; + this->comboBoxProfile->FormattingEnabled = true; + this->comboBoxProfile->ItemHeight = 12; + this->comboBoxProfile->Location = System::Drawing::Point(12, 19); + this->comboBoxProfile->MaxDropDownItems = 64; + this->comboBoxProfile->Name = L"comboBoxProfile"; + this->comboBoxProfile->Size = System::Drawing::Size(200, 20); + this->comboBoxProfile->TabIndex = 0; + this->comboBoxProfile->SelectedIndexChanged += gcnew System::EventHandler(this, &OptionForm::comboBoxProfile_SelectedIndexChanged); + // + // groupBoxReplayFolder + // + this->groupBoxReplayFolder->Controls->Add(this->textBoxReplayFolder); + this->groupBoxReplayFolder->Controls->Add(this->buttonReplayFolder); + this->groupBoxReplayFolder->Controls->Add(this->checkBoxDivide); + this->groupBoxReplayFolder->Location = System::Drawing::Point(8, 157); + this->groupBoxReplayFolder->Name = L"groupBoxReplayFolder"; + this->groupBoxReplayFolder->Size = System::Drawing::Size(330, 80); + this->groupBoxReplayFolder->TabIndex = 2; + this->groupBoxReplayFolder->TabStop = false; + this->groupBoxReplayFolder->Text = L"ƒŠƒvƒŒƒC•Û‘¶ƒtƒHƒ‹ƒ_"; + // + // textBoxReplayFolder + // + this->textBoxReplayFolder->AllowDrop = true; + this->textBoxReplayFolder->Location = System::Drawing::Point(12, 20); + this->textBoxReplayFolder->Name = L"textBoxReplayFolder"; + this->textBoxReplayFolder->Size = System::Drawing::Size(278, 19); + this->textBoxReplayFolder->TabIndex = 1; + this->textBoxReplayFolder->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxReplayFolder->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxReplayFolder_DragDrop); + this->textBoxReplayFolder->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxReplayFolder_DragEnter); + // + // buttonReplayFolder + // + this->buttonReplayFolder->Location = System::Drawing::Point(296, 20); + this->buttonReplayFolder->Name = L"buttonReplayFolder"; + this->buttonReplayFolder->Size = System::Drawing::Size(24, 20); + this->buttonReplayFolder->TabIndex = 2; + this->buttonReplayFolder->Text = L"..."; + this->buttonReplayFolder->UseVisualStyleBackColor = true; + this->buttonReplayFolder->Click += gcnew System::EventHandler(this, &OptionForm::buttonReplayFolder_Click); + // + // checkBoxDivide + // + this->checkBoxDivide->AutoSize = true; + this->checkBoxDivide->Location = System::Drawing::Point(12, 51); + this->checkBoxDivide->Name = L"checkBoxDivide"; + this->checkBoxDivide->Size = System::Drawing::Size(168, 16); + this->checkBoxDivide->TabIndex = 3; + this->checkBoxDivide->Text = L"ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹‚ÌŽ©“®U‚蕪‚¯"; + this->checkBoxDivide->UseVisualStyleBackColor = true; + this->checkBoxDivide->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // groupBoxNet + // + this->groupBoxNet->Controls->Add(this->labelComment); + this->groupBoxNet->Controls->Add(this->numericUpDownMaxConnection); + this->groupBoxNet->Controls->Add(this->textBoxComment); + this->groupBoxNet->Controls->Add(this->label5); + this->groupBoxNet->Location = System::Drawing::Point(8, 243); + this->groupBoxNet->Name = L"groupBoxNet"; + this->groupBoxNet->Size = System::Drawing::Size(330, 80); + this->groupBoxNet->TabIndex = 3; + this->groupBoxNet->TabStop = false; + this->groupBoxNet->Text = L"‰ñüÝ’è"; + // + // labelComment + // + this->labelComment->AutoSize = true; + this->labelComment->Location = System::Drawing::Point(10, 51); + this->labelComment->Name = L"labelComment"; + this->labelComment->Size = System::Drawing::Size(38, 12); + this->labelComment->TabIndex = 0; + this->labelComment->Text = L"ƒRƒƒ“ƒg"; + // + // numericUpDownMaxConnection + // + this->numericUpDownMaxConnection->Location = System::Drawing::Point(81, 20); + this->numericUpDownMaxConnection->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownMaxConnection->Name = L"numericUpDownMaxConnection"; + this->numericUpDownMaxConnection->Size = System::Drawing::Size(40, 19); + this->numericUpDownMaxConnection->TabIndex = 1; + this->numericUpDownMaxConnection->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownMaxConnection->ValueChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // textBoxComment + // + this->textBoxComment->Location = System::Drawing::Point(81, 48); + this->textBoxComment->Name = L"textBoxComment"; + this->textBoxComment->Size = System::Drawing::Size(206, 19); + this->textBoxComment->TabIndex = 2; + this->textBoxComment->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // label5 + // + this->label5->AutoSize = true; + this->label5->Location = System::Drawing::Point(10, 22); + this->label5->Name = L"label5"; + this->label5->Size = System::Drawing::Size(65, 12); + this->label5->TabIndex = 0; + this->label5->Text = L"Å‘åÚ‘±”"; + // + // groupBoxGameExe + // + this->groupBoxGameExe->Controls->Add(this->textBoxGameExe); + this->groupBoxGameExe->Controls->Add(this->buttonGameExe); + this->groupBoxGameExe->Location = System::Drawing::Point(8, 99); + this->groupBoxGameExe->Name = L"groupBoxGameExe"; + this->groupBoxGameExe->Size = System::Drawing::Size(330, 52); + this->groupBoxGameExe->TabIndex = 1; + this->groupBoxGameExe->TabStop = false; + this->groupBoxGameExe->Text = L"ŽÀsƒtƒ@ƒCƒ‹‚̃pƒX"; + // + // textBoxGameExe + // + this->textBoxGameExe->AllowDrop = true; + this->textBoxGameExe->Location = System::Drawing::Point(12, 20); + this->textBoxGameExe->Name = L"textBoxGameExe"; + this->textBoxGameExe->Size = System::Drawing::Size(278, 19); + this->textBoxGameExe->TabIndex = 1; + this->textBoxGameExe->TextChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->textBoxGameExe->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxGameExe_DragDrop); + this->textBoxGameExe->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &OptionForm::textBoxGameExe_DragEnter); + // + // buttonGameExe + // + this->buttonGameExe->Location = System::Drawing::Point(296, 20); + this->buttonGameExe->Name = L"buttonGameExe"; + this->buttonGameExe->Size = System::Drawing::Size(24, 20); + this->buttonGameExe->TabIndex = 2; + this->buttonGameExe->Text = L"..."; + this->buttonGameExe->UseVisualStyleBackColor = true; + this->buttonGameExe->Click += gcnew System::EventHandler(this, &OptionForm::buttonGameExe_Click); + // + // groupBoxSave + // + this->groupBoxSave->Controls->Add(this->radioButtonReplayVersion1); + this->groupBoxSave->Controls->Add(this->radioButtonReplayVersion2); + this->groupBoxSave->Location = System::Drawing::Point(195, 199); + this->groupBoxSave->Name = L"groupBoxSave"; + this->groupBoxSave->Size = System::Drawing::Size(154, 42); + this->groupBoxSave->TabIndex = 4; + this->groupBoxSave->TabStop = false; + this->groupBoxSave->Text = L"ƒŠƒvƒŒƒCƒtƒ@ƒCƒ‹"; + // + // radioButtonReplayVersion1 + // + this->radioButtonReplayVersion1->AutoSize = true; + this->radioButtonReplayVersion1->Location = System::Drawing::Point(88, 17); + this->radioButtonReplayVersion1->Name = L"radioButtonReplayVersion1"; + this->radioButtonReplayVersion1->Size = System::Drawing::Size(59, 16); + this->radioButtonReplayVersion1->TabIndex = 2; + this->radioButtonReplayVersion1->TabStop = true; + this->radioButtonReplayVersion1->Text = L"–³ˆ³k"; + this->radioButtonReplayVersion1->UseVisualStyleBackColor = true; + this->radioButtonReplayVersion1->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // radioButtonReplayVersion2 + // + this->radioButtonReplayVersion2->AutoSize = true; + this->radioButtonReplayVersion2->Location = System::Drawing::Point(16, 17); + this->radioButtonReplayVersion2->Name = L"radioButtonReplayVersion2"; + this->radioButtonReplayVersion2->Size = System::Drawing::Size(66, 16); + this->radioButtonReplayVersion2->TabIndex = 2; + this->radioButtonReplayVersion2->TabStop = true; + this->radioButtonReplayVersion2->Text = L"ˆ³k‚·‚é"; + this->radioButtonReplayVersion2->UseVisualStyleBackColor = true; + this->radioButtonReplayVersion2->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // tabControlOption + // + this->tabControlOption->Controls->Add(this->tabPagePath); + this->tabControlOption->Controls->Add(this->tabPageSound); + this->tabControlOption->Controls->Add(this->tabPageGame); + this->tabControlOption->Controls->Add(this->tabPageColor); + this->tabControlOption->Controls->Add(this->tabPageVolume); + this->tabControlOption->Controls->Add(this->tabPageIP); + this->tabControlOption->Controls->Add(this->tabPageDetails); + this->tabControlOption->Dock = System::Windows::Forms::DockStyle::Top; + this->tabControlOption->Location = System::Drawing::Point(0, 0); + this->tabControlOption->Name = L"tabControlOption"; + this->tabControlOption->SelectedIndex = 0; + this->tabControlOption->Size = System::Drawing::Size(377, 321); + this->tabControlOption->TabIndex = 0; + // + // tabPageGame + // + this->tabPageGame->AutoScroll = true; + this->tabPageGame->Controls->Add(this->groupBoxTeamOption); + this->tabPageGame->Controls->Add(this->groupBoxSave); + this->tabPageGame->Controls->Add(this->groupBoxSimulate); + this->tabPageGame->Controls->Add(this->groupBoxRun); + this->tabPageGame->Controls->Add(this->groupBoxView); + this->tabPageGame->Controls->Add(this->groupBoxSetting); + this->tabPageGame->Location = System::Drawing::Point(4, 22); + this->tabPageGame->Name = L"tabPageGame"; + this->tabPageGame->Padding = System::Windows::Forms::Padding(3); + this->tabPageGame->Size = System::Drawing::Size(369, 295); + this->tabPageGame->TabIndex = 4; + this->tabPageGame->Text = L"ƒQ[ƒ€"; + this->tabPageGame->UseVisualStyleBackColor = true; + // + // groupBoxTeamOption + // + this->groupBoxTeamOption->Controls->Add(this->labelTeamRoundHP); + this->groupBoxTeamOption->Controls->Add(this->checkBoxTeamRoundHP); + this->groupBoxTeamOption->Location = System::Drawing::Point(9, 224); + this->groupBoxTeamOption->Name = L"groupBoxTeamOption"; + this->groupBoxTeamOption->Size = System::Drawing::Size(167, 68); + this->groupBoxTeamOption->TabIndex = 6; + this->groupBoxTeamOption->TabStop = false; + this->groupBoxTeamOption->Text = L"ƒ`[ƒ€ƒvƒŒƒCÝ’è"; + // + // labelTeamRoundHP + // + this->labelTeamRoundHP->AutoSize = true; + this->labelTeamRoundHP->Location = System::Drawing::Point(13, 42); + this->labelTeamRoundHP->Name = L"labelTeamRoundHP"; + this->labelTeamRoundHP->Size = System::Drawing::Size(138, 12); + this->labelTeamRoundHP->TabIndex = 1; + this->labelTeamRoundHP->Text = L"¦1vs1‚ł̓Iƒt‚É‚µ‚Ä‚­‚¾‚³‚¢"; + // + // checkBoxTeamRoundHP + // + this->checkBoxTeamRoundHP->AutoSize = true; + this->checkBoxTeamRoundHP->Location = System::Drawing::Point(15, 21); + this->checkBoxTeamRoundHP->Name = L"checkBoxTeamRoundHP"; + this->checkBoxTeamRoundHP->Size = System::Drawing::Size(148, 16); + this->checkBoxTeamRoundHP->TabIndex = 0; + this->checkBoxTeamRoundHP->Text = L"ƒ‰ƒEƒ“ƒhŠÔ‚ÅHP‚ðŽ‚¿‰z‚·"; + this->checkBoxTeamRoundHP->UseVisualStyleBackColor = true; + this->checkBoxTeamRoundHP->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // groupBoxSimulate + // + this->groupBoxSimulate->Controls->Add(this->numericUpDownSimDelay); + this->groupBoxSimulate->Controls->Add(this->labelSimDelay); + this->groupBoxSimulate->Location = System::Drawing::Point(195, 149); + this->groupBoxSimulate->Name = L"groupBoxSimulate"; + this->groupBoxSimulate->Size = System::Drawing::Size(154, 44); + this->groupBoxSimulate->TabIndex = 5; + this->groupBoxSimulate->TabStop = false; + this->groupBoxSimulate->Text = L"ƒVƒ~ƒ…ƒŒ[ƒg"; + // + // numericUpDownSimDelay + // + this->numericUpDownSimDelay->Location = System::Drawing::Point(88, 18); + this->numericUpDownSimDelay->Name = L"numericUpDownSimDelay"; + this->numericUpDownSimDelay->Size = System::Drawing::Size(40, 19); + this->numericUpDownSimDelay->TabIndex = 1; + this->numericUpDownSimDelay->ValueChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // labelSimDelay + // + this->labelSimDelay->AutoSize = true; + this->labelSimDelay->Location = System::Drawing::Point(16, 20); + this->labelSimDelay->Name = L"labelSimDelay"; + this->labelSimDelay->Size = System::Drawing::Size(40, 12); + this->labelSimDelay->TabIndex = 0; + this->labelSimDelay->Text = L"ƒfƒBƒŒƒC"; + // + // groupBoxRun + // + this->groupBoxRun->Controls->Add(this->checkBoxWindowSize); + this->groupBoxRun->Controls->Add(this->checkBoxHitJudge); + this->groupBoxRun->Location = System::Drawing::Point(8, 149); + this->groupBoxRun->Name = L"groupBoxRun"; + this->groupBoxRun->Size = System::Drawing::Size(168, 68); + this->groupBoxRun->TabIndex = 3; + this->groupBoxRun->TabStop = false; + this->groupBoxRun->Text = L"ŠiƒcƒN"; + // + // checkBoxWindowSize + // + this->checkBoxWindowSize->AutoSize = true; + this->checkBoxWindowSize->Location = System::Drawing::Point(16, 44); + this->checkBoxWindowSize->Name = L"checkBoxWindowSize"; + this->checkBoxWindowSize->Size = System::Drawing::Size(112, 16); + this->checkBoxWindowSize->TabIndex = 2; + this->checkBoxWindowSize->Text = L"640 x 480 ‚Å‹N“®"; + this->checkBoxWindowSize->UseVisualStyleBackColor = true; + this->checkBoxWindowSize->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxHitJudge + // + this->checkBoxHitJudge->AutoSize = true; + this->checkBoxHitJudge->Location = System::Drawing::Point(16, 20); + this->checkBoxHitJudge->Name = L"checkBoxHitJudge"; + this->checkBoxHitJudge->Size = System::Drawing::Size(111, 16); + this->checkBoxHitJudge->TabIndex = 1; + this->checkBoxHitJudge->Text = L"“–‚½‚è”»’è‚Ì•\Ž¦"; + this->checkBoxHitJudge->UseVisualStyleBackColor = true; + this->checkBoxHitJudge->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // groupBoxView + // + this->groupBoxView->Controls->Add(this->checkBoxShowResult); + this->groupBoxView->Controls->Add(this->checkBoxVersus); + this->groupBoxView->Controls->Add(this->checkBoxName); + this->groupBoxView->Controls->Add(this->checkBoxFramerate); + this->groupBoxView->Controls->Add(this->checkBoxRand); + this->groupBoxView->Location = System::Drawing::Point(195, 8); + this->groupBoxView->Name = L"groupBoxView"; + this->groupBoxView->Size = System::Drawing::Size(154, 134); + this->groupBoxView->TabIndex = 4; + this->groupBoxView->TabStop = false; + this->groupBoxView->Text = L"ƒ^ƒCƒgƒ‹ƒo["; + // + // checkBoxVersus + // + this->checkBoxVersus->AutoSize = true; + this->checkBoxVersus->Location = System::Drawing::Point(16, 42); + this->checkBoxVersus->Name = L"checkBoxVersus"; + this->checkBoxVersus->Size = System::Drawing::Size(60, 16); + this->checkBoxVersus->TabIndex = 2; + this->checkBoxVersus->Text = L"‘Îí”"; + this->checkBoxVersus->UseVisualStyleBackColor = true; + this->checkBoxVersus->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxName + // + this->checkBoxName->AutoSize = true; + this->checkBoxName->Location = System::Drawing::Point(16, 20); + this->checkBoxName->Name = L"checkBoxName"; + this->checkBoxName->Size = System::Drawing::Size(78, 16); + this->checkBoxName->TabIndex = 1; + this->checkBoxName->Text = L"ƒjƒbƒNƒl[ƒ€"; + this->checkBoxName->UseVisualStyleBackColor = true; + this->checkBoxName->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxFramerate + // + this->checkBoxFramerate->AutoSize = true; + this->checkBoxFramerate->Location = System::Drawing::Point(16, 86); + this->checkBoxFramerate->Name = L"checkBoxFramerate"; + this->checkBoxFramerate->Size = System::Drawing::Size(88, 16); + this->checkBoxFramerate->TabIndex = 3; + this->checkBoxFramerate->Text = L"ƒtƒŒ[ƒ€ƒŒ[ƒg"; + this->checkBoxFramerate->UseVisualStyleBackColor = true; + this->checkBoxFramerate->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxRand + // + this->checkBoxRand->AutoSize = true; + this->checkBoxRand->Location = System::Drawing::Point(16, 108); + this->checkBoxRand->Name = L"checkBoxRand"; + this->checkBoxRand->Size = System::Drawing::Size(106, 16); + this->checkBoxRand->TabIndex = 4; + this->checkBoxRand->Text = L"—”‚ÌŽg—p‰ñ”"; + this->checkBoxRand->UseVisualStyleBackColor = true; + this->checkBoxRand->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // groupBoxSetting + // + this->groupBoxSetting->Controls->Add(this->numericUpDownRound); + this->groupBoxSetting->Controls->Add(this->labelRound); + this->groupBoxSetting->Controls->Add(this->labelTimer); + this->groupBoxSetting->Controls->Add(this->numericUpDownTimer); + this->groupBoxSetting->Controls->Add(this->numericUpDownMaxStage); + this->groupBoxSetting->Controls->Add(this->labelMaxStage); + this->groupBoxSetting->Controls->Add(this->labelStageSelect); + this->groupBoxSetting->Controls->Add(this->numericUpDownStageSelect); + this->groupBoxSetting->Location = System::Drawing::Point(8, 8); + this->groupBoxSetting->Name = L"groupBoxSetting"; + this->groupBoxSetting->Size = System::Drawing::Size(168, 134); + this->groupBoxSetting->TabIndex = 1; + this->groupBoxSetting->TabStop = false; + this->groupBoxSetting->Text = L"‘ÎíÝ’è"; + // + // numericUpDownRound + // + this->numericUpDownRound->Location = System::Drawing::Point(112, 72); + this->numericUpDownRound->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {9, 0, 0, 0}); + this->numericUpDownRound->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownRound->Name = L"numericUpDownRound"; + this->numericUpDownRound->Size = System::Drawing::Size(40, 19); + this->numericUpDownRound->TabIndex = 3; + this->numericUpDownRound->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownRound->ValueChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // labelRound + // + this->labelRound->AutoSize = true; + this->labelRound->Location = System::Drawing::Point(16, 76); + this->labelRound->Name = L"labelRound"; + this->labelRound->Size = System::Drawing::Size(52, 12); + this->labelRound->TabIndex = 0; + this->labelRound->Text = L"ƒ‰ƒEƒ“ƒh”"; + // + // labelTimer + // + this->labelTimer->AutoSize = true; + this->labelTimer->Location = System::Drawing::Point(16, 104); + this->labelTimer->Name = L"labelTimer"; + this->labelTimer->Size = System::Drawing::Size(71, 12); + this->labelTimer->TabIndex = 0; + this->labelTimer->Text = L"ƒQ[ƒ€ƒ^ƒCƒ}["; + // + // numericUpDownTimer + // + this->numericUpDownTimer->Location = System::Drawing::Point(112, 100); + this->numericUpDownTimer->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {99, 0, 0, 0}); + this->numericUpDownTimer->Name = L"numericUpDownTimer"; + this->numericUpDownTimer->Size = System::Drawing::Size(40, 19); + this->numericUpDownTimer->TabIndex = 4; + this->numericUpDownTimer->ValueChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // numericUpDownMaxStage + // + this->numericUpDownMaxStage->Location = System::Drawing::Point(112, 16); + this->numericUpDownMaxStage->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownMaxStage->Name = L"numericUpDownMaxStage"; + this->numericUpDownMaxStage->Size = System::Drawing::Size(40, 19); + this->numericUpDownMaxStage->TabIndex = 1; + this->numericUpDownMaxStage->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownMaxStage->ValueChanged += gcnew System::EventHandler(this, &OptionForm::numericUpDownStage_ValueChanged); + // + // labelMaxStage + // + this->labelMaxStage->AutoSize = true; + this->labelMaxStage->Location = System::Drawing::Point(16, 20); + this->labelMaxStage->Name = L"labelMaxStage"; + this->labelMaxStage->Size = System::Drawing::Size(79, 12); + this->labelMaxStage->TabIndex = 0; + this->labelMaxStage->Text = L"Å‘åƒXƒe[ƒW”"; + // + // labelStageSelect + // + this->labelStageSelect->AutoSize = true; + this->labelStageSelect->Location = System::Drawing::Point(16, 48); + this->labelStageSelect->Name = L"labelStageSelect"; + this->labelStageSelect->Size = System::Drawing::Size(67, 12); + this->labelStageSelect->TabIndex = 0; + this->labelStageSelect->Text = L"‘ÎíƒXƒe[ƒW"; + // + // numericUpDownStageSelect + // + this->numericUpDownStageSelect->Location = System::Drawing::Point(112, 44); + this->numericUpDownStageSelect->Name = L"numericUpDownStageSelect"; + this->numericUpDownStageSelect->Size = System::Drawing::Size(40, 19); + this->numericUpDownStageSelect->TabIndex = 2; + this->numericUpDownStageSelect->ValueChanged += gcnew System::EventHandler(this, &OptionForm::numericUpDownStage_ValueChanged); + // + // tabPageColor + // + this->tabPageColor->Controls->Add(this->groupBoxMessageColor); + this->tabPageColor->Controls->Add(this->groupBoxOthersColor); + this->tabPageColor->Controls->Add(this->groupBoxStateColor); + this->tabPageColor->Controls->Add(this->groupBoxNameColor); + this->tabPageColor->Location = System::Drawing::Point(4, 22); + this->tabPageColor->Name = L"tabPageColor"; + this->tabPageColor->Padding = System::Windows::Forms::Padding(3); + this->tabPageColor->Size = System::Drawing::Size(369, 295); + this->tabPageColor->TabIndex = 5; + this->tabPageColor->Text = L"ƒJƒ‰["; + this->tabPageColor->UseVisualStyleBackColor = true; + // + // groupBoxMessageColor + // + this->groupBoxMessageColor->Controls->Add(this->buttonDebugMessage); + this->groupBoxMessageColor->Controls->Add(this->buttonErrorMessage); + this->groupBoxMessageColor->Controls->Add(this->buttonSystemMessage); + this->groupBoxMessageColor->Location = System::Drawing::Point(192, 8); + this->groupBoxMessageColor->Name = L"groupBoxMessageColor"; + this->groupBoxMessageColor->Size = System::Drawing::Size(168, 108); + this->groupBoxMessageColor->TabIndex = 3; + this->groupBoxMessageColor->TabStop = false; + this->groupBoxMessageColor->Text = L"ƒƒbƒZ[ƒW"; + // + // buttonDebugMessage + // + this->buttonDebugMessage->BackColor = System::Drawing::SystemColors::Window; + this->buttonDebugMessage->Location = System::Drawing::Point(16, 76); + this->buttonDebugMessage->Name = L"buttonDebugMessage"; + this->buttonDebugMessage->Size = System::Drawing::Size(136, 20); + this->buttonDebugMessage->TabIndex = 3; + this->buttonDebugMessage->Text = L"ƒfƒoƒbƒO"; + this->buttonDebugMessage->UseVisualStyleBackColor = false; + this->buttonDebugMessage->Click += gcnew System::EventHandler(this, &OptionForm::buttonDebugMessage_Click); + this->buttonDebugMessage->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonErrorMessage + // + this->buttonErrorMessage->BackColor = System::Drawing::SystemColors::Window; + this->buttonErrorMessage->Location = System::Drawing::Point(16, 48); + this->buttonErrorMessage->Name = L"buttonErrorMessage"; + this->buttonErrorMessage->Size = System::Drawing::Size(136, 20); + this->buttonErrorMessage->TabIndex = 2; + this->buttonErrorMessage->Text = L"ƒGƒ‰["; + this->buttonErrorMessage->UseVisualStyleBackColor = false; + this->buttonErrorMessage->Click += gcnew System::EventHandler(this, &OptionForm::buttonErrorMessage_Click); + this->buttonErrorMessage->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonSystemMessage + // + this->buttonSystemMessage->BackColor = System::Drawing::SystemColors::Window; + this->buttonSystemMessage->Location = System::Drawing::Point(16, 20); + this->buttonSystemMessage->Name = L"buttonSystemMessage"; + this->buttonSystemMessage->Size = System::Drawing::Size(136, 20); + this->buttonSystemMessage->TabIndex = 1; + this->buttonSystemMessage->Text = L"ƒVƒXƒeƒ€"; + this->buttonSystemMessage->UseVisualStyleBackColor = false; + this->buttonSystemMessage->Click += gcnew System::EventHandler(this, &OptionForm::buttonSystemMessage_Click); + this->buttonSystemMessage->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // groupBoxOthersColor + // + this->groupBoxOthersColor->Controls->Add(this->buttonSecret); + this->groupBoxOthersColor->Controls->Add(this->buttonCommentBack); + this->groupBoxOthersColor->Controls->Add(this->buttonNoticeBack); + this->groupBoxOthersColor->Location = System::Drawing::Point(192, 128); + this->groupBoxOthersColor->Name = L"groupBoxOthersColor"; + this->groupBoxOthersColor->Size = System::Drawing::Size(168, 108); + this->groupBoxOthersColor->TabIndex = 4; + this->groupBoxOthersColor->TabStop = false; + this->groupBoxOthersColor->Text = L"‚»‚Ì‘¼"; + // + // buttonSecret + // + this->buttonSecret->BackColor = System::Drawing::SystemColors::Window; + this->buttonSecret->Location = System::Drawing::Point(16, 76); + this->buttonSecret->Name = L"buttonSecret"; + this->buttonSecret->Size = System::Drawing::Size(136, 20); + this->buttonSecret->TabIndex = 3; + this->buttonSecret->Text = L"HHH"; + this->buttonSecret->UseVisualStyleBackColor = false; + this->buttonSecret->Click += gcnew System::EventHandler(this, &OptionForm::buttonSecret_Click); + this->buttonSecret->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonCommentBack + // + this->buttonCommentBack->ForeColor = System::Drawing::SystemColors::WindowText; + this->buttonCommentBack->Location = System::Drawing::Point(16, 48); + this->buttonCommentBack->Name = L"buttonCommentBack"; + this->buttonCommentBack->Size = System::Drawing::Size(136, 20); + this->buttonCommentBack->TabIndex = 2; + this->buttonCommentBack->Text = L"ƒRƒƒ“ƒg‚Ì”wŒi"; + this->buttonCommentBack->UseVisualStyleBackColor = false; + this->buttonCommentBack->BackColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->buttonCommentBack->Click += gcnew System::EventHandler(this, &OptionForm::buttonCommentBack_Click); + // + // buttonNoticeBack + // + this->buttonNoticeBack->ForeColor = System::Drawing::SystemColors::WindowText; + this->buttonNoticeBack->Location = System::Drawing::Point(16, 20); + this->buttonNoticeBack->Name = L"buttonNoticeBack"; + this->buttonNoticeBack->Size = System::Drawing::Size(136, 20); + this->buttonNoticeBack->TabIndex = 1; + this->buttonNoticeBack->Text = L"’mƒƒbƒZ[ƒW‚Ì”wŒi"; + this->buttonNoticeBack->UseVisualStyleBackColor = false; + this->buttonNoticeBack->BackColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->buttonNoticeBack->Click += gcnew System::EventHandler(this, &OptionForm::buttonNoticeBack_Click); + // + // groupBoxStateColor + // + this->groupBoxStateColor->Controls->Add(this->buttonSeekState); + this->groupBoxStateColor->Controls->Add(this->buttonWatchState); + this->groupBoxStateColor->Controls->Add(this->buttonVSState); + this->groupBoxStateColor->Controls->Add(this->buttonRestState); + this->groupBoxStateColor->Location = System::Drawing::Point(8, 128); + this->groupBoxStateColor->Name = L"groupBoxStateColor"; + this->groupBoxStateColor->Size = System::Drawing::Size(168, 137); + this->groupBoxStateColor->TabIndex = 2; + this->groupBoxStateColor->TabStop = false; + this->groupBoxStateColor->Text = L"ó‘Ô"; + // + // buttonSeekState + // + this->buttonSeekState->Location = System::Drawing::Point(16, 103); + this->buttonSeekState->Name = L"buttonSeekState"; + this->buttonSeekState->Size = System::Drawing::Size(136, 21); + this->buttonSeekState->TabIndex = 4; + this->buttonSeekState->Text = L"‘Îí•åW’†"; + this->buttonSeekState->UseVisualStyleBackColor = true; + this->buttonSeekState->BackColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->buttonSeekState->Click += gcnew System::EventHandler(this, &OptionForm::buttonSeekState_Click); + // + // buttonWatchState + // + this->buttonWatchState->ForeColor = System::Drawing::SystemColors::WindowText; + this->buttonWatchState->Location = System::Drawing::Point(16, 76); + this->buttonWatchState->Name = L"buttonWatchState"; + this->buttonWatchState->Size = System::Drawing::Size(136, 20); + this->buttonWatchState->TabIndex = 3; + this->buttonWatchState->Text = L"ŠÏí’†"; + this->buttonWatchState->UseVisualStyleBackColor = false; + this->buttonWatchState->BackColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->buttonWatchState->Click += gcnew System::EventHandler(this, &OptionForm::buttonWatchState_Click); + // + // buttonVSState + // + this->buttonVSState->ForeColor = System::Drawing::SystemColors::WindowText; + this->buttonVSState->Location = System::Drawing::Point(16, 48); + this->buttonVSState->Name = L"buttonVSState"; + this->buttonVSState->Size = System::Drawing::Size(136, 20); + this->buttonVSState->TabIndex = 2; + this->buttonVSState->Text = L"‘Îí’†"; + this->buttonVSState->UseVisualStyleBackColor = false; + this->buttonVSState->BackColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->buttonVSState->Click += gcnew System::EventHandler(this, &OptionForm::buttonVSState_Click); + // + // buttonRestState + // + this->buttonRestState->ForeColor = System::Drawing::SystemColors::WindowText; + this->buttonRestState->Location = System::Drawing::Point(16, 20); + this->buttonRestState->Name = L"buttonRestState"; + this->buttonRestState->Size = System::Drawing::Size(136, 20); + this->buttonRestState->TabIndex = 1; + this->buttonRestState->Text = L"‹xŒe’†"; + this->buttonRestState->UseVisualStyleBackColor = false; + this->buttonRestState->BackColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + this->buttonRestState->Click += gcnew System::EventHandler(this, &OptionForm::buttonRestState_Click); + // + // groupBoxNameColor + // + this->groupBoxNameColor->Controls->Add(this->buttonClientName); + this->groupBoxNameColor->Controls->Add(this->buttonHostName); + this->groupBoxNameColor->Controls->Add(this->buttonServerName); + this->groupBoxNameColor->Location = System::Drawing::Point(8, 8); + this->groupBoxNameColor->Name = L"groupBoxNameColor"; + this->groupBoxNameColor->Size = System::Drawing::Size(168, 108); + this->groupBoxNameColor->TabIndex = 1; + this->groupBoxNameColor->TabStop = false; + this->groupBoxNameColor->Text = L"–¼‘O"; + // + // buttonClientName + // + this->buttonClientName->BackColor = System::Drawing::SystemColors::Window; + this->buttonClientName->Location = System::Drawing::Point(16, 76); + this->buttonClientName->Name = L"buttonClientName"; + this->buttonClientName->Size = System::Drawing::Size(136, 20); + this->buttonClientName->TabIndex = 3; + this->buttonClientName->Text = L"ƒNƒ‰ƒCƒAƒ“ƒg"; + this->buttonClientName->UseVisualStyleBackColor = false; + this->buttonClientName->Click += gcnew System::EventHandler(this, &OptionForm::buttonClientName_Click); + this->buttonClientName->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonHostName + // + this->buttonHostName->BackColor = System::Drawing::SystemColors::Window; + this->buttonHostName->Location = System::Drawing::Point(16, 48); + this->buttonHostName->Name = L"buttonHostName"; + this->buttonHostName->Size = System::Drawing::Size(136, 20); + this->buttonHostName->TabIndex = 2; + this->buttonHostName->Text = L"ƒzƒXƒg"; + this->buttonHostName->UseVisualStyleBackColor = false; + this->buttonHostName->Click += gcnew System::EventHandler(this, &OptionForm::buttonHostName_Click); + this->buttonHostName->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // buttonServerName + // + this->buttonServerName->BackColor = System::Drawing::SystemColors::Window; + this->buttonServerName->Location = System::Drawing::Point(16, 20); + this->buttonServerName->Name = L"buttonServerName"; + this->buttonServerName->Size = System::Drawing::Size(136, 20); + this->buttonServerName->TabIndex = 1; + this->buttonServerName->Text = L"ƒT[ƒo"; + this->buttonServerName->UseVisualStyleBackColor = false; + this->buttonServerName->Click += gcnew System::EventHandler(this, &OptionForm::buttonServerName_Click); + this->buttonServerName->ForeColorChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // tabPageVolume + // + this->tabPageVolume->Controls->Add(this->groupBoxMidi); + this->tabPageVolume->Controls->Add(this->groupBoxSE); + this->tabPageVolume->Controls->Add(this->groupBoxBGM); + this->tabPageVolume->Location = System::Drawing::Point(4, 22); + this->tabPageVolume->Name = L"tabPageVolume"; + this->tabPageVolume->Padding = System::Windows::Forms::Padding(3); + this->tabPageVolume->Size = System::Drawing::Size(369, 295); + this->tabPageVolume->TabIndex = 6; + this->tabPageVolume->Text = L"‰¹—Ê"; + this->tabPageVolume->UseVisualStyleBackColor = true; + // + // groupBoxMidi + // + this->groupBoxMidi->Controls->Add(this->labelMidi); + this->groupBoxMidi->Controls->Add(this->trackBarMidi); + this->groupBoxMidi->Location = System::Drawing::Point(8, 184); + this->groupBoxMidi->Name = L"groupBoxMidi"; + this->groupBoxMidi->Size = System::Drawing::Size(352, 52); + this->groupBoxMidi->TabIndex = 3; + this->groupBoxMidi->TabStop = false; + this->groupBoxMidi->Text = L"SW ƒVƒ“ƒZƒTƒCƒU"; + // + // labelMidi + // + this->labelMidi->AutoSize = true; + this->labelMidi->Location = System::Drawing::Point(8, 24); + this->labelMidi->Name = L"labelMidi"; + this->labelMidi->Size = System::Drawing::Size(29, 12); + this->labelMidi->TabIndex = 0; + this->labelMidi->Text = L"100%"; + // + // trackBarMidi + // + this->trackBarMidi->AutoSize = false; + this->trackBarMidi->LargeChange = 10; + this->trackBarMidi->Location = System::Drawing::Point(48, 12); + this->trackBarMidi->Maximum = 100; + this->trackBarMidi->Name = L"trackBarMidi"; + this->trackBarMidi->Size = System::Drawing::Size(296, 32); + this->trackBarMidi->TabIndex = 1; + this->trackBarMidi->TickFrequency = 10; + this->trackBarMidi->TickStyle = System::Windows::Forms::TickStyle::TopLeft; + this->trackBarMidi->Scroll += gcnew System::EventHandler(this, &OptionForm::trackBarMidi_Scroll); + // + // groupBoxSE + // + this->groupBoxSE->Controls->Add(this->labelSE); + this->groupBoxSE->Controls->Add(this->trackBarSE); + this->groupBoxSE->Location = System::Drawing::Point(8, 68); + this->groupBoxSE->Name = L"groupBoxSE"; + this->groupBoxSE->Size = System::Drawing::Size(352, 52); + this->groupBoxSE->TabIndex = 2; + this->groupBoxSE->TabStop = false; + this->groupBoxSE->Text = L"SE"; + // + // labelSE + // + this->labelSE->AutoSize = true; + this->labelSE->Location = System::Drawing::Point(8, 24); + this->labelSE->Name = L"labelSE"; + this->labelSE->Size = System::Drawing::Size(29, 12); + this->labelSE->TabIndex = 0; + this->labelSE->Text = L"100%"; + // + // trackBarSE + // + this->trackBarSE->AutoSize = false; + this->trackBarSE->LargeChange = 2; + this->trackBarSE->Location = System::Drawing::Point(48, 12); + this->trackBarSE->Maximum = 20; + this->trackBarSE->Name = L"trackBarSE"; + this->trackBarSE->Size = System::Drawing::Size(296, 32); + this->trackBarSE->TabIndex = 1; + this->trackBarSE->TickFrequency = 2; + this->trackBarSE->TickStyle = System::Windows::Forms::TickStyle::TopLeft; + this->trackBarSE->Scroll += gcnew System::EventHandler(this, &OptionForm::trackBarSE_Scroll); + // + // groupBoxBGM + // + this->groupBoxBGM->Controls->Add(this->labelBGM); + this->groupBoxBGM->Controls->Add(this->trackBarBGM); + this->groupBoxBGM->Location = System::Drawing::Point(8, 8); + this->groupBoxBGM->Name = L"groupBoxBGM"; + this->groupBoxBGM->Size = System::Drawing::Size(352, 52); + this->groupBoxBGM->TabIndex = 1; + this->groupBoxBGM->TabStop = false; + this->groupBoxBGM->Text = L"BGM"; + // + // labelBGM + // + this->labelBGM->AutoSize = true; + this->labelBGM->Location = System::Drawing::Point(8, 24); + this->labelBGM->Name = L"labelBGM"; + this->labelBGM->Size = System::Drawing::Size(29, 12); + this->labelBGM->TabIndex = 0; + this->labelBGM->Text = L"100%"; + // + // trackBarBGM + // + this->trackBarBGM->AutoSize = false; + this->trackBarBGM->LargeChange = 2; + this->trackBarBGM->Location = System::Drawing::Point(48, 12); + this->trackBarBGM->Maximum = 20; + this->trackBarBGM->Name = L"trackBarBGM"; + this->trackBarBGM->Size = System::Drawing::Size(296, 32); + this->trackBarBGM->TabIndex = 1; + this->trackBarBGM->TickFrequency = 2; + this->trackBarBGM->TickStyle = System::Windows::Forms::TickStyle::TopLeft; + this->trackBarBGM->Scroll += gcnew System::EventHandler(this, &OptionForm::trackBarBGM_Scroll); + // + // tabPageIP + // + this->tabPageIP->Controls->Add(this->AddPortbutton); + this->tabPageIP->Controls->Add(this->discriptionlabel); + this->tabPageIP->Controls->Add(this->Convertbutton); + this->tabPageIP->Controls->Add(this->Base64groupBox); + this->tabPageIP->Controls->Add(this->IPgroupBox); + this->tabPageIP->Location = System::Drawing::Point(4, 22); + this->tabPageIP->Name = L"tabPageIP"; + this->tabPageIP->Padding = System::Windows::Forms::Padding(3); + this->tabPageIP->Size = System::Drawing::Size(369, 295); + this->tabPageIP->TabIndex = 7; + this->tabPageIP->Text = L"IP‚Ì•ÏŠ·"; + this->tabPageIP->UseVisualStyleBackColor = true; + // + // AddPortbutton + // + this->AddPortbutton->Location = System::Drawing::Point(169, 233); + this->AddPortbutton->Name = L"AddPortbutton"; + this->AddPortbutton->Size = System::Drawing::Size(103, 24); + this->AddPortbutton->TabIndex = 4; + this->AddPortbutton->Text = L"ƒ|[ƒg•t‚«•ÏŠ·"; + this->AddPortbutton->UseVisualStyleBackColor = true; + this->AddPortbutton->Click += gcnew System::EventHandler(this, &OptionForm::AddPortbutton_Click); + // + // discriptionlabel + // + this->discriptionlabel->AutoSize = true; + this->discriptionlabel->Location = System::Drawing::Point(8, 8); + this->discriptionlabel->Name = L"discriptionlabel"; + this->discriptionlabel->Size = System::Drawing::Size(297, 48); + this->discriptionlabel->TabIndex = 3; + this->discriptionlabel->Text = L"IPƒAƒhƒŒƒX‚ð•ÏŠ·‚·‚邱‚Æ‚ÅA\r\nƒT[ƒo‚ðŒöŠJ‚·‚éۂ̃ŠƒXƒN‚𑽭ŒyŒ¸‚Å‚«‚Ü‚·B\r\n\r\nƒT[ƒo‚ðŒöŠJ‚·‚éÛ‚ÍA•ÏŠ·‚³‚ꂽƒAƒhƒŒƒX‚ðŒöŠJ‚µ‚Ä‚­‚¾‚³‚¢B"; + // + // Convertbutton + // + this->Convertbutton->Location = System::Drawing::Point(99, 233); + this->Convertbutton->Name = L"Convertbutton"; + this->Convertbutton->Size = System::Drawing::Size(64, 24); + this->Convertbutton->TabIndex = 2; + this->Convertbutton->Text = L"•ÏŠ·"; + this->Convertbutton->UseVisualStyleBackColor = true; + this->Convertbutton->Click += gcnew System::EventHandler(this, &OptionForm::Convertbutton_Click); + // + // Base64groupBox + // + this->Base64groupBox->Controls->Add(this->labelAddrMT); + this->Base64groupBox->Controls->Add(this->textBoxMTAddr); + this->Base64groupBox->Controls->Add(this->labelAddrBase64); + this->Base64groupBox->Controls->Add(this->Base64textBox); + this->Base64groupBox->Location = System::Drawing::Point(7, 130); + this->Base64groupBox->Name = L"Base64groupBox"; + this->Base64groupBox->Size = System::Drawing::Size(352, 84); + this->Base64groupBox->TabIndex = 1; + this->Base64groupBox->TabStop = false; + this->Base64groupBox->Text = L"•ÏŠ·Œã‚̃AƒhƒŒƒX"; + // + // labelAddrMT + // + this->labelAddrMT->AutoSize = true; + this->labelAddrMT->Location = System::Drawing::Point(22, 53); + this->labelAddrMT->Name = L"labelAddrMT"; + this->labelAddrMT->Size = System::Drawing::Size(47, 12); + this->labelAddrMT->TabIndex = 3; + this->labelAddrMT->Text = L"MTSP—p"; + // + // textBoxMTAddr + // + this->textBoxMTAddr->Location = System::Drawing::Point(75, 50); + this->textBoxMTAddr->Name = L"textBoxMTAddr"; + this->textBoxMTAddr->ReadOnly = true; + this->textBoxMTAddr->Size = System::Drawing::Size(271, 19); + this->textBoxMTAddr->TabIndex = 2; + // + // labelAddrBase64 + // + this->labelAddrBase64->AutoSize = true; + this->labelAddrBase64->Location = System::Drawing::Point(6, 21); + this->labelAddrBase64->Name = L"labelAddrBase64"; + this->labelAddrBase64->Size = System::Drawing::Size(63, 12); + this->labelAddrBase64->TabIndex = 1; + this->labelAddrBase64->Text = L"LilithPort—p"; + // + // Base64textBox + // + this->Base64textBox->Location = System::Drawing::Point(75, 18); + this->Base64textBox->MaxLength = 100; + this->Base64textBox->Name = L"Base64textBox"; + this->Base64textBox->ReadOnly = true; + this->Base64textBox->Size = System::Drawing::Size(271, 19); + this->Base64textBox->TabIndex = 0; + // + // IPgroupBox + // + this->IPgroupBox->Controls->Add(this->IPtextBox); + this->IPgroupBox->Location = System::Drawing::Point(7, 70); + this->IPgroupBox->Name = L"IPgroupBox"; + this->IPgroupBox->Size = System::Drawing::Size(352, 52); + this->IPgroupBox->TabIndex = 0; + this->IPgroupBox->TabStop = false; + this->IPgroupBox->Text = L"IPƒAƒhƒŒƒX"; + // + // IPtextBox + // + this->IPtextBox->AccessibleDescription = L""; + this->IPtextBox->Location = System::Drawing::Point(7, 19); + this->IPtextBox->MaxLength = 20; + this->IPtextBox->Name = L"IPtextBox"; + this->IPtextBox->Size = System::Drawing::Size(339, 19); + this->IPtextBox->TabIndex = 0; + this->IPtextBox->TextChanged += gcnew System::EventHandler(this, &OptionForm::IPtextBox_TextChanged); + // + // tabPageDetails + // + this->tabPageDetails->Controls->Add(this->groupBoxDetails); + this->tabPageDetails->Location = System::Drawing::Point(4, 22); + this->tabPageDetails->Name = L"tabPageDetails"; + this->tabPageDetails->Padding = System::Windows::Forms::Padding(3); + this->tabPageDetails->Size = System::Drawing::Size(369, 295); + this->tabPageDetails->TabIndex = 8; + this->tabPageDetails->Text = L"Ú×"; + this->tabPageDetails->UseVisualStyleBackColor = true; + // + // groupBoxDetails + // + this->groupBoxDetails->Controls->Add(this->checkBoxShowGameOption); + this->groupBoxDetails->Controls->Add(this->checkBoxNameFlash); + this->groupBoxDetails->Controls->Add(this->checkBoxGetIP); + this->groupBoxDetails->Controls->Add(this->checkBoxTalkFlash); + this->groupBoxDetails->Location = System::Drawing::Point(9, 7); + this->groupBoxDetails->Name = L"groupBoxDetails"; + this->groupBoxDetails->Size = System::Drawing::Size(351, 282); + this->groupBoxDetails->TabIndex = 0; + this->groupBoxDetails->TabStop = false; + this->groupBoxDetails->Text = L"Ú×Ý’è"; + // + // checkBoxShowGameOption + // + this->checkBoxShowGameOption->AutoSize = true; + this->checkBoxShowGameOption->Location = System::Drawing::Point(8, 85); + this->checkBoxShowGameOption->Name = L"checkBoxShowGameOption"; + this->checkBoxShowGameOption->Size = System::Drawing::Size(199, 16); + this->checkBoxShowGameOption->TabIndex = 3; + this->checkBoxShowGameOption->Text = L"ƒQ[ƒ€‹N“®Žž‚É‘ÎíÝ’è‚ð•\Ž¦‚·‚é"; + this->checkBoxShowGameOption->UseVisualStyleBackColor = true; + this->checkBoxShowGameOption->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxNameFlash + // + this->checkBoxNameFlash->AutoSize = true; + this->checkBoxNameFlash->Location = System::Drawing::Point(8, 40); + this->checkBoxNameFlash->Name = L"checkBoxNameFlash"; + this->checkBoxNameFlash->Size = System::Drawing::Size(203, 16); + this->checkBoxNameFlash->TabIndex = 1; + this->checkBoxNameFlash->Text = L"–¼‘O‚ªŒÄ‚΂ꂽ‚çƒEƒBƒ“ƒhƒE‚ð“_–Å‚·‚é"; + this->checkBoxNameFlash->UseVisualStyleBackColor = true; + this->checkBoxNameFlash->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxGetIP + // + this->checkBoxGetIP->AutoSize = true; + this->checkBoxGetIP->Location = System::Drawing::Point(8, 62); + this->checkBoxGetIP->Name = L"checkBoxGetIP"; + this->checkBoxGetIP->Size = System::Drawing::Size(200, 16); + this->checkBoxGetIP->TabIndex = 2; + this->checkBoxGetIP->Text = L"Server‹N“®Žž‚ÉIPƒAƒhƒŒƒX‚ðŽæ“¾‚·‚é"; + this->checkBoxGetIP->UseVisualStyleBackColor = true; + this->checkBoxGetIP->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxTalkFlash + // + this->checkBoxTalkFlash->AutoSize = true; + this->checkBoxTalkFlash->Location = System::Drawing::Point(8, 18); + this->checkBoxTalkFlash->Name = L"checkBoxTalkFlash"; + this->checkBoxTalkFlash->Size = System::Drawing::Size(153, 16); + this->checkBoxTalkFlash->TabIndex = 0; + this->checkBoxTalkFlash->Text = L"”­Œ¾‚ŃEƒBƒ“ƒhƒE‚ð“_–Å‚·‚é"; + this->checkBoxTalkFlash->UseVisualStyleBackColor = true; + this->checkBoxTalkFlash->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // checkBoxShowResult + // + this->checkBoxShowResult->AutoSize = true; + this->checkBoxShowResult->Location = System::Drawing::Point(16, 64); + this->checkBoxShowResult->Name = L"checkBoxShowResult"; + this->checkBoxShowResult->Size = System::Drawing::Size(72, 16); + this->checkBoxShowResult->TabIndex = 5; + this->checkBoxShowResult->Text = L"‘Îퟔs"; + this->checkBoxShowResult->UseVisualStyleBackColor = true; + this->checkBoxShowResult->CheckedChanged += gcnew System::EventHandler(this, &OptionForm::ApplyButtonEnable); + // + // OptionForm + // + this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->AutoScroll = true; + this->ClientSize = System::Drawing::Size(377, 362); + this->Controls->Add(this->tabControlOption); + this->Controls->Add(this->buttonApply); + this->Controls->Add(this->buttonCancel); + this->Controls->Add(this->buttonOK); + this->Icon = (cli::safe_cast(resources->GetObject(L"$this.Icon"))); + this->MaximizeBox = false; + this->MinimizeBox = false; + this->Name = L"OptionForm"; + this->ShowInTaskbar = false; + this->Text = L"ƒIƒvƒVƒ‡ƒ“"; + this->Load += gcnew System::EventHandler(this, &OptionForm::OptionForm_Load); + this->Shown += gcnew System::EventHandler(this, &OptionForm::OptionForm_Shown); + this->FormClosed += gcnew System::Windows::Forms::FormClosedEventHandler(this, &OptionForm::OptionForm_FormClosed); + this->tabPageSound->ResumeLayout(false); + this->groupBoxKeywordSound->ResumeLayout(false); + this->groupBoxKeywordSound->PerformLayout(); + this->groupBoxSeekSound->ResumeLayout(false); + this->groupBoxSeekSound->PerformLayout(); + this->groupBoxTalkSound->ResumeLayout(false); + this->groupBoxTalkSound->PerformLayout(); + this->groupBoxName->ResumeLayout(false); + this->groupBoxName->PerformLayout(); + this->groupBoxEnterSound->ResumeLayout(false); + this->groupBoxEnterSound->PerformLayout(); + this->groupBoxNoticeSound->ResumeLayout(false); + this->groupBoxNoticeSound->PerformLayout(); + this->groupBoxVSSound->ResumeLayout(false); + this->groupBoxVSSound->PerformLayout(); + this->tabPagePath->ResumeLayout(false); + this->groupBoxProfile->ResumeLayout(false); + this->groupBoxProfile->PerformLayout(); + this->groupBoxReplayFolder->ResumeLayout(false); + this->groupBoxReplayFolder->PerformLayout(); + this->groupBoxNet->ResumeLayout(false); + this->groupBoxNet->PerformLayout(); + (cli::safe_cast(this->numericUpDownMaxConnection))->EndInit(); + this->groupBoxGameExe->ResumeLayout(false); + this->groupBoxGameExe->PerformLayout(); + this->groupBoxSave->ResumeLayout(false); + this->groupBoxSave->PerformLayout(); + this->tabControlOption->ResumeLayout(false); + this->tabPageGame->ResumeLayout(false); + this->groupBoxTeamOption->ResumeLayout(false); + this->groupBoxTeamOption->PerformLayout(); + this->groupBoxSimulate->ResumeLayout(false); + this->groupBoxSimulate->PerformLayout(); + (cli::safe_cast(this->numericUpDownSimDelay))->EndInit(); + this->groupBoxRun->ResumeLayout(false); + this->groupBoxRun->PerformLayout(); + this->groupBoxView->ResumeLayout(false); + this->groupBoxView->PerformLayout(); + this->groupBoxSetting->ResumeLayout(false); + this->groupBoxSetting->PerformLayout(); + (cli::safe_cast(this->numericUpDownRound))->EndInit(); + (cli::safe_cast(this->numericUpDownTimer))->EndInit(); + (cli::safe_cast(this->numericUpDownMaxStage))->EndInit(); + (cli::safe_cast(this->numericUpDownStageSelect))->EndInit(); + this->tabPageColor->ResumeLayout(false); + this->groupBoxMessageColor->ResumeLayout(false); + this->groupBoxOthersColor->ResumeLayout(false); + this->groupBoxStateColor->ResumeLayout(false); + this->groupBoxNameColor->ResumeLayout(false); + this->tabPageVolume->ResumeLayout(false); + this->groupBoxMidi->ResumeLayout(false); + this->groupBoxMidi->PerformLayout(); + (cli::safe_cast(this->trackBarMidi))->EndInit(); + this->groupBoxSE->ResumeLayout(false); + this->groupBoxSE->PerformLayout(); + (cli::safe_cast(this->trackBarSE))->EndInit(); + this->groupBoxBGM->ResumeLayout(false); + this->groupBoxBGM->PerformLayout(); + (cli::safe_cast(this->trackBarBGM))->EndInit(); + this->tabPageIP->ResumeLayout(false); + this->tabPageIP->PerformLayout(); + this->Base64groupBox->ResumeLayout(false); + this->Base64groupBox->PerformLayout(); + this->IPgroupBox->ResumeLayout(false); + this->IPgroupBox->PerformLayout(); + this->tabPageDetails->ResumeLayout(false); + this->groupBoxDetails->ResumeLayout(false); + this->groupBoxDetails->PerformLayout(); + this->ResumeLayout(false); + + } +#pragma endregion + protected: + HMIXER hMixer; + DWORD MixerControlID; + DWORD MixerVolumeMin, MixerVolumeMax; + + void AdviceGameExe(){ + textBoxGameExe->Text = gcnew String("‰E‚̃{ƒ^ƒ“‚ð‰Ÿ‚µ‚ăpƒX‚ðݒ肵‚Ä‚­‚¾‚³‚¢"); + textBoxGameExe->Focus(); + } + + void CheckStageValue(){ + if(numericUpDownStageSelect->Value > numericUpDownMaxStage->Value){ + labelMaxStage->Text = gcnew String("ŠJŽnƒXƒe[ƒW"); + labelStageSelect->Text = gcnew String("I’[ƒXƒe[ƒW"); + } + else{ + labelMaxStage->Text = gcnew String("Å‘åƒXƒe[ƒW”"); + labelStageSelect->Text = gcnew String("‘ÎíƒXƒe[ƒW"); + } + + if(numericUpDownStageSelect->Value == 0){ + labelStageSelect->Text = gcnew String("ƒ‰ƒ“ƒ_ƒ€ƒXƒe[ƒW"); + } + } + + // OptionForm.cpp + void SaveOption(bool apply); + void CloseOption(); + void DeleteProfile(String^ buf); + bool CheckTextProfileName(String^ buf); + void OverWriteProfile(String^ buf); + + public: + bool GameExePathError; + + void SetGameExePath(String^% path){ + textBoxGameExe->Text = path; + } + + private: + System::Void OptionForm_Load(System::Object^ sender, System::EventArgs^ e) { + + textBoxGameExe->MaxLength = _MAX_PATH; + textBoxReplayFolder->MaxLength = _MAX_PATH; + textBoxVSSound->MaxLength = _MAX_PATH; + textBoxNoticeSound->MaxLength = _MAX_PATH; + textBoxEnterSound->MaxLength = _MAX_PATH; + textBoxTalkSound->MaxLength = _MAX_PATH; + textBoxSeekSound->MaxLength = _MAX_PATH; + textBoxKeywordSoundPath->MaxLength = _MAX_PATH; + + textBoxComment->MaxLength = MAX_NAME; + + comboBoxProfile->Items->Clear(); + for(int i=0; i < Profile::ProfileList->Count; i++){ + comboBoxProfile->Items->Add(Profile::ProfileList[i]); + if(Profile::ProfileList[i] == gcnew String(MTOPTION.PROFILE)){ + comboBoxProfile->SelectedIndex = i; + } + } + + textBoxGameExe->Text = gcnew String(MTOPTION.GAME_EXE); + textBoxReplayFolder->Text = gcnew String(MTOPTION.REPLAY_FOLDER); + textBoxComment->Text = gcnew String(MTOPTION.COMMENT); + textBoxVSSound->Text = gcnew String(MTOPTION.VS_SOUND); + textBoxNoticeSound->Text = gcnew String(MTOPTION.NOTICE_SOUND); + textBoxEnterSound->Text = gcnew String(MTOPTION.ENTER_SOUND); + textBoxNameSound->Text = gcnew String(MTOPTION.NAME_SOUND); + textBoxTalkSound->Text = gcnew String(MTOPTION.TALK_SOUND); + textBoxSeekSound->Text = gcnew String(MTOPTION.SEEK_SOUND); + textBoxKeywordSoundPath->Text = gcnew String(MTOPTION.KEYWORD_SOUND); + textBoxKeyword->Text = gcnew String(MTOPTION.KEYWORD); + + // ƒpƒX‚̃ZƒŒƒNƒVƒ‡ƒ“‚ð––”ö‚É + textBoxGameExe->SelectionStart = textBoxGameExe->Text->Length; + textBoxReplayFolder->SelectionStart = textBoxReplayFolder->Text->Length; + textBoxComment->SelectionStart = textBoxComment->Text->Length; + textBoxVSSound->SelectionStart = textBoxVSSound->Text->Length; + textBoxNoticeSound->SelectionStart = textBoxNoticeSound->Text->Length; + textBoxEnterSound->SelectionStart = textBoxEnterSound->Text->Length; + textBoxNameSound->SelectionStart = textBoxNameSound->Text->Length; + textBoxTalkSound->SelectionStart = textBoxTalkSound->Text->Length; + textBoxSeekSound->SelectionStart = textBoxSeekSound->Text->Length; + textBoxKeywordSoundPath->SelectionStart = textBoxKeywordSoundPath->Text->Length; + + checkBoxVSSound->Checked = MTOPTION.VS_SOUND_ENABLE; + checkBoxNoticeSound->Checked = MTOPTION.NOTICE_SOUND_ENABLE; + checkBoxEnterSound->Checked = MTOPTION.ENTER_SOUND_ENABLE; + checkBoxNameSound->Checked = MTOPTION.NAME_SOUND_ENABLE; + checkBoxTalkSound->Checked = MTOPTION.TALK_SOUND_ENABLE; + checkBoxSeekSound->Checked = MTOPTION.SEEK_SOUND_ENABLE; + checkBoxKeywordSound->Checked = MTOPTION.KEYWORD_SOUND_ENABLE; + + checkBoxGetIP->Checked = MTOPTION.GET_IP_ENABLE; + checkBoxShowGameOption->Checked = MTOPTION.SHOW_GAME_OPTION; + checkBoxShowResult->Checked = MTOPTION.SHOW_RESULT; + + numericUpDownMaxConnection->Value = MTOPTION.MAX_CONNECTION; + trackBarBGM->Value = MTOPTION.BGM_VOLUME / 5; + trackBarSE->Value = MTOPTION.SE_VOLUME / 5; + numericUpDownMaxStage->Value = MTOPTION.MAX_STAGE; + numericUpDownStageSelect->Value = MTOPTION.STAGE_SELECT; + numericUpDownRound->Value = MTOPTION.ROUND; + numericUpDownTimer->Value = MTOPTION.TIMER; + numericUpDownSimDelay->Value = MTOPTION.SIMULATE_DELAY; + checkBoxHitJudge->Checked = MTOPTION.HIT_JUDGE; + checkBoxName->Checked = MTOPTION.DISPLAY_NAME; + checkBoxVersus->Checked = MTOPTION.DISPLAY_VERSUS; + checkBoxFramerate->Checked = MTOPTION.DISPLAY_FRAMERATE; + checkBoxRand->Checked = MTOPTION.DISPLAY_RAND; + checkBoxDivide->Checked = MTOPTION.REPLAY_DIVIDE; + checkBoxWindowSize->Checked = MTOPTION.CHANGE_WINDOW_SIZE; + checkBoxTalkFlash->Checked = MTOPTION.TALK_FLASH; + checkBoxNameFlash->Checked = MTOPTION.NAME_FLASH; + checkBoxTeamRoundHP->Checked = MTOPTION.TEAM_ROUND_HP; + + CheckStageValue(); + + labelBGM->Text = String::Format("{0,3}%", trackBarBGM->Value * 5); + labelSE->Text = String::Format("{0,3}%", trackBarSE->Value * 5); + + if(MTOPTION.REPLAY_VERSION == 2){ + radioButtonReplayVersion1->Checked = false; + radioButtonReplayVersion2->Checked = true; + } + else{ + radioButtonReplayVersion1->Checked = true; + radioButtonReplayVersion2->Checked = false; + } + + buttonServerName->ForeColor = Color::FromArgb(MTCOLOR.SERVER_NAME); + buttonHostName->ForeColor = Color::FromArgb(MTCOLOR.HOST_NAME); + buttonClientName->ForeColor = Color::FromArgb(MTCOLOR.CLIENT_NAME); + buttonRestState->BackColor = Color::FromArgb(MTCOLOR.REST_STATE); + buttonVSState->BackColor = Color::FromArgb(MTCOLOR.VS_STATE); + buttonWatchState->BackColor = Color::FromArgb(MTCOLOR.WATCH_STATE); + buttonSeekState->BackColor = Color::FromArgb(MTCOLOR.SEEK_STATE); + + buttonSystemMessage->ForeColor = Color::FromArgb(MTCOLOR.SYSTEM_MESSAGE); + buttonErrorMessage->ForeColor = Color::FromArgb(MTCOLOR.ERROR_MESSAGE); + buttonDebugMessage->ForeColor = Color::FromArgb(MTCOLOR.DEBUG_MESSAGE); + buttonNoticeBack->BackColor = Color::FromArgb(MTCOLOR.NOTICE_BACK); + buttonCommentBack->BackColor = Color::FromArgb(MTCOLOR.COMMENT_BACK); + buttonSecret->ForeColor = Color::FromArgb(MTCOLOR.SECRET); + + // SWƒVƒ“ƒZ + try{ + hMixer = NULL; + pin_ptr p_hm = &hMixer; + + if(mixerOpen(p_hm, 0, 0, 0, MIXER_OBJECTF_MIXER) != MMSYSERR_NOERROR){ + throw gcnew Exception; + } + else{ + // €”õ + MIXERLINE line; + MIXERLINECONTROLS lc; + MIXERCONTROL ctrl; + + line.cbStruct = sizeof(MIXERLINE); + line.dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER; + + if(mixerGetLineInfo((HMIXEROBJ)hMixer, &line, MIXER_OBJECTF_HMIXER | MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR){ + throw gcnew Exception; + } + + lc.cbStruct = sizeof(MIXERLINECONTROLS); + lc.dwLineID = line.dwLineID; + lc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME; + lc.cControls = 1; + lc.cbmxctrl = sizeof(MIXERCONTROL); + lc.pamxctrl = &ctrl; + + if(mixerGetLineControls((HMIXEROBJ)hMixer, &lc, MIXER_OBJECTF_HMIXER | MIXER_GETLINECONTROLSF_ONEBYTYPE) != MMSYSERR_NOERROR){ + throw gcnew Exception; + } + + MixerControlID = ctrl.dwControlID; + MixerVolumeMin = ctrl.Bounds.dwMinimum; + MixerVolumeMax = ctrl.Bounds.dwMaximum; + + // ‰¹—ʎ擾 + MIXERCONTROLDETAILS mcd; + MIXERCONTROLDETAILS_UNSIGNED vol; + + mcd.cbStruct = sizeof(MIXERCONTROLDETAILS); + mcd.dwControlID = ctrl.dwControlID; + mcd.cChannels = 1; + mcd.cMultipleItems = 0; + mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); + mcd.paDetails = &vol; + + if(mixerGetControlDetails((HMIXEROBJ)hMixer, &mcd, MIXER_OBJECTF_HMIXER | MIXER_GETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR){ + throw gcnew Exception; + } + + DWORD delta = MixerVolumeMax - MixerVolumeMin; + trackBarMidi->Value = ((vol.dwValue - MixerVolumeMin)*100 + delta/2)/delta; + + labelMidi->Text = String::Format("{0,3}%", trackBarMidi->Value); + } + } + catch(Exception^){ + if(hMixer != NULL){ + mixerClose(hMixer); + hMixer = NULL; + } + + labelMidi->Text = gcnew String("xxx"); + groupBoxMidi->Enabled = false; + } + + if(MTWS.DIALOG_LEFT > 0 && MTWS.DIALOG_TOP > 0){ + this->StartPosition = FormStartPosition::Manual; + this->Location = Point(MTWS.DIALOG_LEFT, MTWS.DIALOG_TOP); + } + + buttonApply->Enabled = false; + } + + System::Void OptionForm_Shown(System::Object^ sender, System::EventArgs^ e) { + if(GameExePathError){ + AdviceGameExe(); + } + } + + System::Void OptionForm_FormClosed(System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e) { + if(hMixer != NULL){ + mixerClose(hMixer); + hMixer = NULL; + } + + MTWS.DIALOG_LEFT = this->Location.X; + MTWS.DIALOG_TOP = this->Location.Y; + + CloseOption(); + + this->Owner->Focus(); + } + + System::Void buttonOK_Click(System::Object^ sender, System::EventArgs^ e) { + if(buttonApply->Enabled){ + buttonApply->Enabled = false; + + SaveOption(false); + } + + this->Close(); + } + + System::Void buttonApply_Click(System::Object^ sender, System::EventArgs^ e) { + buttonApply->Enabled = false; + + SaveOption(true); + } + + System::Void buttonCancel_Click(System::Object^ sender, System::EventArgs^ e) { + this->Close(); + } + + System::Void buttonGameExe_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("Ši“¬ƒcƒN[ƒ‹‚ÌŽÀsƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("exe file (*.exe)|*.exe"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(openFileDialog1->FileName); + + if(info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd." || info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T"){ + textBoxGameExe->Text = openFileDialog1->FileName; + } + else{ + textBoxGameExe->Text = "Ši“¬ƒcƒN[ƒ‹‚ÌŽÀsƒtƒ@ƒCƒ‹‚Å‚Í‚ ‚è‚Ü‚¹‚ñ"; + textBoxGameExe->SelectAll(); + textBoxGameExe->Focus(); + } + } + } + + System::Void buttonReplayFolder_Click(System::Object^ sender, System::EventArgs^ e) { + if(folderBrowserDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxReplayFolder->Text = folderBrowserDialog1->SelectedPath; + } + } + + System::Void buttonVSSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("‘Î펞‚ɖ‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxVSSound->Text = openFileDialog1->FileName; + } + } + + System::Void buttonNoticeSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("’mŽóMŽž‚ɖ‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxNoticeSound->Text = openFileDialog1->FileName; + } + } + + System::Void buttonEnterSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("ƒƒ“ƒo[“üŽºŽž‚ɖ‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxEnterSound->Text = openFileDialog1->FileName; + } + } + + System::Void buttonNameSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("ƒjƒbƒNƒl[ƒ€‚ªŒÄ‚΂ꂽ‚ç–‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxNameSound->Text = openFileDialog1->FileName; + } + } + + System::Void buttonTalkSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("”­Œ¾‚Ŗ‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxTalkSound->Text = openFileDialog1->FileName; + } + } + + System::Void buttonSeekSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("‘Îí•åW‚Ŗ‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxSeekSound->Text = openFileDialog1->FileName; + } + } + + System::Void buttonKeywordSound_Click(System::Object^ sender, System::EventArgs^ e) { + openFileDialog1->Title = gcnew String("ƒL[ƒ[ƒh‚Ŗ‚炷‰¹ºƒtƒ@ƒCƒ‹"); + openFileDialog1->Filter = gcnew String("wav file (*.wav)|*.wav"); + + if(openFileDialog1->ShowDialog() == ::DialogResult::OK){ + textBoxKeywordSoundPath->Text = openFileDialog1->FileName; + } + } + + System::Void ApplyButtonEnable(System::Object^ sender, System::EventArgs^ e) { + buttonApply->Enabled = true; + } + + System::Void numericUpDownStage_ValueChanged(System::Object^ sender, System::EventArgs^ e) { + buttonApply->Enabled = true; + + CheckStageValue(); + } + + System::Void buttonServerName_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonServerName->ForeColor = colorDialog1->Color; + } + } + + System::Void buttonHostName_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonHostName->ForeColor = colorDialog1->Color; + } + } + + System::Void buttonClientName_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonClientName->ForeColor = colorDialog1->Color; + } + } + + System::Void buttonRestState_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonRestState->BackColor = colorDialog1->Color; + } + } + + System::Void buttonVSState_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonVSState->BackColor = colorDialog1->Color; + } + } + + System::Void buttonWatchState_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonWatchState->BackColor = colorDialog1->Color; + } + } + + System::Void buttonSeekState_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonSeekState->BackColor = colorDialog1->Color; + } + } + + System::Void buttonSystemMessage_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonSystemMessage->ForeColor = colorDialog1->Color; + } + } + + System::Void buttonErrorMessage_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonErrorMessage->ForeColor = colorDialog1->Color; + } + } + + System::Void buttonDebugMessage_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonDebugMessage->ForeColor = colorDialog1->Color; + } + } + + System::Void buttonNoticeBack_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonNoticeBack->BackColor = colorDialog1->Color; + } + } + + System::Void buttonCommentBack_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonCommentBack->BackColor = colorDialog1->Color; + } + } + + System::Void buttonSecret_Click(System::Object^ sender, System::EventArgs^ e) { + if(colorDialog1->ShowDialog() == ::DialogResult::OK){ + buttonSecret->ForeColor = colorDialog1->Color; + } + } + + System::Void trackBarBGM_Scroll(System::Object^ sender, System::EventArgs^ e) { + buttonApply->Enabled = true; + + labelBGM->Text = String::Format("{0,3}%", trackBarBGM->Value * 5); + } + + System::Void trackBarSE_Scroll(System::Object^ sender, System::EventArgs^ e) { + buttonApply->Enabled = true; + + labelSE->Text = String::Format("{0,3}%", trackBarSE->Value * 5); + } + + System::Void trackBarMidi_Scroll(System::Object^ sender, System::EventArgs^ e) { + labelMidi->Text = String::Format("{0,3}%", trackBarMidi->Value); + + MIXERCONTROLDETAILS mcd; + MIXERCONTROLDETAILS_UNSIGNED vol; + + vol.dwValue = trackBarMidi->Value*(MixerVolumeMax - MixerVolumeMin)/100 + MixerVolumeMin; + + mcd.cbStruct = sizeof(MIXERCONTROLDETAILS); + mcd.dwControlID = MixerControlID; + mcd.cChannels = 1; + mcd.cMultipleItems = 0; + mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); + mcd.paDetails = &vol; + + if(mixerSetControlDetails((HMIXEROBJ)hMixer, &mcd, MIXER_OBJECTF_HMIXER | MIXER_SETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR){ + if(hMixer != NULL){ + mixerClose(hMixer); + hMixer = NULL; + } + + labelMidi->Text = gcnew String("xxx"); + groupBoxMidi->Enabled = false; + } + } + + System::Void textBoxGameExe_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + e->Effect = DragDropEffects::None; + + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + array^ file = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false)); + String^ extension = Path::GetExtension(file[0])->ToLower(); + FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(file[0]); + + if(extension == ".exe" && (info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹2nd." || info->FileDescription == "‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T")){ + e->Effect = DragDropEffects::All; + } + } + } + + System::Void textBoxGameExe_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxGameExe->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxReplayFolder_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + e->Effect = DragDropEffects::None; + + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + array^ file = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false)); + String^ extension = Path::GetExtension(file[0]); + + if(extension == String::Empty){ + e->Effect = DragDropEffects::All; + } + } + } + + System::Void textBoxReplayFolder_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxReplayFolder->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxSound_DragEnter(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + e->Effect = DragDropEffects::None; + + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + array^ file = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false)); + String^ extension = Path::GetExtension(file[0])->ToLower(); + + if(extension == ".wav"){ + e->Effect = DragDropEffects::All; + } + } + } + + System::Void textBoxVSSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxVSSound->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxNoticeSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxNoticeSound->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxEnterSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxEnterSound->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxNameSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxNameSound->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxTalkSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxTalkSound->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxSeekSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxSeekSound->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + System::Void textBoxKeywordSound_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) { + if(e->Data->GetDataPresent(DataFormats::FileDrop)){ + textBoxKeywordSoundPath->Text = safe_cast^>(e->Data->GetData(DataFormats::FileDrop, false))[0]; + } + } + + // Ķƒ{ƒ^ƒ“ + System::Void buttonVSSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.VS_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + System::Void buttonEnterSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.ENTER_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + System::Void buttonNoticeSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.NOTICE_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + System::Void buttonNameSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.NAME_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + System::Void buttonTalkSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.TALK_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + System::Void buttonSeekSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.SEEK_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + System::Void buttonKeywordSoundPlay_Click(System::Object^ sender, System::EventArgs^ e) { + try{ + Media::SoundPlayer^ wav = gcnew Media::SoundPlayer(gcnew String(MTOPTION.KEYWORD_SOUND)); + wav->Play(); + } + catch(Exception^){ + } + } + + // IP“ü—̓`ƒFƒbƒN + System::Void IPtextBox_TextChanged(System::Object^ sender, System::EventArgs^ e) { + if(Net::IPAddress::TryParse(IPtextBox->Text, gcnew Net::IPAddress(0)) == false){ + Convertbutton->Enabled = false; + AddPortbutton->Enabled = false; + } + else{ + Convertbutton->Enabled = true; + AddPortbutton->Enabled = true; + } + } + // IP‚Ì•ÏŠ· + System::Void Convertbutton_Click(System::Object^ sender, System::EventArgs^ e) { + Base64textBox->Text = EncryptionIP(IPtextBox->Text); + textBoxMTAddr->Text = MTEncryptionIP(IPtextBox->Text); + } + // ƒ|[ƒg•t‚«IP‚Ì•ÏŠ· + System::Void AddPortbutton_Click(System::Object^ sender, System::EventArgs^ e) { + Base64textBox->Text = String::Format("{0}:{1}", EncryptionIP(IPtextBox->Text), MTOPTION.OPEN_PORT); + textBoxMTAddr->Text = String::Format("{0}:{1}", MTEncryptionIP(IPtextBox->Text), MTOPTION.OPEN_PORT); + } + // ƒvƒƒtƒ@ƒCƒ‹ƒRƒ“ƒ{ƒ{ƒbƒNƒX•ÏX + System::Void comboBoxProfile_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { + String^ buf = ((ComboBox^)sender)->Text; + String^ bufProfile = gcnew String(MTOPTION.PROFILE); + + if(buf != bufProfile){ + // Ø‚è‘Ö‚¦ + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(buf); + _tcscpy_s(MTOPTION.PROFILE, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + LoadMTOption(); + + // ƒvƒƒtƒ@ƒCƒ‹ƒZƒNƒVƒ‡ƒ“‚ÌÝ’è’l‚ðXV + textBoxGameExe->Text = gcnew String(MTOPTION.GAME_EXE); + textBoxReplayFolder->Text = gcnew String(MTOPTION.REPLAY_FOLDER); + textBoxGameExe->SelectionStart = textBoxGameExe->Text->Length; + textBoxReplayFolder->SelectionStart = textBoxReplayFolder->Text->Length; + numericUpDownMaxStage->Value = MTOPTION.MAX_STAGE; + numericUpDownStageSelect->Value = MTOPTION.STAGE_SELECT; + numericUpDownRound->Value = MTOPTION.ROUND; + numericUpDownTimer->Value = MTOPTION.TIMER; + numericUpDownSimDelay->Value = MTOPTION.SIMULATE_DELAY; + checkBoxHitJudge->Checked = MTOPTION.HIT_JUDGE; + checkBoxName->Checked = MTOPTION.DISPLAY_NAME; + checkBoxVersus->Checked = MTOPTION.DISPLAY_VERSUS; + checkBoxFramerate->Checked = MTOPTION.DISPLAY_FRAMERATE; + checkBoxRand->Checked = MTOPTION.DISPLAY_RAND; + checkBoxDivide->Checked = MTOPTION.REPLAY_DIVIDE; + checkBoxWindowSize->Checked = MTOPTION.CHANGE_WINDOW_SIZE; + checkBoxTeamRoundHP->Checked = MTOPTION.TEAM_ROUND_HP; + CheckStageValue(); + if(MTOPTION.REPLAY_VERSION == 2){ + radioButtonReplayVersion1->Checked = false; + radioButtonReplayVersion2->Checked = true; + } + else{ + radioButtonReplayVersion1->Checked = true; + radioButtonReplayVersion2->Checked = false; + } + } + textBoxProfileName->Text = buf; + buttonApply->Enabled = false; + } + System::Void buttonCopyProfile_Click(System::Object^ sender, System::EventArgs^ e) { + // ƒvƒƒtƒ@ƒCƒ‹•¡» + String^ mes; + String^ buf = comboBoxProfile->Items[comboBoxProfile->SelectedIndex]->ToString(); + String^ bufClone = String::Format("{0}{1}", buf, "_"); + if(buf->Length > MAX_ARRAY-1){ + mes = "ƒvƒƒtƒ@ƒCƒ‹–¼‚ª’·‚·‚¬‚Ü‚·B\n•¡»‚ðs‚¤‚É‚ÍAƒvƒƒtƒ@ƒCƒ‹–¼‚ð’Z‚­‚µ‚Ä‚­‚¾‚³‚¢B"; + } + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(Profile::ProfileList[i] == bufClone){ + mes = "Šù‚É•¡»‚³‚ꂽƒvƒƒtƒ@ƒCƒ‹‚ª‘¶Ý‚µ‚Ü‚·B"; + } + } + if(Profile::ProfileList->Count > 31){ + mes = "‚±‚êˆÈãƒvƒƒtƒ@ƒCƒ‹‚ð쬂ł«‚Ü‚¹‚ñB"; + return; + } + if(mes != nullptr){ + MessageBox::Show(mes, "ƒvƒƒtƒ@ƒCƒ‹•¡»", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + Profile::ProfileList->Add(bufClone); + comboBoxProfile->Items->Add(bufClone); + + IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(bufClone); + _tcscpy_s(MTOPTION.PROFILE, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + SaveOption(true); + + comboBoxProfile->SelectedIndex = comboBoxProfile->Items->Count-1; + buttonApply->Enabled = false; + + } + System::Void buttonDeleteProfile_Click(System::Object^ sender, System::EventArgs^ e) { + // ƒvƒƒtƒ@ƒCƒ‹íœ + int index = comboBoxProfile->SelectedIndex; + String^ buf = comboBoxProfile->Items[index]->ToString(); + if(MessageBox::Show(String::Format("{0}‚ð휂µ‚Ü‚·B\n‚æ‚낵‚¢‚Å‚·‚©H", buf), "ƒvƒƒtƒ@ƒCƒ‹íœ", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == ::DialogResult::Yes){ + Profile::ProfileList->RemoveAt(index); + comboBoxProfile->Items->RemoveAt(index); + + DeleteProfile(buf); + + comboBoxProfile->SelectedIndex = 0; + }else{ + return; + } + } + System::Void buttonAddProfile_Click(System::Object^ sender, System::EventArgs^ e) { + // ƒvƒƒtƒ@ƒCƒ‹’ljÁ + String^ bufText = textBoxProfileName->Text; + if(CheckTextProfileName(bufText)){ + return; + } + if(Profile::ProfileList->Count > 31){ + MessageBox::Show("‚±‚êˆÈãƒvƒƒtƒ@ƒCƒ‹‚ð쬂ł«‚Ü‚¹‚ñB", "ƒvƒƒtƒ@ƒCƒ‹’ljÁ", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + + Profile::ProfileList->Add(bufText); + comboBoxProfile->Items->Add(bufText); + + SaveOption(true); + + buttonApply->Enabled = false; + } + System::Void buttonSaveProfile_Click(System::Object^ sender, System::EventArgs^ e) { + // ƒvƒƒtƒ@ƒCƒ‹•Û‘¶ + String^ bufText = textBoxProfileName->Text; + String^ bufSelectedItem = comboBoxProfile->SelectedItem->ToString(); + if(CheckTextProfileName(bufText)){ + return; + } + // ã‘‚« + if(bufText != bufSelectedItem){ + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(Profile::ProfileList[i] == gcnew String(MTOPTION.PROFILE)){ + Profile::ProfileList[i] = bufText; + } + } + OverWriteProfile(bufText); + + comboBoxProfile->Items[comboBoxProfile->SelectedIndex] = bufText; + } + } + }; +} diff --git a/LilithPort/OptionForm.resx b/LilithPort/OptionForm.resx new file mode 100644 index 0000000..5380199 --- /dev/null +++ b/LilithPort/OptionForm.resx @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 149, 17 + + + 310, 17 + + + + + AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAABtMauCNqtwMKxyMa1uK6lJDH0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB9NszU3f/Y + nv/YqP/VpP88AHR+NMKgZdp3OL9RHH8AAAAAAAAAAAAAAAAAAAAAAABzLcHyvf/ExP/Qmv/Gk/lYFJfM + mP/Wpv/Wpv+2buhCAH0AAAAAAAAAAAAAAAAAAACENbTyuP/Or/7WoP+hWd2mYeLLmf/Ekf/UpP+5dehK + A4IAAAAAAAAAAAAAAAAAAACGVqvbqf/MpP7iqP+bSMi5hf3Hlf+ZTtXSo/+vZuo9AHgAAAAAAAAmAHZG + AoFFAH83AHGBPra5rvG9fO+TRca8iP+6gfaTQ8nGjftUA44AAAAAAACEVa+vb+zQmf+7ivasfd9fF5W9 + cduUTNVBAX66gP+DNrqmau96QLoAAAAAAABsPJV2MKr8vv/cxv/uwP/wzv/Miek2AHJ8La5NCIWbT9M1 + AG2QR8s1AGoAAAAAAABHAIbCpf/rxP/qvv/ex//R0P/uuP9mGJ5CAHk+AHg9AHVqH6CXQ8iOOsFZC5QA + AABYHo7/0f/Itv7RhunZk+yxa+qfXemeVN3Wrfy+d+BSDYq8fvrSo//Xqf/Vo/9CAIRVHY320//Li/6i + j+GNO86LM7qOOb+pWdTewf/Mmf1WF5PXp//Sov/OnP/crP9WF41dGY3wzP/ktf3vwf/epP2yeveSPMan + fd734P+ZR8tHAIClX+OudvjSov/fr/9REIpHEYjqz//Zz//uv//Pyf/krv9qGKRdGIqfXdZREpLKlv+p + Y96dTsq9iP+mZuZtOKAAAACLPsXOgerIfuqQSM1UDKMAAAAAAAAAAABkIaXFhffMmv/Pnf+aTs1qLpYA + AAAAAAAAAABAAHxBAH0AAAAAAAAAAAAAAAAAAAAAAAA8AHtPD41LCIpqMZcAAAAAAAD//wAA+B8AAPgB + AAD4AAAA+AAAAPgAAADAAQAAgAMAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAIOBAADPwwAA + + + \ No newline at end of file diff --git a/LilithPort/StartupForm.h b/LilithPort/StartupForm.h new file mode 100644 index 0000000..dbe727d --- /dev/null +++ b/LilithPort/StartupForm.h @@ -0,0 +1,563 @@ +#pragma once + +#include "stdafx.h" + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing; + + +namespace LilithPort { + + /// + /// StartupForm ‚ÌŠT—v + /// + /// Œx: ‚±‚̃Nƒ‰ƒX‚Ì–¼‘O‚ð•ÏX‚·‚éê‡A‚±‚̃Nƒ‰ƒX‚ªˆË‘¶‚·‚é‚·‚×‚Ä‚Ì .resx ƒtƒ@ƒCƒ‹‚ÉŠÖ˜A•t‚¯‚ç‚ꂽ + /// ƒ}ƒl[ƒW ƒŠƒ\[ƒX ƒRƒ“ƒpƒCƒ‰ ƒc[ƒ‹‚ɑ΂µ‚Ä 'Resource File Name' ƒvƒƒpƒeƒB‚ð + /// •ÏX‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B‚±‚Ì•ÏX‚ðs‚í‚È‚¢‚ÆA + /// ƒfƒUƒCƒi‚ÆA‚±‚̃tƒH[ƒ€‚ÉŠÖ˜A•t‚¯‚ç‚ꂽƒ[ƒJƒ‰ƒCƒYς݃Šƒ\[ƒX‚Æ‚ªA + /// ³‚µ‚­‘ŠŒÝ‚É—˜—p‚Å‚«‚È‚­‚È‚è‚Ü‚·B + /// + public ref class StartupForm : public System::Windows::Forms::Form + { + public: + StartupForm(void) + { + InitializeComponent(); + // + //TODO: ‚±‚±‚ɃRƒ“ƒXƒgƒ‰ƒNƒ^ ƒR[ƒh‚ð’ljÁ‚µ‚Ü‚· + // + } + + protected: + /// + /// Žg—p’†‚̃Šƒ\[ƒX‚ð‚·‚×‚ÄƒNƒŠ[ƒ“ƒAƒbƒv‚µ‚Ü‚·B + /// + ~StartupForm() + { + if (components) + { + delete components; + } + } + private: System::Windows::Forms::RadioButton^ radioButtonServer; + private: System::Windows::Forms::RadioButton^ radioButtonHost; + private: System::Windows::Forms::RadioButton^ radioButtonClient; + private: System::Windows::Forms::Label^ labelServerName; + private: System::Windows::Forms::TextBox^ textBoxIP; + private: System::Windows::Forms::Label^ labelOpenPort; + private: System::Windows::Forms::NumericUpDown^ numericUpDownOpenPort; + private: System::Windows::Forms::Button^ buttonOK; + private: System::Windows::Forms::Button^ buttonCancel; + private: System::Windows::Forms::Label^ labelName; + private: System::Windows::Forms::TextBox^ textBoxName; + private: System::Windows::Forms::NumericUpDown^ numericUpDownPort; + private: System::Windows::Forms::Label^ labelMaxConnection; + private: System::Windows::Forms::NumericUpDown^ numericUpDownMaxConnection; + private: System::Windows::Forms::Label^ labelComment; + private: System::Windows::Forms::TextBox^ textBoxComment; + private: System::Windows::Forms::GroupBox^ groupBoxStartMode; + private: System::Windows::Forms::TextBox^ textBoxServerName; + private: System::Windows::Forms::GroupBox^ groupBoxConnection; + private: System::Windows::Forms::Label^ labelIP; + private: System::Windows::Forms::Label^ labelAccessPort; + private: System::Windows::Forms::GroupBox^ groupBoxProfile; + private: System::Windows::Forms::GroupBox^ groupBoxWelcome; + private: System::Windows::Forms::RichTextBox^ textBoxWelcome; + private: + /// + /// •K—v‚ȃfƒUƒCƒi•Ï”‚Å‚·B + /// + System::ComponentModel::Container ^components; + +#pragma region Windows Form Designer generated code + /// + /// ƒfƒUƒCƒi ƒTƒ|[ƒg‚É•K—v‚ȃƒ\ƒbƒh‚Å‚·B‚±‚̃ƒ\ƒbƒh‚Ì“à—e‚ð + /// ƒR[ƒh ƒGƒfƒBƒ^‚Å•ÏX‚µ‚È‚¢‚Å‚­‚¾‚³‚¢B + /// + void InitializeComponent(void) + { + System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(StartupForm::typeid)); + this->radioButtonServer = (gcnew System::Windows::Forms::RadioButton()); + this->radioButtonHost = (gcnew System::Windows::Forms::RadioButton()); + this->radioButtonClient = (gcnew System::Windows::Forms::RadioButton()); + this->labelServerName = (gcnew System::Windows::Forms::Label()); + this->textBoxIP = (gcnew System::Windows::Forms::TextBox()); + this->labelOpenPort = (gcnew System::Windows::Forms::Label()); + this->numericUpDownOpenPort = (gcnew System::Windows::Forms::NumericUpDown()); + this->buttonOK = (gcnew System::Windows::Forms::Button()); + this->buttonCancel = (gcnew System::Windows::Forms::Button()); + this->textBoxComment = (gcnew System::Windows::Forms::TextBox()); + this->labelComment = (gcnew System::Windows::Forms::Label()); + this->textBoxName = (gcnew System::Windows::Forms::TextBox()); + this->labelName = (gcnew System::Windows::Forms::Label()); + this->numericUpDownPort = (gcnew System::Windows::Forms::NumericUpDown()); + this->numericUpDownMaxConnection = (gcnew System::Windows::Forms::NumericUpDown()); + this->labelMaxConnection = (gcnew System::Windows::Forms::Label()); + this->groupBoxStartMode = (gcnew System::Windows::Forms::GroupBox()); + this->textBoxServerName = (gcnew System::Windows::Forms::TextBox()); + this->groupBoxConnection = (gcnew System::Windows::Forms::GroupBox()); + this->labelAccessPort = (gcnew System::Windows::Forms::Label()); + this->labelIP = (gcnew System::Windows::Forms::Label()); + this->groupBoxProfile = (gcnew System::Windows::Forms::GroupBox()); + this->groupBoxWelcome = (gcnew System::Windows::Forms::GroupBox()); + this->textBoxWelcome = (gcnew System::Windows::Forms::RichTextBox()); + (cli::safe_cast(this->numericUpDownOpenPort))->BeginInit(); + (cli::safe_cast(this->numericUpDownPort))->BeginInit(); + (cli::safe_cast(this->numericUpDownMaxConnection))->BeginInit(); + this->groupBoxStartMode->SuspendLayout(); + this->groupBoxConnection->SuspendLayout(); + this->groupBoxProfile->SuspendLayout(); + this->groupBoxWelcome->SuspendLayout(); + this->SuspendLayout(); + // + // radioButtonServer + // + this->radioButtonServer->AutoSize = true; + this->radioButtonServer->Location = System::Drawing::Point(8, 18); + this->radioButtonServer->Name = L"radioButtonServer"; + this->radioButtonServer->Size = System::Drawing::Size(56, 16); + this->radioButtonServer->TabIndex = 1; + this->radioButtonServer->Text = L"Server"; + this->radioButtonServer->UseVisualStyleBackColor = true; + this->radioButtonServer->CheckedChanged += gcnew System::EventHandler(this, &StartupForm::radioButtonServer_CheckedChanged); + // + // radioButtonHost + // + this->radioButtonHost->AutoSize = true; + this->radioButtonHost->Location = System::Drawing::Point(70, 18); + this->radioButtonHost->Name = L"radioButtonHost"; + this->radioButtonHost->Size = System::Drawing::Size(47, 16); + this->radioButtonHost->TabIndex = 1; + this->radioButtonHost->Text = L"Host"; + this->radioButtonHost->UseVisualStyleBackColor = true; + this->radioButtonHost->CheckedChanged += gcnew System::EventHandler(this, &StartupForm::radioButtonHost_CheckedChanged); + // + // radioButtonClient + // + this->radioButtonClient->AutoSize = true; + this->radioButtonClient->Location = System::Drawing::Point(123, 18); + this->radioButtonClient->Name = L"radioButtonClient"; + this->radioButtonClient->Size = System::Drawing::Size(53, 16); + this->radioButtonClient->TabIndex = 1; + this->radioButtonClient->Text = L"Client"; + this->radioButtonClient->UseVisualStyleBackColor = true; + this->radioButtonClient->CheckedChanged += gcnew System::EventHandler(this, &StartupForm::radioButtonClient_CheckedChanged); + // + // labelServerName + // + this->labelServerName->AutoSize = true; + this->labelServerName->Location = System::Drawing::Point(6, 41); + this->labelServerName->Name = L"labelServerName"; + this->labelServerName->Size = System::Drawing::Size(49, 12); + this->labelServerName->TabIndex = 0; + this->labelServerName->Text = L"ƒT[ƒo–¼:"; + // + // textBoxIP + // + this->textBoxIP->Location = System::Drawing::Point(70, 18); + this->textBoxIP->Name = L"textBoxIP"; + this->textBoxIP->Size = System::Drawing::Size(116, 19); + this->textBoxIP->TabIndex = 2; + // + // labelOpenPort + // + this->labelOpenPort->AutoSize = true; + this->labelOpenPort->Location = System::Drawing::Point(7, 65); + this->labelOpenPort->Name = L"labelOpenPort"; + this->labelOpenPort->Size = System::Drawing::Size(59, 12); + this->labelOpenPort->TabIndex = 0; + this->labelOpenPort->Text = L"‘ÒŽóƒ|[ƒg:"; + // + // numericUpDownOpenPort + // + this->numericUpDownOpenPort->Location = System::Drawing::Point(133, 63); + this->numericUpDownOpenPort->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {65535, 0, 0, 0}); + this->numericUpDownOpenPort->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1024, 0, 0, 0}); + this->numericUpDownOpenPort->Name = L"numericUpDownOpenPort"; + this->numericUpDownOpenPort->Size = System::Drawing::Size(53, 19); + this->numericUpDownOpenPort->TabIndex = 4; + this->numericUpDownOpenPort->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {7500, 0, 0, 0}); + // + // buttonOK + // + this->buttonOK->Location = System::Drawing::Point(274, 205); + this->buttonOK->Name = L"buttonOK"; + this->buttonOK->Size = System::Drawing::Size(58, 24); + this->buttonOK->TabIndex = 6; + this->buttonOK->Text = L"‹N“®"; + this->buttonOK->UseVisualStyleBackColor = true; + this->buttonOK->Click += gcnew System::EventHandler(this, &StartupForm::buttonOK_Click); + // + // buttonCancel + // + this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel; + this->buttonCancel->Location = System::Drawing::Point(338, 205); + this->buttonCancel->Name = L"buttonCancel"; + this->buttonCancel->Size = System::Drawing::Size(57, 24); + this->buttonCancel->TabIndex = 7; + this->buttonCancel->Text = L"•Â‚¶‚é"; + this->buttonCancel->UseVisualStyleBackColor = true; + this->buttonCancel->Click += gcnew System::EventHandler(this, &StartupForm::buttonCancel_Click); + // + // textBoxComment + // + this->textBoxComment->Location = System::Drawing::Point(80, 43); + this->textBoxComment->Name = L"textBoxComment"; + this->textBoxComment->Size = System::Drawing::Size(94, 19); + this->textBoxComment->TabIndex = 2; + // + // labelComment + // + this->labelComment->AutoSize = true; + this->labelComment->Location = System::Drawing::Point(7, 46); + this->labelComment->Name = L"labelComment"; + this->labelComment->Size = System::Drawing::Size(40, 12); + this->labelComment->TabIndex = 4; + this->labelComment->Text = L"ƒRƒƒ“ƒg:"; + // + // textBoxName + // + this->textBoxName->Location = System::Drawing::Point(80, 18); + this->textBoxName->Name = L"textBoxName"; + this->textBoxName->Size = System::Drawing::Size(94, 19); + this->textBoxName->TabIndex = 1; + // + // labelName + // + this->labelName->AutoSize = true; + this->labelName->Location = System::Drawing::Point(6, 21); + this->labelName->Name = L"labelName"; + this->labelName->Size = System::Drawing::Size(61, 12); + this->labelName->TabIndex = 0; + this->labelName->Text = L"ƒjƒbƒNƒl[ƒ€:"; + // + // numericUpDownPort + // + this->numericUpDownPort->Location = System::Drawing::Point(133, 40); + this->numericUpDownPort->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {65535, 0, 0, 0}); + this->numericUpDownPort->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1024, 0, 0, 0}); + this->numericUpDownPort->Name = L"numericUpDownPort"; + this->numericUpDownPort->Size = System::Drawing::Size(53, 19); + this->numericUpDownPort->TabIndex = 4; + this->numericUpDownPort->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {7500, 0, 0, 0}); + // + // numericUpDownMaxConnection + // + this->numericUpDownMaxConnection->Location = System::Drawing::Point(146, 88); + this->numericUpDownMaxConnection->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + this->numericUpDownMaxConnection->Name = L"numericUpDownMaxConnection"; + this->numericUpDownMaxConnection->Size = System::Drawing::Size(40, 19); + this->numericUpDownMaxConnection->TabIndex = 3; + this->numericUpDownMaxConnection->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); + // + // labelMaxConnection + // + this->labelMaxConnection->AutoSize = true; + this->labelMaxConnection->Location = System::Drawing::Point(7, 90); + this->labelMaxConnection->Name = L"labelMaxConnection"; + this->labelMaxConnection->Size = System::Drawing::Size(79, 12); + this->labelMaxConnection->TabIndex = 0; + this->labelMaxConnection->Text = L"Å‘åÚ‘±ŽÒ”:"; + // + // groupBoxStartMode + // + this->groupBoxStartMode->Controls->Add(this->textBoxServerName); + this->groupBoxStartMode->Controls->Add(this->radioButtonServer); + this->groupBoxStartMode->Controls->Add(this->labelOpenPort); + this->groupBoxStartMode->Controls->Add(this->labelServerName); + this->groupBoxStartMode->Controls->Add(this->labelMaxConnection); + this->groupBoxStartMode->Controls->Add(this->numericUpDownMaxConnection); + this->groupBoxStartMode->Controls->Add(this->numericUpDownOpenPort); + this->groupBoxStartMode->Controls->Add(this->radioButtonHost); + this->groupBoxStartMode->Controls->Add(this->radioButtonClient); + this->groupBoxStartMode->Location = System::Drawing::Point(201, 12); + this->groupBoxStartMode->Name = L"groupBoxStartMode"; + this->groupBoxStartMode->Size = System::Drawing::Size(194, 115); + this->groupBoxStartMode->TabIndex = 8; + this->groupBoxStartMode->TabStop = false; + this->groupBoxStartMode->Text = L"‹N“®ƒ‚[ƒh"; + // + // textBoxServerName + // + this->textBoxServerName->Location = System::Drawing::Point(70, 38); + this->textBoxServerName->Name = L"textBoxServerName"; + this->textBoxServerName->Size = System::Drawing::Size(116, 19); + this->textBoxServerName->TabIndex = 5; + // + // groupBoxConnection + // + this->groupBoxConnection->Controls->Add(this->labelAccessPort); + this->groupBoxConnection->Controls->Add(this->labelIP); + this->groupBoxConnection->Controls->Add(this->textBoxIP); + this->groupBoxConnection->Controls->Add(this->numericUpDownPort); + this->groupBoxConnection->Location = System::Drawing::Point(201, 133); + this->groupBoxConnection->Name = L"groupBoxConnection"; + this->groupBoxConnection->Size = System::Drawing::Size(194, 66); + this->groupBoxConnection->TabIndex = 9; + this->groupBoxConnection->TabStop = false; + this->groupBoxConnection->Text = L"Ú‘±æ"; + // + // labelAccessPort + // + this->labelAccessPort->AutoSize = true; + this->labelAccessPort->Location = System::Drawing::Point(7, 42); + this->labelAccessPort->Name = L"labelAccessPort"; + this->labelAccessPort->Size = System::Drawing::Size(71, 12); + this->labelAccessPort->TabIndex = 5; + this->labelAccessPort->Text = L"Ú‘±æƒ|[ƒg:"; + // + // labelIP + // + this->labelIP->AutoSize = true; + this->labelIP->Location = System::Drawing::Point(7, 21); + this->labelIP->Name = L"labelIP"; + this->labelIP->Size = System::Drawing::Size(43, 12); + this->labelIP->TabIndex = 3; + this->labelIP->Text = L"ƒAƒhƒŒƒX:"; + // + // groupBoxProfile + // + this->groupBoxProfile->Controls->Add(this->labelComment); + this->groupBoxProfile->Controls->Add(this->textBoxComment); + this->groupBoxProfile->Controls->Add(this->textBoxName); + this->groupBoxProfile->Controls->Add(this->labelName); + this->groupBoxProfile->Location = System::Drawing::Point(12, 12); + this->groupBoxProfile->Name = L"groupBoxProfile"; + this->groupBoxProfile->Size = System::Drawing::Size(183, 67); + this->groupBoxProfile->TabIndex = 10; + this->groupBoxProfile->TabStop = false; + this->groupBoxProfile->Text = L"ƒvƒƒtƒB[ƒ‹"; + // + // groupBoxWelcome + // + this->groupBoxWelcome->Controls->Add(this->textBoxWelcome); + this->groupBoxWelcome->Location = System::Drawing::Point(12, 85); + this->groupBoxWelcome->Name = L"groupBoxWelcome"; + this->groupBoxWelcome->Size = System::Drawing::Size(183, 113); + this->groupBoxWelcome->TabIndex = 11; + this->groupBoxWelcome->TabStop = false; + this->groupBoxWelcome->Text = L"ƒT[ƒoƒƒbƒZ[ƒW"; + // + // textBoxWelcome + // + this->textBoxWelcome->Location = System::Drawing::Point(8, 19); + this->textBoxWelcome->MaxLength = 254; + this->textBoxWelcome->Name = L"textBoxWelcome"; + this->textBoxWelcome->Size = System::Drawing::Size(167, 86); + this->textBoxWelcome->TabIndex = 0; + this->textBoxWelcome->Text = L""; + this->textBoxWelcome->WordWrap = false; + // + // StartupForm + // + this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->CancelButton = this->buttonCancel; + this->ClientSize = System::Drawing::Size(407, 241); + this->ControlBox = false; + this->Controls->Add(this->groupBoxWelcome); + this->Controls->Add(this->groupBoxProfile); + this->Controls->Add(this->groupBoxConnection); + this->Controls->Add(this->groupBoxStartMode); + this->Controls->Add(this->buttonOK); + this->Controls->Add(this->buttonCancel); + this->Icon = (cli::safe_cast(resources->GetObject(L"$this.Icon"))); + this->MaximizeBox = false; + this->MinimizeBox = false; + this->Name = L"StartupForm"; + this->ShowInTaskbar = false; + this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent; + this->Text = L"ƒXƒ^[ƒgƒAƒbƒv"; + this->Load += gcnew System::EventHandler(this, &StartupForm::StartupForm_Load); + this->Shown += gcnew System::EventHandler(this, &StartupForm::StartupForm_Shown); + (cli::safe_cast(this->numericUpDownOpenPort))->EndInit(); + (cli::safe_cast(this->numericUpDownPort))->EndInit(); + (cli::safe_cast(this->numericUpDownMaxConnection))->EndInit(); + this->groupBoxStartMode->ResumeLayout(false); + this->groupBoxStartMode->PerformLayout(); + this->groupBoxConnection->ResumeLayout(false); + this->groupBoxConnection->PerformLayout(); + this->groupBoxProfile->ResumeLayout(false); + this->groupBoxProfile->PerformLayout(); + this->groupBoxWelcome->ResumeLayout(false); + this->ResumeLayout(false); + + } +#pragma endregion + private: + System::Void StartupForm_Load(System::Object^ sender, System::EventArgs^ e) { + textBoxServerName->MaxLength = MAX_NAME; + textBoxIP->MaxLength = MAX_ARRAY; + textBoxName->MaxLength = MAX_NAME; + textBoxComment->MaxLength = MAX_NAME; + + switch(MTOPTION.CONNECTION_TYPE){ + case CT_SERVER: + default: + radioButtonServer->Checked = true; + + numericUpDownPort->Enabled = false; + break; + case CT_HOST: + radioButtonHost->Checked = true; + + break; + case CT_CLIENT: + radioButtonClient->Checked = true; + + numericUpDownOpenPort->Enabled = false; + break; + } + + textBoxServerName->Text = gcnew String(MTOPTION.SERVER_NAME); + textBoxIP->Text = gcnew String(MTOPTION.CONNECTION_IP); + + + numericUpDownOpenPort->Value = MTOPTION.OPEN_PORT; + + textBoxName->Text = gcnew String(MTOPTION.NAME); + numericUpDownPort->Value = MTOPTION.PORT; + numericUpDownMaxConnection->Value = MTOPTION.MAX_CONNECTION; + + textBoxComment->Text = gcnew String(MTOPTION.COMMENT); + textBoxWelcome->Text = gcnew String(MTOPTION.WELCOME); + } + + System::Void StartupForm_Shown(System::Object^ sender, System::EventArgs^ e) { + buttonOK->Focus(); + } + + System::Void buttonOK_Click(System::Object^ sender, System::EventArgs^ e) { + IntPtr mp; + TCHAR p1[MAX_ARRAY]; + TCHAR *p2; + + if(radioButtonServer->Checked){ + MTOPTION.CONNECTION_TYPE = CT_SERVER; + + // ƒT[ƒo–¼ƒ`ƒFƒbƒN + if(textBoxServerName->Text->Length == 0){ + MessageBox::Show("ƒT[ƒo–¼‚ð“ü—Í‚µ‚Ä‚­‚¾‚³‚¢B\n\nSERVERƒ‚[ƒh‚Å‹N“®‚·‚é‚É‚ÍA\nƒT[ƒo–¼‚ð“ü—Í‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B", "SERVERƒ‚[ƒhƒGƒ‰[", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxServerName->Text); + _tcscpy_s(p1, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + p2 = _tcschr(p1, _T(',')); + if (p2 != NULL){ + MessageBox::Show("ƒT[ƒo–¼‚ÉŽg—p‚Å‚«‚È‚¢•¶Žš(,)‚ª‚ ‚è‚Ü‚·B\nƒT[ƒo–¼‚ðŠm”F‚µ‚Ä‚­‚¾‚³‚¢B", "SERVERƒ‚[ƒhƒGƒ‰[", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + } + else if(radioButtonHost->Checked){ + MTOPTION.CONNECTION_TYPE = CT_HOST; + } + else if(radioButtonClient->Checked){ + MTOPTION.CONNECTION_TYPE = CT_CLIENT; + } + else{ + MTOPTION.CONNECTION_TYPE = CT_FREE; + } + + + // ƒT[ƒo–¼ + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxServerName->Text); + _tcscpy_s(MTOPTION.SERVER_NAME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + // IPƒ`ƒFƒbƒN + if(MTOPTION.CONNECTION_TYPE == CT_HOST || MTOPTION.CONNECTION_TYPE == CT_CLIENT) { + if(textBoxIP->Text->Length == 0){ + MessageBox::Show("Ú‘±æƒAƒhƒŒƒX‚ð“ü—Í‚µ‚Ä‚­‚¾‚³‚¢B\n\nHOST, CLIENTƒ‚[ƒh‚Å‹N“®‚·‚é‚É‚ÍA\nÚ‘±æ‚̃AƒhƒŒƒX‚ð“ü—Í‚·‚é•K—v‚ª‚ ‚è‚Ü‚·B", "HOST, CLIENTƒ‚[ƒhƒGƒ‰[", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxIP->Text); + _tcscpy_s(p1, static_cast(mp.ToPointer())); + p2 = _tcschr(p1, _T(',')); + if (p2 != NULL){ + MessageBox::Show("Ú‘±æƒAƒhƒŒƒX‚ÉŽg—p‚Å‚«‚È‚¢•¶Žš(,)‚ª‚ ‚è‚Ü‚·B\nÚ‘±æƒAƒhƒŒƒX‚ðŠm”F‚µ‚Ä‚­‚¾‚³‚¢B", "HOST, CLIENTƒ‚[ƒhƒGƒ‰[", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + return; + } + } + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxIP->Text); + _tcscpy_s(MTOPTION.CONNECTION_IP, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + // –¼‘Oƒ`ƒFƒbƒN + if(textBoxName->Text->Length == 0){ + textBoxName->Text = gcnew String(MTOPTION.NAME); + + if(textBoxName->Text->Length == 0){ + textBoxName->Text = gcnew String("–¼–³‚µ‚³‚ñ"); + } + } + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxName->Text); + _tcscpy_s(MTOPTION.NAME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + MTOPTION.OPEN_PORT = (UINT)numericUpDownOpenPort->Value; + MTOPTION.PORT = (UINT)numericUpDownPort->Value; + MTOPTION.MAX_CONNECTION = (UINT)numericUpDownMaxConnection->Value; + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxComment->Text); + _tcscpy_s(MTOPTION.COMMENT, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxWelcome->Text); + _tcscpy_s(MTOPTION.WELCOME, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + this->Close(); + } + + System::Void buttonCancel_Click(System::Object^ sender, System::EventArgs^ e) { + MTOPTION.CONNECTION_TYPE = CT_FREE; + + this->Close(); + } + + System::Void radioButtonServer_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { + numericUpDownOpenPort->Enabled = true; + numericUpDownPort->Enabled = false; + labelOpenPort->Enabled = true; + labelServerName->Enabled = true; + textBoxServerName->Enabled = true; + textBoxIP->Enabled = false; + groupBoxConnection->Enabled = false; + groupBoxWelcome->Enabled = true; + + buttonOK->Enabled = true; + } + + System::Void radioButtonHost_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { + numericUpDownOpenPort->Enabled = true; + numericUpDownPort->Enabled = true; + labelOpenPort->Enabled = true; + labelServerName->Enabled = false; + textBoxServerName->Enabled = false; + textBoxIP->Enabled = true; + groupBoxConnection->Enabled = true; + groupBoxWelcome->Enabled = false; + } + + System::Void radioButtonClient_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { + numericUpDownOpenPort->Enabled = false; + numericUpDownPort->Enabled = true; + labelOpenPort->Enabled = false; + labelServerName->Enabled = false; + textBoxServerName->Enabled = false; + textBoxIP->Enabled = true; + groupBoxConnection->Enabled = true; + groupBoxWelcome->Enabled = false; + } + System::Void buttonEnd_Click(System::Object^ sender, System::EventArgs^ e) { + exit(0); + } + }; +} diff --git a/LilithPort/StartupForm.resx b/LilithPort/StartupForm.resx new file mode 100644 index 0000000..69b7a24 --- /dev/null +++ b/LilithPort/StartupForm.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAABtMauCNqtwMKxyMa1uK6lJDH0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB9NszU3f/Y + nv/YqP/VpP88AHR+NMKgZdp3OL9RHH8AAAAAAAAAAAAAAAAAAAAAAABzLcHyvf/ExP/Qmv/Gk/lYFJfM + mP/Wpv/Wpv+2buhCAH0AAAAAAAAAAAAAAAAAAACENbTyuP/Or/7WoP+hWd2mYeLLmf/Ekf/UpP+5dehK + A4IAAAAAAAAAAAAAAAAAAACGVqvbqf/MpP7iqP+bSMi5hf3Hlf+ZTtXSo/+vZuo9AHgAAAAAAAAmAHZG + AoFFAH83AHGBPra5rvG9fO+TRca8iP+6gfaTQ8nGjftUA44AAAAAAACEVa+vb+zQmf+7ivasfd9fF5W9 + cduUTNVBAX66gP+DNrqmau96QLoAAAAAAABsPJV2MKr8vv/cxv/uwP/wzv/Miek2AHJ8La5NCIWbT9M1 + AG2QR8s1AGoAAAAAAABHAIbCpf/rxP/qvv/ex//R0P/uuP9mGJ5CAHk+AHg9AHVqH6CXQ8iOOsFZC5QA + AABYHo7/0f/Itv7RhunZk+yxa+qfXemeVN3Wrfy+d+BSDYq8fvrSo//Xqf/Vo/9CAIRVHY320//Li/6i + j+GNO86LM7qOOb+pWdTewf/Mmf1WF5PXp//Sov/OnP/crP9WF41dGY3wzP/ktf3vwf/epP2yeveSPMan + fd734P+ZR8tHAIClX+OudvjSov/fr/9REIpHEYjqz//Zz//uv//Pyf/krv9qGKRdGIqfXdZREpLKlv+p + Y96dTsq9iP+mZuZtOKAAAACLPsXOgerIfuqQSM1UDKMAAAAAAAAAAABkIaXFhffMmv/Pnf+aTs1qLpYA + AAAAAAAAAABAAHxBAH0AAAAAAAAAAAAAAAAAAAAAAAA8AHtPD41LCIpqMZcAAAAAAAD//wAA+B8AAPgB + AAD4AAAA+AAAAPgAAADAAQAAgAMAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAIOBAADPwwAA + + + \ No newline at end of file diff --git a/LilithPort/app.rc b/LilithPort/app.rc new file mode 100644 index 0000000..2c61060 --- /dev/null +++ b/LilithPort/app.rc @@ -0,0 +1,63 @@ +// Microsoft Visual C++ ‚Ŷ¬‚³‚ꂽƒŠƒ\[ƒX ƒXƒNƒŠƒvƒg‚Å‚·B +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// ‰pŒê (•Ä‘) ƒŠƒ\[ƒX + + +///////////////////////////////////////////////////////////////////////////// +// +// ƒAƒCƒRƒ“ +// + +// ʼn‚É”z’u‚³‚ꂽƒAƒCƒRƒ“A‚Ü‚½‚Í ID ’l‚ªÅ‚à’á‚¢ƒAƒCƒRƒ“‚ªAƒAƒvƒŠƒP[ƒVƒ‡ƒ“ ƒAƒCƒRƒ“‚É‚È‚è‚Ü‚·B + +LANGUAGE 17, 1 +#pragma code_page(932) +1 ICON "app.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" + "\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE 3 ƒŠƒ\[ƒX‚©‚綬‚³‚ê‚Ü‚µ‚½B +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED ‚Å‚È‚¢ê‡ + diff --git a/LilithPort/resource.h b/LilithPort/resource.h new file mode 100644 index 0000000..d5ac7c4 --- /dev/null +++ b/LilithPort/resource.h @@ -0,0 +1,3 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc diff --git a/LilithPort/stdafx.cpp b/LilithPort/stdafx.cpp new file mode 100644 index 0000000..9eb9198 --- /dev/null +++ b/LilithPort/stdafx.cpp @@ -0,0 +1,773 @@ +// stdafx.cpp : •W€ƒCƒ“ƒNƒ‹[ƒh LilithPort.pch ‚Ì‚Ý‚ð +// ŠÜ‚Þƒ\[ƒX ƒtƒ@ƒCƒ‹‚ÍAƒvƒŠƒRƒ“ƒpƒCƒ‹Ï‚݃wƒbƒ_[‚É‚È‚è‚Ü‚·B +// stdafx.obj ‚ɂ̓vƒŠƒRƒ“ƒpƒCƒ‹Ï‚ÝŒ^î•ñ‚ªŠÜ‚Ü‚ê‚Ü‚·B + +#include "stdafx.h" + +extern CRITICAL_SECTION CS_CAPTION; +using namespace System::Collections; + +// —Ž‚¿‚é‘O‚ɃGƒ‰[“à—e‚ðƒƒMƒ“ƒO +void WriteErrorLog(String^ text, String^ caption) +{ + IO::StreamWriter^ sw = gcnew IO::StreamWriter(gcnew String(MTOPTION.PATH) + "error.log", true, Encoding::Default); + try{ + sw->WriteLine("-------------------------------------------------------------------------------"); + sw->WriteLine("{0} {1} [{2}]", DateTime::Now.ToLongDateString(), DateTime::Now.ToLongTimeString(), caption); + sw->WriteLine(); + sw->Write(text); + sw->WriteLine(); + sw->WriteLine(); + sw->WriteLine(); + } + finally{ + if(sw != nullptr){ + sw->Close(); + delete sw; + } + } +} + +// —áŠO’²¸ +void ApplicationThreadException(Object^ sender, Threading::ThreadExceptionEventArgs^ e) +{ + WriteErrorLog(e->Exception->ToString(), "ThreadException"); + MTINFO.ERRORED = true; + + if(!MTINFO.SERVER_MODE){ + MessageBox::Show("“Ë‘R‚Å‚·‚ªLilithPortI—¹‚Ì‚¨’m‚点‚Å‚·B", "‹Ù‹}Ž–‘Ô”­¶"); + } + + Application::Exit(); +} + +// Žå‚ɃRƒ“ƒ\[ƒ‹ƒAƒvƒŠ‚Ì—áŠO +void ApplicationUnhandledException(Object^ sender, UnhandledExceptionEventArgs^ e) +{ + WriteErrorLog(safe_cast(e->ExceptionObject)->ToString(), "UnhandledException"); + MTINFO.ERRORED = true; + + if(!MTINFO.SERVER_MODE){ + MessageBox::Show("“Ë‘R‚Å‚·‚ªLilithPortI—¹‚Ì‚¨’m‚点‚Å‚·B", "—áŠO‚ª”ò‚ñ‚Å‚«‚Ü‚µ‚½"); + } + + Application::Exit(); +} + +// ini‚Ì“Ç‚Ýž‚Ý +void LoadMTOption() +{ + IntPtr mp; + TCHAR ini[_MAX_PATH], tmpName[MAX_TITLE], tmpIP[MAX_TITLE], + tmpType[MAX_TITLE], tmpPort[MAX_TITLE], bufSection[MAX_ARRAY]; + TCHAR* iniSection = _T("LilithPort"); + UINT iniVersion; + _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + // stdafx.h‚É‹Lq + TCHAR iniSystem[MAX_NAME], iniState[MAX_NAME], iniColor[MAX_NAME]; + + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[0]); + _tcscpy_s(iniSystem, static_cast(mp.ToPointer())); + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[1]); + _tcscpy_s(iniState, static_cast(mp.ToPointer())); + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[2]); + _tcscpy_s(iniColor, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + // ƒOƒ[ƒoƒ‹ƒZƒNƒVƒ‡ƒ““Ç‚Ýž‚Ý + // 1.04ˆÈ‰ºŒÝŠ·—p + iniVersion = GetPrivateProfileInt(iniSystem, _T("iniVersion"), 0, ini); + if(iniVersion == 0){ + _tcscpy_s(iniSystem, iniSection); + } + + if(_tcslen(MTOPTION.PROFILE) == 0){ + GetPrivateProfileString(iniSystem, _T("DefaultProfile"), _T("LilithPort"), MTOPTION.PROFILE, MAX_ARRAY, ini); + } + GetPrivateProfileString(iniSystem, _T("ProfileList"), _T(""), MTOPTION.PROFILE_LIST, MAX_PROFILE, ini); + GetPrivateProfileString(iniSystem, _T("ServerName"), _T(""), MTOPTION.SERVER_NAME, MAX_NAME, ini); + GetPrivateProfileString(iniSystem, _T("ConnectIP"), _T(""), MTOPTION.CONNECTION_IP, MAX_ARRAY, ini); + GetPrivateProfileString(iniSystem, _T("Welcome"), _T(""), MTOPTION.WELCOME, MAX_WELCOME, ini); + GetPrivateProfileString(iniSystem, _T("VSSound"), _T("vs.wav"), MTOPTION.VS_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("NoticeSound"), _T("notice.wav"), MTOPTION.NOTICE_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("EnterSound"), _T("enter.wav"), MTOPTION.ENTER_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("NameSound"), _T("name.wav"), MTOPTION.NAME_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("TalkSound"), _T("talk.wav"), MTOPTION.TALK_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("SeekSound"), _T("seek.wav"), MTOPTION.SEEK_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("KeywordSound"), _T("name.wav"), MTOPTION.KEYWORD_SOUND, _MAX_PATH, ini); + GetPrivateProfileString(iniSystem, _T("Keyword"), _T(""), MTOPTION.KEYWORD, MAX_KEYWORD, ini); + GetPrivateProfileString(iniSystem, _T("Name"), _T("–¼–³‚µ‚³‚ñ"), MTOPTION.NAME, MAX_NAME, ini); + GetPrivateProfileString(iniSystem, _T("Comment"), _T(""), MTOPTION.COMMENT, MAX_NAME, ini); + MTOPTION.CONNECTION_TYPE = GetPrivateProfileInt(iniSystem, _T("ConnectType"), 0, ini); + MTOPTION.PORT = GetPrivateProfileInt(iniSystem, _T("Port"), 7500, ini); + MTOPTION.OPEN_PORT = GetPrivateProfileInt(iniSystem, _T("OpenPort"), 7500, ini); + MTOPTION.AUTO_SAVE = GetPrivateProfileInt(iniSystem, _T("AutoSave"), 0, ini); + MTOPTION.MAX_CONNECTION = GetPrivateProfileInt(iniSystem, _T("MaxConnection"), 1, ini); + MTOPTION.BGM_VOLUME = GetPrivateProfileInt(iniSystem, _T("BGMVolume"), 100, ini); + MTOPTION.SE_VOLUME = GetPrivateProfileInt(iniSystem, _T("SEVolume"), 100, ini); + MTOPTION.RECORD_REPLAY = GetPrivateProfileInt(iniSystem, _T("RecordReplay"), 0, ini) == 1 ? true : false; + MTOPTION.ALLOW_SPECTATOR = GetPrivateProfileInt(iniSystem, _T("AllowSpectator"), 1, ini) == 1 ? true : false; + MTOPTION.LOG_WORDWRAP = GetPrivateProfileInt(iniSystem, _T("LogWordWrap"), 0, ini) == 1 ? true : false; + MTOPTION.LOG_LOCK = GetPrivateProfileInt(iniSystem, _T("LogLock"), 0, ini) == 1 ? true : false; + MTOPTION.NAME_FLASH = GetPrivateProfileInt(iniSystem, _T("NameFlash"), 1, ini) == 1 ? true : false; + MTOPTION.TALK_FLASH = GetPrivateProfileInt(iniSystem, _T("TalkFlash"), 0, ini) == 1 ? true : false; + MTOPTION.AFTER_REST = GetPrivateProfileInt(iniSystem, _T("AfterRest"), 0, ini) == 1 ? true : false; + MTOPTION.AUTO_REST = GetPrivateProfileInt(iniSystem, _T("AutoRest"), 0, ini) == 1 ? true : false; + MTOPTION.AUTO_REST_TIME = GetPrivateProfileInt(iniSystem, _T("AutoRestTime"), 30, ini); + MTOPTION.ENTER_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("EnterSoundEnable"), 0, ini) == 1 ? true : false; + MTOPTION.VS_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("VSSoundEnable"), 0, ini) == 1 ? true : false; + MTOPTION.NOTICE_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("NoticeSoundEnable"), 0, ini) == 1 ? true : false; + MTOPTION.NAME_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("NameSoundEnable"), 1, ini) == 1 ? true : false; + MTOPTION.TALK_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("TalkSoundEnable"), 1, ini) == 1 ? true : false; + MTOPTION.SEEK_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("SeekSoundEnable"), 1, ini) == 1 ? true : false; + MTOPTION.KEYWORD_SOUND_ENABLE = GetPrivateProfileInt(iniSystem, _T("KeywordSoundEnable"), 1, ini) == 1 ? true : false; + MTOPTION.GET_IP_ENABLE = GetPrivateProfileInt(iniSystem, _T("GetIPEnable"), 1, ini) == 1 ? true : false; + MTOPTION.SHOW_GAME_OPTION = GetPrivateProfileInt(iniSystem, _T("ShowGameOption"), 1, ini) == 1 ? true : false; + MTOPTION.SHOW_RESULT = GetPrivateProfileInt(iniSystem, _T("ShowResult"), 1, ini) == 1 ? true : false; + + // ƒuƒbƒNƒ}[ƒN“Ç‚Ýž‚Ý + MTOPTION.BOOKMARK_COUNT = 0; + GetPrivateProfileString(iniSystem, _T("BookMarkServerName"), _T(""), tmpName, MAX_TITLE, ini); + GetPrivateProfileString(iniSystem, _T("BookMarkConnectIP"), _T(""), tmpIP, MAX_TITLE, ini); + GetPrivateProfileString(iniSystem, _T("BookMarkConnectType"), _T(""), tmpType, MAX_TITLE, ini); + GetPrivateProfileString(iniSystem, _T("BookMarkPort"), _T(""), tmpPort, MAX_TITLE, ini); + try{ + if(_tcslen(tmpName) > 0){ + String^ bufBookMarkServerName = gcnew String(tmpName); + String^ bufBookMarkConnectIP = gcnew String(tmpIP); + String^ bufBookMarkConnectType, ^bufBookMarkConnectPort; + array^ BookMarkNameList = bufBookMarkServerName->Split(','); + array^ BookMarkIPList = bufBookMarkConnectIP->Split(','); + array^ BookMarkTypeList, ^BookMarkPortList; + + if(BookMarkNameList->Length != BookMarkIPList->Length){ + throw gcnew Exception; + } + if(_tcslen(tmpType) > 0){ + bufBookMarkConnectType = gcnew String(tmpType); + bufBookMarkConnectPort = gcnew String(tmpPort); + BookMarkTypeList = bufBookMarkConnectType->Split(','); + BookMarkPortList = bufBookMarkConnectPort->Split(','); + } + MTOPTION.BOOKMARK_COUNT = BookMarkNameList->Length-1 < 1 ? 1 : BookMarkNameList->Length-1; + for(UINT i=0; i < MTOPTION.BOOKMARK_COUNT; i++){ + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkNameList[i]); + _tcscpy_s(MTOPTION.BOOKMARK_SERVER_NAME[i], static_cast(mp.ToPointer())); + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkIPList[i]); + _tcscpy_s(MTOPTION.BOOKMARK_CONNECTION_IP[i], static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + // 1.04ˆÈ‰ºŒÝŠ·—p + if(BookMarkTypeList != nullptr && BookMarkPortList != nullptr){ + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkTypeList[i]); + _tcscpy_s(MTOPTION.BOOKMARK_CONNECTION_TYPE[i], static_cast(mp.ToPointer())); + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkPortList[i]); + _tcscpy_s(MTOPTION.BOOKMARK_PORT[i], static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + }else{ + // Žè“®‰Šú‰» + _tcscpy_s(MTOPTION.BOOKMARK_CONNECTION_TYPE[i], _T("2")); + _tcscpy_s(MTOPTION.BOOKMARK_PORT[i], _T("7500")); + } + } + } + } + catch(Exception^){ + MessageBox::Show("ƒuƒbƒNƒ}[ƒNî•ñ‚Ì“Ç‚Ýž‚Ý‚ÉŽ¸”s‚µ‚Ü‚µ‚½B\n", "ƒuƒbƒNƒ}[ƒN“Ç‚Ýž‚Ý", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + } + + // ƒvƒƒtƒ@ƒCƒ‹ƒŠƒXƒg“Ç‚Ýž‚Ý + Profile::ProfileList->Clear(); + if(_tcslen(MTOPTION.PROFILE_LIST) > 0){ + String^ tmpList = gcnew String(MTOPTION.PROFILE_LIST); + array^ tmpProfile = tmpList->Split(','); + for(int i=0; i < tmpProfile->Length; i++){ + Profile::ProfileList->Add(tmpProfile[i]); + // ƒfƒtƒHƒ‹ƒgƒvƒƒtƒ@ƒCƒ‹ + if(tmpProfile[i] == gcnew String(MTOPTION.PROFILE)){ + MTOPTION.PROFILE_INDEX = i; + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(tmpProfile[i]); + _tcscpy_s(bufSection, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + iniSection = bufSection; + } + } + }else{ + // ‰Šú‰» + _tcsncpy_s(MTOPTION.PROFILE_LIST, _countof(MTOPTION.PROFILE_LIST), iniSection, MAX_PROFILE); + Profile::ProfileList->Add(gcnew String(iniSection)); + MTOPTION.PROFILE_INDEX = 0; + } + + // ƒvƒƒtƒ@ƒCƒ‹ƒZƒNƒVƒ‡ƒ““Ç‚Ýž‚Ý + GetPrivateProfileString(iniSection, _T("GameExe"), _T("game.exe"), MTOPTION.GAME_EXE, _MAX_PATH, ini); + GetPrivateProfileString(iniSection, _T("ReplayFolder"), _T("Replay"), MTOPTION.REPLAY_FOLDER, _MAX_PATH, ini); + MTOPTION.MAX_STAGE = GetPrivateProfileInt(iniSection, _T("MaxStage"), 1, ini); + MTOPTION.STAGE_SELECT = GetPrivateProfileInt(iniSection, _T("StageSelect"), 0, ini); + MTOPTION.ROUND = GetPrivateProfileInt(iniSection, _T("Round"), 2, ini); + MTOPTION.TIMER = GetPrivateProfileInt(iniSection, _T("Timer"), 0, ini); + MTOPTION.TEAM_ROUND_HP = GetPrivateProfileInt(iniSection, _T("TeamRoundHP"), 0, ini) == 1 ? true : false; + MTOPTION.SIMULATE_DELAY = GetPrivateProfileInt(iniSection, _T("SimulateDelay"), 0, ini); + MTOPTION.HIT_JUDGE = GetPrivateProfileInt(iniSection, _T("HitJudge"), 0, ini) == 1 ? true : false; + MTOPTION.DISPLAY_NAME = GetPrivateProfileInt(iniSection, _T("DisplayName"), 1, ini) == 1 ? true : false; + MTOPTION.DISPLAY_VERSUS = GetPrivateProfileInt(iniSection, _T("DisplayVersus"), 1, ini) == 1 ? true : false; + MTOPTION.DISPLAY_FRAMERATE = GetPrivateProfileInt(iniSection, _T("DisplayFramerate"), 1, ini) == 1 ? true : false; + MTOPTION.DISPLAY_RAND = GetPrivateProfileInt(iniSection, _T("DisplayRand"), 0, ini) == 1 ? true : false; + MTOPTION.REPLAY_DIVIDE = GetPrivateProfileInt(iniSection, _T("ReplayDivide"), 0, ini) == 1 ? true : false; + MTOPTION.CHANGE_WINDOW_SIZE = GetPrivateProfileInt(iniSection, _T("ChangeWindowSize"), 0, ini) == 1 ? true : false; + MTOPTION.CHAT_HISTORY = GetPrivateProfileInt(iniSection, _T("ChatHistory"), 20, ini); + MTOPTION.DELAY = GetPrivateProfileInt(iniSection, _T("Delay"), 0, ini); + MTOPTION.INTERVAL = GetPrivateProfileInt(iniSection, _T("Interval"), 1, ini); + MTOPTION.REPLAY_VERSION = GetPrivateProfileInt(iniSection, _T("ReplayVersion"), 2, ini); + + // ƒEƒBƒ“ƒhƒEˆÊ’u“Ç‚Ýž‚Ý + MTWS.LEFT = GetPrivateProfileInt(iniState, _T("Left"), 0, ini); + MTWS.TOP = GetPrivateProfileInt(iniState, _T("Top"), 0, ini); + MTWS.WIDTH = GetPrivateProfileInt(iniState, _T("Width"), 0, ini); + MTWS.HEIGHT = GetPrivateProfileInt(iniState, _T("Height"), 0, ini); + MTWS.SPLITTER = GetPrivateProfileInt(iniState, _T("Splitter"), 0, ini); + MTWS.DIALOG_LEFT = GetPrivateProfileInt(iniState, _T("DialogLeft"), 0, ini); + MTWS.DIALOG_TOP = GetPrivateProfileInt(iniState, _T("DialogTop"), 0, ini); + + // F“Ç‚Ýž‚Ý + MTCOLOR.SERVER_NAME = GetPrivateProfileInt(iniColor, _T("ServerName"), Color::ForestGreen.ToArgb(), ini); + MTCOLOR.HOST_NAME = GetPrivateProfileInt(iniColor, _T("HostName"), Color::MediumBlue.ToArgb(), ini); + MTCOLOR.CLIENT_NAME = GetPrivateProfileInt(iniColor, _T("ClientName"), Color::Black.ToArgb(), ini); + MTCOLOR.REST_STATE = GetPrivateProfileInt(iniColor, _T("RestState"), Color::Khaki.ToArgb(), ini); + MTCOLOR.VS_STATE = GetPrivateProfileInt(iniColor, _T("VSState"), Color::Salmon.ToArgb(), ini); + MTCOLOR.WATCH_STATE = GetPrivateProfileInt(iniColor, _T("WatchState"), Color::PaleGreen.ToArgb(), ini); + MTCOLOR.SEEK_STATE = GetPrivateProfileInt(iniColor, _T("SeekState"), Color::PowderBlue.ToArgb(), ini); + MTCOLOR.SYSTEM_MESSAGE = GetPrivateProfileInt(iniColor, _T("SystemMessage"), Color::Teal.ToArgb(), ini); + MTCOLOR.ERROR_MESSAGE = GetPrivateProfileInt(iniColor, _T("ErrorMessage"), Color::Red.ToArgb(), ini); + MTCOLOR.DEBUG_MESSAGE = GetPrivateProfileInt(iniColor, _T("DebugMessage"), Color::DarkOrange.ToArgb(), ini); + MTCOLOR.NOTICE_BACK = GetPrivateProfileInt(iniColor, _T("NoticeBack"), Color::PowderBlue.ToArgb(), ini); + MTCOLOR.COMMENT_BACK = GetPrivateProfileInt(iniColor, _T("CommentBack"), Color::MistyRose.ToArgb(), ini); + MTCOLOR.SECRET = GetPrivateProfileInt(iniColor, _T("Secret"), Color::HotPink.ToArgb(), ini); + + // Welcome‚̃^ƒu‚ð‰üs‚É + int len = _tcslen(MTOPTION.WELCOME); + for(int i = 0; i < len; i++){ + if(MTOPTION.WELCOME[i] == _T('\t')){ + MTOPTION.WELCOME[i] = _T('\n'); + } + } + + // 1.04ˆÈ‰ºŒÝŠ·—p + if(iniVersion == 0){ + DeleteSection(iniSection); + SaveMTOption(); + } +} + +// ini‚É‘‚«o‚µ +void SaveMTOption() +{ + // ‰üs‚ðƒ^ƒu‚É’uŠ· + int len = _tcslen(MTOPTION.WELCOME); + for(int i = 0; i < len; i++){ + if(MTOPTION.WELCOME[i] == _T('\n')){ + MTOPTION.WELCOME[i] = _T('\t'); + } + } + + IntPtr mp; + TCHAR ini[_MAX_PATH], buf[MAX_NAME]; + TCHAR tmpStrName[MAX_TITLE] = _T(""); + TCHAR tmpStrIP[MAX_TITLE] = _T(""); + TCHAR tmpStrType[MAX_TITLE] = _T(""); + TCHAR tmpStrPort[MAX_TITLE] = _T(""); + TCHAR* iniSection = MTOPTION.PROFILE; + + // stdafx.h‚É‹Lq + TCHAR iniSystem[MAX_NAME], iniState[MAX_NAME], iniColor[MAX_NAME]; + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[0]); + _tcscpy_s(iniSystem, static_cast(mp.ToPointer())); + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[1]); + _tcscpy_s(iniState, static_cast(mp.ToPointer())); + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[2]); + _tcscpy_s(iniColor, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + + _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + + // ƒOƒ[ƒoƒ‹ƒZƒNƒVƒ‡ƒ“‘‚«ž‚Ý + _itot_s(LP_VERSION, buf, 10); + WritePrivateProfileString(iniSystem, _T("iniVersion"), buf, ini); + _itot_s(MTOPTION.CONNECTION_TYPE, buf, 10); + WritePrivateProfileString(iniSystem, _T("ConnectType"), buf, ini); + WritePrivateProfileString(iniSystem, _T("ServerName"), MTOPTION.SERVER_NAME, ini); + WritePrivateProfileString(iniSystem, _T("ConnectIP"), MTOPTION.CONNECTION_IP, ini); + WritePrivateProfileString(iniSystem, _T("Welcome"), MTOPTION.WELCOME, ini); + WritePrivateProfileString(iniSystem, _T("VSSound"), MTOPTION.VS_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("NoticeSound"), MTOPTION.NOTICE_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("EnterSound"), MTOPTION.ENTER_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("NameSound"), MTOPTION.NAME_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("TalkSound"), MTOPTION.TALK_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("SeekSound"), MTOPTION.SEEK_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("KeywordSound"), MTOPTION.KEYWORD_SOUND, ini); + WritePrivateProfileString(iniSystem, _T("Keyword"), MTOPTION.KEYWORD, ini); + WritePrivateProfileString(iniSystem, _T("Name"), MTOPTION.NAME, ini); + WritePrivateProfileString(iniSystem, _T("Comment"), MTOPTION.COMMENT, ini); + + _itot_s(MTOPTION.PORT, buf, 10); + WritePrivateProfileString(iniSystem, _T("Port"), buf, ini); + _itot_s(MTOPTION.OPEN_PORT, buf, 10); + WritePrivateProfileString(iniSystem, _T("OpenPort"), buf, ini); + _itot_s(MTOPTION.AUTO_SAVE, buf, 10); + WritePrivateProfileString(iniSystem, _T("AutoSave"), buf, ini); + _itot_s(MTOPTION.MAX_CONNECTION, buf, 10); + WritePrivateProfileString(iniSystem, _T("MaxConnection"), buf, ini); + _itot_s(MTOPTION.BGM_VOLUME, buf, 10); + WritePrivateProfileString(iniSystem, _T("BGMVolume"), buf, ini); + _itot_s(MTOPTION.SE_VOLUME, buf, 10); + WritePrivateProfileString(iniSystem, _T("SEVolume"), buf, ini); + _itot_s(MTOPTION.RECORD_REPLAY, buf, 10); + WritePrivateProfileString(iniSystem, _T("RecordReplay"), buf, ini); + _itot_s(MTOPTION.ALLOW_SPECTATOR, buf, 10); + WritePrivateProfileString(iniSystem, _T("AllowSpectator"), buf, ini); + _itot_s(MTOPTION.LOG_WORDWRAP, buf, 10); + WritePrivateProfileString(iniSystem, _T("LogWordWrap"), buf, ini); + _itot_s(MTOPTION.LOG_LOCK, buf, 10); + WritePrivateProfileString(iniSystem, _T("LogLock"), buf, ini); + _itot_s(MTOPTION.NAME_FLASH, buf, 10); + WritePrivateProfileString(iniSystem, _T("NameFlash"), buf, ini); + _itot_s(MTOPTION.TALK_FLASH, buf, 10); + WritePrivateProfileString(iniSystem, _T("TalkFlash"), buf, ini); + _itot_s(MTOPTION.AFTER_REST, buf, 10); + WritePrivateProfileString(iniSystem, _T("AfterRest"), buf, ini); + _itot_s(MTOPTION.AUTO_REST, buf, 10); + WritePrivateProfileString(iniSystem, _T("AutoRest"), buf, ini); + _itot_s(MTOPTION.AUTO_REST_TIME, buf, 10); + WritePrivateProfileString(iniSystem, _T("AutoRestTime"), buf, ini); + _itot_s(MTOPTION.ENTER_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("EnterSoundEnable"), buf, ini); + _itot_s(MTOPTION.VS_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("VSSoundEnable"), buf, ini); + _itot_s(MTOPTION.NOTICE_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("NoticeSoundEnable"), buf, ini); + _itot_s(MTOPTION.NAME_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("NameSoundEnable"), buf, ini); + _itot_s(MTOPTION.TALK_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("TalkSoundEnable"), buf, ini); + _itot_s(MTOPTION.SEEK_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("SeekSoundEnable"), buf, ini); + _itot_s(MTOPTION.KEYWORD_SOUND_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("KeywordSoundEnable"), buf, ini); + _itot_s(MTOPTION.GET_IP_ENABLE, buf, 10); + WritePrivateProfileString(iniSystem, _T("GetIPEnable"), buf, ini); + _itot_s(MTOPTION.SHOW_GAME_OPTION, buf, 10); + WritePrivateProfileString(iniSystem, _T("ShowGameOption"), buf, ini); + _itot_s(MTOPTION.SHOW_RESULT, buf, 10); + WritePrivateProfileString(iniSystem, _T("ShowResult"), buf, ini); + + // ƒuƒbƒNƒ}[ƒN‘‚«ž‚Ý + if(MTOPTION.BOOKMARK_COUNT > 0) { + for(UINT i=0;i < MTOPTION.BOOKMARK_COUNT;i++) { + if(gcnew String(MTOPTION.BOOKMARK_SERVER_NAME[i]) != ""){ + _stprintf_s(tmpStrName, _T("%s%s,"), tmpStrName, MTOPTION.BOOKMARK_SERVER_NAME[i]); + _stprintf_s(tmpStrIP, _T("%s%s,"), tmpStrIP, MTOPTION.BOOKMARK_CONNECTION_IP[i]); + _stprintf_s(tmpStrType, _T("%s%s,"), tmpStrType, MTOPTION.BOOKMARK_CONNECTION_TYPE[i]); + _stprintf_s(tmpStrPort, _T("%s%s,"), tmpStrPort, MTOPTION.BOOKMARK_PORT[i]); + } + } + WritePrivateProfileString(iniSystem, _T("BookMarkServerName"), tmpStrName, ini); + WritePrivateProfileString(iniSystem, _T("BookMarkConnectIP"), tmpStrIP, ini); + WritePrivateProfileString(iniSystem, _T("BookMarkConnectType"), tmpStrType, ini); + WritePrivateProfileString(iniSystem, _T("BookMarkPort"), tmpStrPort, ini); + } + + // ƒvƒƒtƒ@ƒCƒ‹ƒŠƒXƒg‘‚«ž‚Ý + WritePrivateProfileString(iniSystem, _T("DefaultProfile"), MTOPTION.PROFILE, ini); + String^ bufProfileList; + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(i > 0){ + bufProfileList = String::Format("{0},{1}", bufProfileList, Profile::ProfileList[i]); + }else{ + bufProfileList = String::Format("{0}{1}", bufProfileList, Profile::ProfileList[i]); + } + } + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(bufProfileList); + _tcscpy_s(MTOPTION.PROFILE_LIST, static_cast(mp.ToPointer())); + Runtime::InteropServices::Marshal::FreeHGlobal(mp); + WritePrivateProfileString(iniSystem, _T("ProfileList"), MTOPTION.PROFILE_LIST, ini); + + // ƒvƒƒtƒ@ƒCƒ‹ƒZƒNƒVƒ‡ƒ“‘‚«ž‚Ý + WritePrivateProfileString(iniSection, _T("GameExe"), MTOPTION.GAME_EXE, ini); + WritePrivateProfileString(iniSection, _T("ReplayFolder"), MTOPTION.REPLAY_FOLDER, ini); + _itot_s(MTOPTION.MAX_STAGE, buf, 10); + WritePrivateProfileString(iniSection, _T("MaxStage"), buf, ini); + _itot_s(MTOPTION.STAGE_SELECT, buf, 10); + WritePrivateProfileString(iniSection, _T("StageSelect"), buf, ini); + _itot_s(MTOPTION.ROUND, buf, 10); + WritePrivateProfileString(iniSection, _T("Round"), buf, ini); + _itot_s(MTOPTION.TIMER, buf, 10); + WritePrivateProfileString(iniSection, _T("Timer"), buf, ini); + _itot_s(MTOPTION.TEAM_ROUND_HP, buf, 10); + WritePrivateProfileString(iniSection, _T("TeamRoundHP"), buf, ini); + _itot_s(MTOPTION.SIMULATE_DELAY, buf, 10); + WritePrivateProfileString(iniSection, _T("SimulateDelay"), buf, ini); + _itot_s(MTOPTION.HIT_JUDGE, buf, 10); + WritePrivateProfileString(iniSection, _T("HitJudge"), buf, ini); + _itot_s(MTOPTION.DISPLAY_NAME, buf, 10); + WritePrivateProfileString(iniSection, _T("DisplayName"), buf, ini); + _itot_s(MTOPTION.DISPLAY_VERSUS, buf, 10); + WritePrivateProfileString(iniSection, _T("DisplayVersus"), buf, ini); + _itot_s(MTOPTION.DISPLAY_FRAMERATE, buf, 10); + WritePrivateProfileString(iniSection, _T("DisplayFramerate"), buf, ini); + _itot_s(MTOPTION.DISPLAY_RAND, buf, 10); + WritePrivateProfileString(iniSection, _T("DisplayRand"), buf, ini); + _itot_s(MTOPTION.REPLAY_DIVIDE, buf, 10); + WritePrivateProfileString(iniSection, _T("ReplayDivide"), buf, ini); + _itot_s(MTOPTION.CHANGE_WINDOW_SIZE, buf, 10); + WritePrivateProfileString(iniSection, _T("ChangeWindowSize"), buf, ini); + _itot_s(MTOPTION.CHAT_HISTORY, buf, 10); + WritePrivateProfileString(iniSection, _T("ChatHistory"), buf, ini); + _itot_s(MTOPTION.DELAY, buf, 10); + WritePrivateProfileString(iniSection, _T("Delay"), buf, ini); + _itot_s(MTOPTION.INTERVAL, buf, 10); + WritePrivateProfileString(iniSection, _T("Interval"), buf, ini); + _itot_s(MTOPTION.REPLAY_VERSION, buf, 10); + WritePrivateProfileString(iniSection, _T("ReplayVersion"), buf, ini); + + // ƒEƒBƒ“ƒhƒEˆÊ’u‘‚«ž‚Ý + _itot_s(MTWS.LEFT, buf, 10); + WritePrivateProfileString(iniState, _T("Left"), buf, ini); + _itot_s(MTWS.TOP, buf, 10); + WritePrivateProfileString(iniState, _T("Top"), buf, ini); + _itot_s(MTWS.WIDTH, buf, 10); + WritePrivateProfileString(iniState, _T("Width"), buf, ini); + _itot_s(MTWS.HEIGHT, buf, 10); + WritePrivateProfileString(iniState, _T("Height"), buf, ini); + _itot_s(MTWS.SPLITTER, buf, 10); + WritePrivateProfileString(iniState, _T("Splitter"), buf, ini); + _itot_s(MTWS.DIALOG_LEFT, buf, 10); + WritePrivateProfileString(iniState, _T("DialogLeft"), buf, ini); + _itot_s(MTWS.DIALOG_TOP, buf, 10); + WritePrivateProfileString(iniState, _T("DialogTop"), buf, ini); + + // F‘‚«ž‚Ý + _ultot_s(MTCOLOR.SERVER_NAME, buf, 10); + WritePrivateProfileString(iniColor, _T("ServerName"), buf, ini); + _ultot_s(MTCOLOR.HOST_NAME, buf, 10); + WritePrivateProfileString(iniColor, _T("HostName"), buf, ini); + _ultot_s(MTCOLOR.CLIENT_NAME, buf, 10); + WritePrivateProfileString(iniColor, _T("ClientName"), buf, ini); + _ultot_s(MTCOLOR.REST_STATE, buf, 10); + WritePrivateProfileString(iniColor, _T("RestState"), buf, ini); + _ultot_s(MTCOLOR.VS_STATE, buf, 10); + WritePrivateProfileString(iniColor, _T("VSState"), buf, ini); + _ultot_s(MTCOLOR.WATCH_STATE, buf, 10); + WritePrivateProfileString(iniColor, _T("WatchState"), buf, ini); + _ultot_s(MTCOLOR.SEEK_STATE, buf, 10); + WritePrivateProfileString(iniColor, _T("SeekState"), buf, ini); + _ultot_s(MTCOLOR.SYSTEM_MESSAGE, buf, 10); + WritePrivateProfileString(iniColor, _T("SystemMessage"),buf, ini); + _ultot_s(MTCOLOR.ERROR_MESSAGE, buf, 10); + WritePrivateProfileString(iniColor, _T("ErrorMessage"), buf, ini); + _ultot_s(MTCOLOR.DEBUG_MESSAGE, buf, 10); + WritePrivateProfileString(iniColor, _T("DebugMessage"), buf, ini); + _ultot_s(MTCOLOR.NOTICE_BACK, buf, 10); + WritePrivateProfileString(iniColor, _T("NoticeBack"), buf, ini); + _ultot_s(MTCOLOR.COMMENT_BACK, buf, 10); + WritePrivateProfileString(iniColor, _T("CommentBack"), buf, ini); + _ultot_s(MTCOLOR.SECRET, buf, 10); + WritePrivateProfileString(iniColor, _T("Secret"), buf, ini); +} +// ƒvƒƒtƒ@ƒCƒ‹ƒZƒNƒVƒ‡ƒ“íœ +void DeleteSection(TCHAR* obj){ + TCHAR ini[_MAX_PATH]; + _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + WritePrivateProfileStruct(obj, NULL, NULL, 0, ini); +} +// ƒvƒƒtƒ@ƒCƒ‹ŠÖ˜A‚Ì‚Ý‘‚«o‚µ +void SaveProfileOption(){ + TCHAR ini[_MAX_PATH]; + _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + + IntPtr mp; + TCHAR iniSystem[MAX_NAME]; + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[0]); + _tcscpy_s(iniSystem, static_cast(mp.ToPointer())); + + WritePrivateProfileString(iniSystem, _T("DefaultProfile"), MTOPTION.PROFILE, ini); + String^ bufProfileList; + for(int i=0; i < Profile::ProfileList->Count; i++){ + if(i > 0){ + bufProfileList = String::Format("{0},{1}", bufProfileList, Profile::ProfileList[i]); + }else{ + bufProfileList = String::Format("{0}{1}", bufProfileList, Profile::ProfileList[i]); + } + } + mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(bufProfileList); + _tcscpy_s(MTOPTION.PROFILE_LIST, static_cast(mp.ToPointer())); + WritePrivateProfileString(iniSystem, _T("ProfileList"), MTOPTION.PROFILE_LIST, ini); + + Runtime::InteropServices::Marshal::FreeHGlobal(mp); +} +// Ý’è’l‚ðŒy‚­ƒ`ƒFƒbƒN +void CheckMTOption() +{ + TCHAR buf[_MAX_PATH]; + // ‘Š‘΃pƒX -> â‘΃pƒX + _tchdir(MTOPTION.PATH); + + _tsplitpath_s(MTOPTION.GAME_EXE, NULL, 0, NULL, 0, NULL, 0, buf, _MAX_EXT); + if(_tcscmp(buf, _T(".exe")) == 0){ + if(MTOPTION.GAME_EXE[1] != ':'){ + _tcscpy_s(buf, MTOPTION.GAME_EXE); + _tfullpath(MTOPTION.GAME_EXE, buf, _MAX_PATH); + } + } + if(MTOPTION.REPLAY_FOLDER[1] != ':'){ + _tcscpy_s(buf, MTOPTION.REPLAY_FOLDER); + _tfullpath(MTOPTION.REPLAY_FOLDER, buf, _MAX_PATH); + } + if(MTOPTION.VS_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.VS_SOUND); + _tfullpath(MTOPTION.VS_SOUND, buf, _MAX_PATH); + } + if(MTOPTION.NOTICE_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.NOTICE_SOUND); + _tfullpath(MTOPTION.NOTICE_SOUND, buf, _MAX_PATH); + } + if(MTOPTION.ENTER_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.ENTER_SOUND); + _tfullpath(MTOPTION.ENTER_SOUND, buf, _MAX_PATH); + } + if(MTOPTION.NAME_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.NAME_SOUND); + _tfullpath(MTOPTION.NAME_SOUND, buf, _MAX_PATH); + } + if(MTOPTION.TALK_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.TALK_SOUND); + _tfullpath(MTOPTION.TALK_SOUND, buf, _MAX_PATH); + } + if(MTOPTION.SEEK_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.SEEK_SOUND); + _tfullpath(MTOPTION.SEEK_SOUND, buf, _MAX_PATH); + } + if(MTOPTION.KEYWORD_SOUND[1] != ':'){ + _tcscpy_s(buf, MTOPTION.KEYWORD_SOUND); + _tfullpath(MTOPTION.KEYWORD_SOUND, buf, _MAX_PATH); + } + + // â‘΃pƒX‚É•ÏŠ·‚³‚ê‚é‚ƃhƒ‰ƒCƒu–¼‚ª¬•¶Žš‚É‚È‚é‚Ì‚ª‹C‚É‚È‚Á‚Ä‚¢‚¯‚È‚¢ + MTOPTION.GAME_EXE[0] = _totupper(MTOPTION.GAME_EXE[0]); + MTOPTION.REPLAY_FOLDER[0] = _totupper(MTOPTION.REPLAY_FOLDER[0]); + MTOPTION.VS_SOUND[0] = _totupper(MTOPTION.VS_SOUND[0]); + MTOPTION.NOTICE_SOUND[0] = _totupper(MTOPTION.NOTICE_SOUND[0]); + MTOPTION.ENTER_SOUND[0] = _totupper(MTOPTION.ENTER_SOUND[0]); + MTOPTION.NAME_SOUND[0] = _totupper(MTOPTION.NAME_SOUND[0]); + MTOPTION.TALK_SOUND[0] = _totupper(MTOPTION.TALK_SOUND[0]); + MTOPTION.SEEK_SOUND[0] = _totupper(MTOPTION.SEEK_SOUND[0]); + MTOPTION.KEYWORD_SOUND[0] = _totupper(MTOPTION.KEYWORD_SOUND[0]); +} + +// ‘Îí’†‚̃^ƒCƒgƒ‹ƒo[ +void SetCaption() +{ + EnterCriticalSection(&CS_CAPTION); + + if(MTINFO.HWND != NULL){ + SetWindowText(MTINFO.HWND, MTINFO.TITLE); + } + else{ + if(MTINFO.KGT2K){ + MTINFO.HWND = FindWindow(_T("KGT2KGAME"), NULL); + } + else{ + MTINFO.HWND = FindWindow(_T("KGT95GAME"), NULL); + } + + if(MTINFO.HWND != NULL){ + // Å‘O–Ê•\Ž¦ + if(MTINFO.SHOW_TOP == false){ + // ŠiƒcƒN95ƒEƒBƒ“ƒhƒEƒTƒCƒY•ÏX + if(MTOPTION.CHANGE_WINDOW_SIZE && MTINFO.KGT2K == false){ + RECT rc; + SetRect(&rc, 0, 0, 640, 480); + AdjustWindowRectEx(&rc, WS_OVERLAPPEDWINDOW, true, 0); + SetWindowPos(MTINFO.HWND, NULL, GetSystemMetrics(SM_CXSCREEN)/2 - 320, GetSystemMetrics(SM_CYSCREEN)/2 - 240, rc.right - rc.left, rc.bottom - rc.top, 0); + } + + SetWindowPos(MTINFO.HWND, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(MTINFO.HWND, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + + MTINFO.SHOW_TOP = true; + } + + GetWindowText(MTINFO.HWND, MTINFO.ORIGINAL_TITLE, sizeof(MTINFO.ORIGINAL_TITLE)); + + if(_tcslen(MTINFO.ORIGINAL_TITLE) == 0 || _tcscmp(MTINFO.ORIGINAL_TITLE, _T("‚Q‚cŠi“¬ƒcƒN[ƒ‹‚X‚T")) == 0){ + MTINFO.HWND = NULL; + } + } + } + + LeaveCriticalSection(&CS_CAPTION); +} + +// ˆÃ†•œ†—p—” +UINT CipherRand(UINT32 seed) +{ + static UINT32 a[4] = {1812433254, 3713160357, 3109174145, 64984499}; + + if(seed == 0){ + UINT t = (a[0]^(a[0] << 11)); + + a[0] = a[1]; a[1] = a[2]; a[2] = a[3]; + return (a[3] = (a[3]^(a[3] >> 19))^(t^(t >> 8))); + } + else{ + for(int i = 0; i < 4; i++){ + a[i] = seed = 1812433253*(seed^(seed >> 30)) + i; + } + } + + return 0; +} + +// ’Êí—p +UINT XorShift(UINT32 seed) +{ + static UINT32 a[4] = {1812433254, 3713160357, 3109174145, 64984499}; + + if(seed == 0){ + UINT t = (a[0]^(a[0] << 11)); + + a[0] = a[1]; a[1] = a[2]; a[2] = a[3]; + return (a[3] = (a[3]^(a[3] >> 19))^(t^(t >> 8))); + } + else{ + for(int i = 0; i < 4; i++){ + a[i] = seed = 1812433253*(seed^(seed >> 30)) + i; + } + } + + return 0; +} + +// ƒ‰ƒ“ƒ_ƒ€ƒXƒe[ƒW—p +UINT RandomStage(UINT32 seed) +{ + static UINT32 a[4] = {1812433254, 3713160357, 3109174145, 64984499}; + + if(seed == 0){ + UINT t = (a[0]^(a[0] << 11)); + + a[0] = a[1]; a[1] = a[2]; a[2] = a[3]; + return (a[3] = (a[3]^(a[3] >> 19))^(t^(t >> 8))); + } + else{ + for(int i = 0; i < 4; i++){ + a[i] = seed = 1812433253*(seed^(seed >> 30)) + i; + } + } + + return 0; +} + + +// IP‚̃Gƒ“ƒR[ƒh +String^ EncryptionIP(String^ ip) +{ + String ^ipString; + try { + ipString = Int64(Net::IPAddress::Parse(ip)->Address).ToString(); + } + catch (ArgumentNullException^) { + return "•ÏŠ·Ž¸”sBIP‚Ê‚é‚ÛƒGƒ‰["; + } + catch (FormatException^) { + return "•ÏŠ·Ž¸”sBIPŒ`Ž®ƒGƒ‰["; + } + + array ^binaryData = gcnew array(11); + binaryData = System::Text::Encoding::ASCII->GetBytes(ipString); + + String ^ipBase64; + try { + ipBase64 = Convert::ToBase64String(binaryData); + } + catch (ArgumentNullException^) { + return "•ÏŠ·Ž¸”sBBase64‚Ê‚é‚ÛƒGƒ‰["; + } + catch (FormatException^) { + return "•ÏŠ·Ž¸”sBBase64Œ`Ž®ƒGƒ‰["; + } + return ipBase64; +} +// IP‚Ì•ÏŠ·(MTSPƒAƒhƒŒƒX) +String^ MTEncryptionIP(String^ ip) +{ + String^ result, ^buf, ^part; + String^ dic = "‚»‚¼‚½‚¾‚¿‚À‚Á‚‚ÂĂłƂǂȂɂʂ˂̂͂Îabcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYG‚Ÿ‚ ‚¡‚¢‚£‚¤‚¥‚¦‚§‚¨‚©‚ª‚«‚¬‚­‚®‚¯‚°‚±‚²‚³‚´‚µ‚¶‚·‚¸‚¹‚º"; + + try{ + // 10Œ…+ƒV[ƒh + Int64^ num = ((IPAddress::Parse(ip)->Address + 0xa68c8b5) ^ 0xe5c06811); + ip = num->ToString(); + if((ip->Length % 2) == 1){ + ip = String::Concat("0", ip); + } + // 5Œ…‚É‚µ‚悤 + for(int i=0; i < ip->Length; i+=2){ + part = String::Concat(ip->default[i], ip->default[i+1]); + buf = String::Concat(dic->default[Convert::ToInt32(part)]); + result = String::Concat(result, buf); + } + return result; + } + catch(Exception^){ + return "IPƒAƒhƒŒƒX‚ÌMTSP•ÏŠ·‚ÉŽ¸”s‚µ‚Ü‚µ‚½B"; + } +} + +// IP‚̃fƒR[ƒh +_int64 DecryptionIP(String^ cipher_ip, bool enc) +{ + array ^binaryData; + + try { + binaryData = Convert::FromBase64String(cipher_ip); + } + catch (ArgumentNullException^) { + throw gcnew ArgumentNullException; + return 0; + } + catch (FormatException^) { + throw gcnew FormatException; + return 0; + } + + if(enc){ + return Convert::ToInt64(Encoding::ASCII->GetString(binaryData)); + }else{ + // 1.02, 1.03ŒÝŠ·—p + return Convert::ToInt64(Encoding::Unicode->GetString(binaryData)); + } +} +_int64 MTDecryptionIP(String^ cipher_ip) +{ + String^ buf; + TCHAR part; + int index; + String^ dic = "‚»‚¼‚½‚¾‚¿‚À‚Á‚‚ÂĂłƂǂȂɂʂ˂̂͂Îabcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYG‚Ÿ‚ ‚¡‚¢‚£‚¤‚¥‚¦‚§‚¨‚©‚ª‚«‚¬‚­‚®‚¯‚°‚±‚²‚³‚´‚µ‚¶‚·‚¸‚¹‚º"; + + try{ + for(int i=0; i < cipher_ip->Length; i++){ + part = cipher_ip->default[i]; + index = dic->IndexOf(part); + if(index < 10){ + buf = String::Format("{0}0{1}", buf, index); + }else{ + buf = String::Format("{0}{1}", buf, index); + } + } + return ((Convert::ToInt64(buf) ^ 0xe5c06811) - 0xa68c8b5); + } + catch(Exception^){ + return 0; + } +} \ No newline at end of file diff --git a/LilithPort/stdafx.h b/LilithPort/stdafx.h new file mode 100644 index 0000000..9fdd140 --- /dev/null +++ b/LilithPort/stdafx.h @@ -0,0 +1,519 @@ +// stdafx.h : •W€‚̃VƒXƒeƒ€ ƒCƒ“ƒNƒ‹[ƒh ƒtƒ@ƒCƒ‹‚̃Cƒ“ƒNƒ‹[ƒh ƒtƒ@ƒCƒ‹A‚Ü‚½‚Í +// ŽQƉñ”‚ª‘½‚­A‚©‚‚ ‚Ü‚è•ÏX‚³‚ê‚È‚¢AƒvƒƒWƒFƒNƒgê—p‚̃Cƒ“ƒNƒ‹[ƒh ƒtƒ@ƒCƒ‹ +// ‚ð‹Lq‚µ‚Ü‚·B +#pragma once +#pragma warning(disable: 4100) + +// TODO: ƒvƒƒOƒ‰ƒ€‚É•K—v‚ȒljÁƒwƒbƒ_[‚ð‚±‚±‚ÅŽQÆ‚µ‚Ä‚­‚¾‚³‚¢B +#include +#include +#include +#include +#include +#include +#include + +#pragma comment(lib, "user32.lib") +#pragma comment(lib, "winmm.lib") + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Collections; +using namespace System::Text; +using namespace System::Drawing; +using namespace System::Net; + +void WriteErrorLog(String^ text, String^ caption); +void ApplicationThreadException(Object^ sender, Threading::ThreadExceptionEventArgs^ e); +void ApplicationUnhandledException(Object^ sender, UnhandledExceptionEventArgs^ e); + +void LoadMTOption(); +void SaveMTOption(); +void SaveProfileOption(); +void CheckMTOption(); +void DeleteSection(TCHAR* obj); +void ChangeStageValue(); +void SetCaption(); + +String^ EncryptionIP(String^ ip); +String^ MTEncryptionIP(String^ ip); +_int64 DecryptionIP(String^ cipher_ip, bool enc); +_int64 MTDecryptionIP(String^ cipher_ip); + +UINT CipherRand(UINT32 seed = 0); +UINT XorShift(UINT32 seed = 0); +UINT RandomStage(UINT32 seed = 0); + +// ƒƒ“ƒo[î•ñ +public ref struct MemberInfo +{ + IPEndPoint^ IP_EP; + String^ NAME; + String^ COMMENT; + UINT16 ID; + UINT TYPE; + UINT STATE; + UINT NUM_VS; + DWORD RESPONSE; +}; + +// ƒoƒbƒNƒAƒbƒv +public ref struct MemberInfoBackUp +{ + IPEndPoint^ IP_EP; + UINT16 ID; +}; + +// ƒvƒƒtƒ@ƒCƒ‹ƒŠƒXƒg +public ref class Profile +{ + public: + static Generic::List^ ProfileList = gcnew Generic::List; + // ƒoƒŠƒf[ƒVƒ‡ƒ“—p + static array^ SystemSection = gcnew array{"System", "State", "Color"}; +}; + +// DEBUGGEE +// KGT2KGAME +const UINT P1_INPUT = 0x004259C0; +const UINT P2_INPUT = 0x004259C4; + +const UINT SINGLE_CONTROL_HOOK = 0x00414712; +const BYTE SINGLE_CONTROL_HOOK_CODE[] = {0xCC,0x90,0x90,0x90,0x90,0x90}; +const UINT VS_CONTROL_HOOK = 0x00414748; +const BYTE VS_CONTROL_HOOK_CODE[] = {0x6A,0x00}; + +const UINT STORY_KEY = 0x00414729; +const BYTE STORY_KEY_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; +const UINT VS_P1_KEY = 0x0041474A; +const BYTE VS_P1_KEY_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; +const UINT VS_P2_KEY = 0x00414764; +const BYTE VS_P2_KEY_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; + +const UINT RANDOM_SEED = 0x0041FB1C; +const UINT RAND_FUNC = 0x00417A22; +const BYTE RAND_FUNC_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; + +const UINT HIT_JUDGE = 0x0042470C; +const UINT HIT_JUDGE_SET = 0x00414C90; +const BYTE HIT_JUDGE_SET_CODE[] = {0x90,0x90,0x90,0x90,0x90,0x90}; + +const UINT DEFAULT_ROUND = 0x00430124; +const UINT ROUND_SET = 0x00414AFC; +const BYTE ROUND_SET_CODE[] = {0x90,0x90,0x90,0x90,0x90}; + +const UINT TEAM_ROUND = 0x00430128; +const UINT TEAM_ROUND_SET = 0x00414ADB; +const BYTE TEAM_ROUND_SET_CODE[] = {0x90,0x90,0x90,0x90,0x90}; + +const UINT DEFAULT_TIMER = 0x00430114; +const UINT TIMER_SET = 0x00414A8C; +const BYTE TIMER_SET_CODE[] = {0x90,0x90,0x90,0x90,0x90}; + +const UINT VS_ROUND = 0x0040897F; +const BYTE VS_ROUND_CODE[] = {0xCC}; +const UINT ROUND_ESI = 0x004EDCAC; +const UINT ROUND_END = 0x00409715; +const BYTE ROUND_END_CODE[] = {0xCC,0x90,0x90,0x90,0x90,0x90}; + +const UINT P1_HP = 0x004DFC85; +const UINT P1_MAX_HP = 0x004DFC91; +const UINT P1_STATE = 0x0047033E; +const UINT P2_HP = 0x004EDCC4; +const UINT P2_MAX_HP = 0x004EDCD0; +const UINT P2_STATE = 0x004704BC; + +const UINT STAGE_SELECT = 0x00408756; +const BYTE STAGE_SELECT_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; + +const UINT FRAME_RATE = 0x00404C37; +const BYTE FRAME_RATE_CODE[] = {0xCC,0x90}; + +const UINT BGM_VOLUME = 0x0040347E; +const UINT SE_VOLUME = 0x0040348C; +const UINT VOLUME_SET_1 = 0x00403401; +const BYTE VOLUME_SET_1_CODE[] = {0x58,0x8B,0x08,0x6A,0x01,0xEB,0x0D,0x58,0x8B,0x08,0x6A,0x00,0xEB,0x06,0x90,0xE9, + 0xEB,0x21,0x01,0x00,0x6A,0x00,0x6A,0x00,0x50,0xFF,0x51,0x30,0x5B,0xC3}; +const UINT VOLUME_SET_2 = 0x0040347B; +const BYTE VOLUME_SET_2_CODE[] = {0x50,0x8B,0x08,0xCC,0x52,0x50,0xFF,0x51,0x3C,0xE9,0x78,0xFF,0xFF,0xFF,0x50,0x8B, + 0x08,0xCC,0x52,0x50,0xFF,0x51,0x3C,0xE9,0x71,0xFF,0xFF,0xFF}; + +// KGT95GAME +const UINT P1_INPUT_95 = 0x00437750; +const UINT P2_INPUT_95 = 0x00437754; +const UINT INPUT_COUNTER_95 = 0x00437700; + +const UINT UNCHECK_JOYSTICK_95 = 0x00402A33; +const BYTE UNCHECK_JOYSTICK_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; + +const UINT CONTROL_HOOK1_95 = 0x0040902B; +const BYTE CONTROL_HOOK1_95_CODE[] = {0xE8,0xB0,0xFA,0xFF,0xFF}; +const UINT CONTROL_HOOK2_95 = 0x00409053; +const BYTE CONTROL_HOOK2_95_CODE[] = {0xE8,0x88,0xFA,0xFF,0xFF}; + +const UINT STORY_P1_KEY_95 = 0x0040901C; +const BYTE STORY_P1_KEY_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90,0x90}; +const UINT STORY_P2_KEY_95 = 0x00409030; +const BYTE STORY_P2_KEY_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90,0x90}; +const UINT VS_P1_KEY_95 = 0x0040904C; +const BYTE VS_P1_KEY_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; +const UINT VS_P2_KEY_95 = 0x00409058; +const BYTE VS_P2_KEY_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; + +const UINT RANDOM_SEED_95 = 0x004243FC; +const UINT RAND_FUNC_95 = 0x0041A864; +const BYTE RAND_FUNC_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90}; + +const UINT HIT_JUDGE_95 = 0x00432740; +const UINT HIT_JUDGE_SET_95 = 0x004029E9; +const BYTE HIT_JUDGE_SET_95_CODE[] = {0x90,0x90,0x90,0x90,0x90}; + +const UINT DEFAULT_TIMER_95 = 0x00432754; +const UINT TIMER_SET_95 = 0x00402A68; +const BYTE TIMER_SET_95_CODE[] = {0x90,0x90,0x90,0x90,0x90}; + +const UINT P1_WIN_95 = 0x005E9914; +const UINT P2_WIN_95 = 0x005E9978; +const UINT VS_ROUND_95 = 0x00411661; +const BYTE VS_ROUND_95_CODE[] = {0xCC,0x90}; +const UINT ROUND_END_95 = 0x00413410; +const BYTE ROUND_END_95_CODE[] = {0xCC,0x90}; + +const UINT STAGE_SELECT_95 = 0x0041162C; +const BYTE STAGE_SELECT_95_CODE[] = {0xCC,0x90,0x90,0x90,0x90,0x90}; + +const UINT FRAME_RATE_95 = 0x00404759; +const BYTE FRAME_RATE_95_CODE[] = {0xCC,0x90}; + +const UINT BGM_VOLUME_95 = 0x00402042; +const UINT SE_VOLUME_95 = 0x00402050; +const UINT VOLUME_SET_1_95 = 0x00401FC8; +const BYTE VOLUME_SET_1_95_CODE[] = {0x58,0x8B,0x08,0x6A,0x01,0xEB,0x16,0x90,0xE9,0xCB,0x85,0x01,0x00,0x58,0x8B,0x08, + 0x6A,0x00,0xEB,0x09,0x90,0x90,0x90,0x90,0xE9,0xAB,0x85,0x01,0x00,0x6A,0x00,0x6A, + 0x00,0x50,0xFF,0x51,0x30,0x5B,0xC3}; +const UINT VOLUME_SET_2_95 = 0x0040203F; +const BYTE VOLUME_SET_2_95_CODE[] = {0x50,0x8B,0x08,0xCC,0x52,0x50,0xFF,0x51,0x3C,0xE9,0x7B,0xFF,0xFF,0xFF,0x50,0x8B, + 0x08,0xCC,0x52,0x50,0xFF,0x51,0x3C,0xE9,0x7A,0xFF,0xFF,0xFF}; + +// ƒo[ƒWƒ‡ƒ“î•ñ +// LilithPort 1.03ˆÈãŒÝŠ·, ‚»‚êˆÈ‘O‚Í‚È‚µ +const UINT LP_VERSION = 107; + +// Ý’è€–Ú +const UINT MAX_NAME = 32; +const UINT MAX_ARRAY = 64; +const UINT MAX_ID = 0x3FFF; +const UINT MAX_TITLE = 256; +const UINT MAX_PACKET = 512; +const UINT MAX_WELCOME = 512; +const UINT MAX_KEYWORD = 256; +const UINT MAX_PROFILE = 2048; + +const BYTE TYMT_VERSION = 6; +const UINT TIME_OUT = 3000; + +// ƒ`[ƒ€ƒvƒŒƒCl” +const UINT MAX_TEAM_ROUND = 4; + + +typedef struct _MT_SP_INFORMATION +{ + bool DEBUG; + bool RAND_SEARCH; + bool INITIALIZED; + bool SHOW_TOP; + bool KGT2K; + UINT32 SEED; + UINT32 MAX_STAGE; + UINT32 STAGE_SELECT; + UINT32 ROUND; + UINT32 TIMER; + HANDLE PROCESS; + DWORD PROCESS_ID; + HWND HWND; + bool CONTROL; // 0:P1 1:P2 + TCHAR P1_NAME[MAX_NAME]; + TCHAR P2_NAME[MAX_NAME]; + TCHAR ORIGINAL_TITLE[MAX_TITLE]; + TCHAR TITLE[MAX_TITLE]; + INT32 VOLUME[21]; + bool VERSION_CHECKED; + UINT P_HP; + bool WINNER; // 0:P1 1:P2 + bool TEAM_ROUND_HP; + bool SERVER_MODE; + UINT SERVER_MODE_PORT; + bool ERRORED; +} MT_SP_INFORMATION; + +typedef struct _MT_SP_OPTION +{ + TCHAR PATH[_MAX_PATH]; + UINT CONNECTION_TYPE; + TCHAR SERVER_NAME[MAX_NAME]; + TCHAR CONNECTION_IP[MAX_ARRAY]; + TCHAR WELCOME[MAX_WELCOME]; + UINT BOOKMARK_COUNT; + UINT BOOKMARK_DELETED_COUNT; + TCHAR BOOKMARK_SERVER_NAME[MAX_TITLE][MAX_ARRAY]; + TCHAR BOOKMARK_CONNECTION_IP[MAX_NAME][MAX_ARRAY]; + TCHAR BOOKMARK_CONNECTION_TYPE[MAX_NAME][MAX_ARRAY]; + TCHAR BOOKMARK_PORT[MAX_NAME][MAX_ARRAY]; + TCHAR GAME_EXE[_MAX_PATH]; + TCHAR REPLAY_FOLDER[_MAX_PATH]; + TCHAR VS_SOUND[_MAX_PATH]; + bool VS_SOUND_ENABLE; + TCHAR NOTICE_SOUND[_MAX_PATH]; + bool NOTICE_SOUND_ENABLE; + TCHAR ENTER_SOUND[_MAX_PATH]; + bool ENTER_SOUND_ENABLE; + TCHAR NAME_SOUND[_MAX_PATH]; + bool NAME_SOUND_ENABLE; + TCHAR TALK_SOUND[_MAX_PATH]; + bool TALK_SOUND_ENABLE; + TCHAR SEEK_SOUND[_MAX_PATH]; + bool SEEK_SOUND_ENABLE; + TCHAR KEYWORD_SOUND[_MAX_PATH]; + bool KEYWORD_SOUND_ENABLE; + TCHAR KEYWORD[MAX_KEYWORD]; + TCHAR NAME[MAX_NAME]; + TCHAR COMMENT[MAX_NAME]; + UINT PORT; + UINT OPEN_PORT; + UINT AUTO_SAVE; + UINT MAX_CONNECTION; + UINT BGM_VOLUME; + UINT SE_VOLUME; + UINT MAX_STAGE; + UINT STAGE_SELECT; + UINT ROUND; + UINT TIMER; + bool TEAM_ROUND_HP; + UINT SIMULATE_DELAY; + bool HIT_JUDGE; + bool DISPLAY_NAME; + bool DISPLAY_VERSUS; + bool DISPLAY_FRAMERATE; + bool DISPLAY_RAND; + bool REPLAY_DIVIDE; + bool CHANGE_WINDOW_SIZE; + UINT CHAT_HISTORY; + UINT DELAY; + UINT INTERVAL; + UINT REPLAY_VERSION; + bool RECORD_REPLAY; + bool ALLOW_SPECTATOR; + bool LOG_WORDWRAP; + bool LOG_LOCK; + bool NAME_FLASH; + bool TALK_FLASH; + bool AFTER_REST; + bool AUTO_REST; + UINT AUTO_REST_TIME; + bool GET_IP_ENABLE; + bool SHOW_GAME_OPTION; + bool SHOW_RESULT; + TCHAR PROFILE[MAX_ARRAY]; + TCHAR PROFILE_LIST[MAX_PROFILE]; + UINT PROFILE_INDEX; +} MT_SP_OPTION; + +typedef struct _MT_SP_WINDOW_STATE +{ + int LEFT; + int TOP; + int WIDTH; + int HEIGHT; + int SPLITTER; + int DIALOG_LEFT; + int DIALOG_TOP; +} MT_SP_WINDOW_STATE; + +typedef struct _MT_SP_COLOR +{ + UINT32 SERVER_NAME; + UINT32 HOST_NAME; + UINT32 CLIENT_NAME; + UINT32 REST_STATE; + UINT32 VS_STATE; + UINT32 WATCH_STATE; + UINT32 SEEK_STATE; + UINT32 SYSTEM_MESSAGE; + UINT32 ERROR_MESSAGE; + UINT32 DEBUG_MESSAGE; + UINT32 NOTICE_BACK; + UINT32 COMMENT_BACK; + UINT32 SECRET; +} MT_SP_COLOR; + +typedef struct _REPLAY_DATA +{ + UINT16 KEY; + BYTE COUNT; +} REPLAY_DATA; + +typedef struct _REPLAY_INFO +{ + TCHAR VERSION; + bool CONTROL; + UINT16 KEY[2]; + BYTE COUNT[2]; + + std::deque DEQUE[2]; +} REPLAY_INFO; + +typedef enum { + CT_SERVER, + CT_HOST, + CT_CLIENT, + CT_FREE, +} CONNECTION_TYPE; + +typedef enum { + SM_NORMAL, + SM_MIX, + SM_MATCH, + SM_NORA, +} SERVER_MODE; + +typedef enum { + MS_FREE, + MS_REST, + MS_VS, + MS_WATCH, + MS_COUCH, + MS_READY, + MS_SEEK, +} MEMBER_STATE; + +typedef enum { + LV_NAME, + LV_COMMENT, + LV_BLIND, +} LIST_VIEW; + +typedef enum { + RT_FREE = 1, + RT_VS, + RT_PLAYBACK, + RT_WATCH, +} RUN_TYPE; + +typedef enum { + PH_PING, + PH_PONG, + PH_REQ_CONNECTION, // 1:protocol 1:name_l n:name 1:comment_l n:comment + PH_REQ_CONNECTION_H, // HOST‚ÈÚ‘±—v‹ + PH_RES_CONNECTION, // 1:server_name_l n:server_name 2:ID 1:name_l n:name 1:comment_l n:comment 1:state + PH_MESSAGE, // 2:ID 1:msg_l n:msg + PH_NOTICE, // 1:len n:notice + PH_REQ_LIST, // 2:ID 0‚Å‘Sˆõ•ª + PH_RES_LIST, // 2:ID 1:name_l n:name 1:comment_l n:comment 1:state 4:IP 2:Port + ˆÃ† + PH_NEW_MEMBER, // ã‚Æ“¯‚¶ + PH_QUIT, // 2:ID + PH_LOST, // 2:ID + PH_CHANGE_STATE, // 2:ID 1:STATE + PH_REQ_STATE, // 2:ID + PH_RES_STATE, // 2:ID 1:STATE + PH_CHANGE_COMMENT, // 2:ID 1:comment_l n:comment + PH_DICE, // 1:value + PH_REQ_VS, // 2:ID 4:ŽÀsƒtƒ@ƒCƒ‹‚̃nƒbƒVƒ… + PH_RES_VS, // 1:state + PH_REQ_VS_PING, // 1:ID 5ŒÂƒoƒ‰‚Åsend + PH_RES_VS_PONG, // 1•bŠÔ‚É4ŒÂˆÈãŽóM‚Å‘ÎíŠJŽn + PH_REQ_VS_SETTING, // 1:delay local‚Æhost‚Å‘å‚«‚È’l‚É‚ ‚킹‚é + PH_RES_VS_SETTING, // 1:delay 4:seed 1:max_stage 1:stage 1:round 1:timer + PH_VS_DATA, // 4:frame n:data 4*delayŒÂ•ª‘—M + PH_REQ_VS_DATA, // 4:frame ƒpƒPƒbƒg—ˆ‚Ä‚È‚¢‚Ì‚Å‹Ù‹}—v¿ + PH_RES_VS_DATA, // 4:frame 2:input + PH_VS_END, + PH_REQ_WATCH, // 2:ID + PH_RES_WATCH, // 1:state 2:P1ID 2:P2ID 4:seed 1:max_stage 1:stage 1:round 1:timer state = 0:ŠÏíŠJŽn 1`:ŠÏí•s‰Â + PH_WATCH_DATA, // 4:frame 40:10ƒtƒŒ[ƒ€•ª‚̃f[ƒ^ + PH_WATCH_END, // 2:ID Ž©•ª‚Ì‚Æ“¯‚¶ID‚È‚çŠÏíI—¹A‘¼‚ÌID‚Ȃ烊ƒXƒg‚©‚çíœ + PH_SECRET, // 1:type n:type‚²‚Æ‚É‚¢‚ë‚¢‚ë +} MT_SP_PACKET_HEADER; + +typedef enum { + ST_PING, // 4:time + ST_PONG, +} SECRET_TYPE; + +typedef enum { + VS_REQ, + VS_PING, + VS_SETTING, + VS_STANDBY, + VS_DATA, + VS_END, + VS_TIMEOUT, + VS_ERROR, +} VERSUS_SEQUENCE; + +extern MT_SP_INFORMATION MTINFO; +extern MT_SP_OPTION MTOPTION; +extern MT_SP_WINDOW_STATE MTWS; +extern MT_SP_COLOR MTCOLOR; + +public ref class PacketPacker +{ +public: + PacketPacker(void) + { + Length = 0; + Packet = gcnew array(MAX_PACKET); + } + +protected: + ~PacketPacker() + { + if(Packet != nullptr){ + delete Packet; + } + } + +public: + int Length; + array^ Packet; + + void Pack(BYTE data){ + Packet[Length] = data; + Length++; + } + + void Pack(array^% data){ + Array::Copy(data, 0, Packet, Length, data->Length); + Length += data->Length; + } + + void Clear(){ + Length = 0; + Packet->Clear(Packet, 0, MAX_PACKET); + } +}; + +public ref class PacketDivider +{ +public: + int Length; + array^ Packet; + + PacketDivider(array^% datagram) + { + Length = 0; + Packet = datagram; + } + + BYTE Divide(){ + return Packet[Length++]; + } + + array^ Divide(int length){ + array^ data = gcnew array(length); + + Array::Copy(Packet, Length, data, 0, length); + Length += length; + + return data; + } +};