Version 1.07 from zip file (10/24/15)

http://ux.getuploader.com/ainefill/download/342/
This commit is contained in:
oldmud0 2015-11-11 21:27:28 -06:00
commit 8363637872
17 changed files with 12722 additions and 0 deletions

33
.gitignore vendored Normal file
View file

@ -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

20
LilithPort.sln Normal file
View file

@ -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

View file

@ -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;
//
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
//
[assembly:AssemblyTitleAttribute("LilithPort")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("LilithPort")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2014")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
// 既定値にすることができます:
[assembly:AssemblyVersionAttribute("1.0.0.0")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

85
LilithPort/LilithPort.cpp Normal file
View file

@ -0,0 +1,85 @@
// LilithPort.cpp : メイン プロジェクト ファイルです。
#include "stdafx.h"
#include "MainForm.h"
#include <math.h>
using namespace LilithPort;
// グローバル
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<System::String ^> ^args)
{
// コントロールが作成される前に、Windows XP ビジュアル効果を有効にします
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(true);
// 自プログラムのパス
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);
// コマンドライン引数
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)をあらかじめ計算しておく
MTINFO.VOLUME[0] = -10000;
for(int i = 1; i < 21; i++){
// -6dBで音量半減、DirectSound的には-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);
// 未処理の例外をキャッチ
Application::ThreadException += gcnew ThreadExceptionEventHandler(ApplicationThreadException);
Threading::Thread::GetDomain()->UnhandledException += gcnew UnhandledExceptionEventHandler(ApplicationUnhandledException);
// メイン ウィンドウを作成して、実行します
Application::Run(gcnew MainForm());
DeleteCriticalSection(&CS_CAPTION);
SaveMTOption();
return 0;
}

View file

@ -0,0 +1,297 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="LilithPort"
ProjectGUID="{9057AFAF-D9A2-4F09-8D35-C39084BA2A87}"
RootNamespace="LilithPort"
Keyword="ManagedCProj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
ManagedExtensions="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(NoInherit)"
LinkIncremental="2"
EnableUAC="false"
GenerateDebugInformation="true"
AssemblyDebug="1"
SubSystem="2"
EntryPointSymbol="main"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
ManagedExtensions="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(NoInherit)"
LinkIncremental="1"
EnableUAC="false"
GenerateDebugInformation="true"
SubSystem="2"
EntryPointSymbol="main"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.Drawing.dll"
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.Windows.Forms.dll"
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
</References>
<Files>
<Filter
Name="ソース ファイル"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\AssemblyInfo.cpp"
>
</File>
<File
RelativePath=".\LilithPort.cpp"
>
</File>
<File
RelativePath=".\MainForm.cpp"
>
</File>
<File
RelativePath=".\OptionForm.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="ヘッダー ファイル"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\MainForm.h"
FileType="3"
>
<File
RelativePath=".\MainForm.resX"
SubType="Designer"
>
</File>
</File>
<File
RelativePath=".\OptionForm.h"
FileType="3"
>
<File
RelativePath=".\OptionForm.resx"
SubType="Designer"
>
</File>
</File>
<File
RelativePath=".\StartupForm.h"
FileType="3"
>
<File
RelativePath=".\StartupForm.resx"
>
</File>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="リソース ファイル"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\app.ico"
>
</File>
<File
RelativePath=".\app.rc"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

3599
LilithPort/MainForm.cpp Normal file

File diff suppressed because it is too large Load diff

3256
LilithPort/MainForm.h Normal file

File diff suppressed because it is too large Load diff

161
LilithPort/MainForm.resX Normal file
View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ReloadListToolStripMenuItem.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStripMember.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value>
</metadata>
<metadata name="contextMenuStripLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>277, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>439, 17</value>
</metadata>
<metadata name="toolTipMember.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>571, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>713, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
</value>
</data>
</root>

222
LilithPort/OptionForm.cpp Normal file
View file

@ -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<MainForm^>(this->Owner);
try{
FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(textBoxGameExe->Text);
if(info->FileDescription != "格闘ツクール2nd." && info->FileDescription != "2D格闘ツクール95"){
throw gcnew Exception;
}
}
catch(Exception^){
textBoxGameExe->Text = gcnew String("格闘ツクールの実行ファイルではありません");
}
IntPtr mp;
// パス
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxGameExe->Text);
_tcscpy_s(MTOPTION.GAME_EXE, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxReplayFolder->Text);
_tcscpy_s(MTOPTION.REPLAY_FOLDER, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxVSSound->Text);
_tcscpy_s(MTOPTION.VS_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxNoticeSound->Text);
_tcscpy_s(MTOPTION.NOTICE_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxEnterSound->Text);
_tcscpy_s(MTOPTION.ENTER_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxNameSound->Text);
_tcscpy_s(MTOPTION.NAME_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxTalkSound->Text);
_tcscpy_s(MTOPTION.TALK_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxSeekSound->Text);
_tcscpy_s(MTOPTION.SEEK_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxKeywordSoundPath->Text);
_tcscpy_s(MTOPTION.KEYWORD_SOUND, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxKeyword->Text);
_tcscpy_s(MTOPTION.KEYWORD, static_cast<PTCHAR>(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;
// コメント
if(textBoxComment->Text != gcnew String(MTOPTION.COMMENT)){
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxComment->Text);
_tcscpy_s(MTOPTION.COMMENT, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
parent->ChangeComment(textBoxComment->Text);
}
// ゲーム
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;
// ゲーム起動中なら即時変更
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);
}
}
}
// 詳細設定
// 発言でウィンドウを点滅
MTOPTION.TALK_FLASH = checkBoxTalkFlash->Checked;
// 名前が呼ばれたらウィンドウを点滅
MTOPTION.NAME_FLASH = checkBoxNameFlash->Checked;
// 色
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();
// 色を反映させる
parent->ResetColor();
// 値のチェック
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<MainForm^>(this->Owner);
parent->ChangeProfileEnabled();
}
bool OptionForm::CheckTextProfileName(String^ buf){
// プロファイル名バリデーション
String^ mes;
if(buf == gcnew String(MTOPTION.PROFILE)){
return true;
}
if(buf->Length == 0){
mes = "プロファイル名が空欄です。";
}
if(buf->Contains(",") || buf->Contains("[") || buf->Contains("]")){
mes = "プロファイル名に使用できない文字(, [ ])が含まれています。";
}
for(int i=0; i < Profile::SystemSection->Length; i++){
if(buf == Profile::SystemSection[i]){
mes = "そのプロファイル名は使用できません。";
}
}
for(int i=0; i < Profile::ProfileList->Count; i++){
if(buf == Profile::ProfileList[i]){
mes = "そのプロファイル名は既に存在します。";
}
}
if(mes != nullptr){
MessageBox::Show(mes, "プロファイル保存", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return true;
}
return false;
}
void OptionForm::DeleteProfile(String^ buf){
// プロファイル削除
TCHAR bufProfile[MAX_ARRAY];
IntPtr mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(buf);
_tcscpy_s(bufProfile, static_cast<PTCHAR>(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<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
SaveMTOption();
}

2799
LilithPort/OptionForm.h Normal file

File diff suppressed because it is too large Load diff

149
LilithPort/OptionForm.resx Normal file
View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>149, 17</value>
</metadata>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>310, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
</value>
</data>
</root>

563
LilithPort/StartupForm.h Normal file
View file

@ -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 {
/// <summary>
/// StartupForm の概要
///
/// 警告: このクラスの名前を変更する場合、このクラスが依存するすべての .resx ファイルに関連付けられた
/// マネージ リソース コンパイラ ツールに対して 'Resource File Name' プロパティを
/// 変更する必要があります。この変更を行わないと、
/// デザイナと、このフォームに関連付けられたローカライズ済みリソースとが、
/// 正しく相互に利用できなくなります。
/// </summary>
public ref class StartupForm : public System::Windows::Forms::Form
{
public:
StartupForm(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクタ コードを追加します
//
}
protected:
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
~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:
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
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<System::ComponentModel::ISupportInitialize^ >(this->numericUpDownOpenPort))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDownPort))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(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"サーバ名:";
//
// 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"待受ポート:";
//
// 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"起動";
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"コメント:";
//
// 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"ニックネーム:";
//
// 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"起動モード";
//
// 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"接続先ポート:";
//
// 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"アドレス:";
//
// 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"プロフィール";
//
// 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"サーバメッセージ";
//
// 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<System::Drawing::Icon^ >(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"スタートアップ";
this->Load += gcnew System::EventHandler(this, &StartupForm::StartupForm_Load);
this->Shown += gcnew System::EventHandler(this, &StartupForm::StartupForm_Shown);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDownOpenPort))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDownPort))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(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;
// サーバ名チェック
if(textBoxServerName->Text->Length == 0){
MessageBox::Show("サーバ名を入力してください。\n\nSERVERモードで起動するには、\nサーバ名を入力する必要があります。", "SERVERモードエラー", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return;
}
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxServerName->Text);
_tcscpy_s(p1, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
p2 = _tcschr(p1, _T(','));
if (p2 != NULL){
MessageBox::Show("サーバ名に使用できない文字(,)があります。\nサーバ名を確認してください。", "SERVERモードエラー", 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;
}
// サーバ名
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxServerName->Text);
_tcscpy_s(MTOPTION.SERVER_NAME, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
// IPチェック
if(MTOPTION.CONNECTION_TYPE == CT_HOST || MTOPTION.CONNECTION_TYPE == CT_CLIENT) {
if(textBoxIP->Text->Length == 0){
MessageBox::Show("接続先アドレスを入力してください。\n\nHOST, CLIENTモードで起動するには、\n接続先のアドレスを入力する必要があります。", "HOST, CLIENTモードエラー", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return;
}
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxIP->Text);
_tcscpy_s(p1, static_cast<PTCHAR>(mp.ToPointer()));
p2 = _tcschr(p1, _T(','));
if (p2 != NULL){
MessageBox::Show("接続先アドレスに使用できない文字(,)があります。\n接続先アドレスを確認してください。", "HOST, CLIENTモードエラー", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return;
}
}
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxIP->Text);
_tcscpy_s(MTOPTION.CONNECTION_IP, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
// 名前チェック
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<PTCHAR>(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<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(textBoxWelcome->Text);
_tcscpy_s(MTOPTION.WELCOME, static_cast<PTCHAR>(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);
}
};
}

140
LilithPort/StartupForm.resx Normal file
View file

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
</value>
</data>
</root>

63
LilithPort/app.rc Normal file
View file

@ -0,0 +1,63 @@
// Microsoft Visual C++ で生成されたリソース スクリプトです。
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// 英語 (米国) リソース
/////////////////////////////////////////////////////////////////////////////
//
// アイコン
//
// 最初に配置されたアイコン、または ID 値が最も低いアイコンが、アプリケーション アイコンになります。
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 リソースから生成されました。
//
/////////////////////////////////////////////////////////////////////////////
#endif // APSTUDIO_INVOKED でない場合

3
LilithPort/resource.h Normal file
View file

@ -0,0 +1,3 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

773
LilithPort/stdafx.cpp Normal file
View file

@ -0,0 +1,773 @@
// stdafx.cpp : 標準インクルード LilithPort.pch のみを
// 含むソース ファイルは、プリコンパイル済みヘッダーになります。
// stdafx.obj にはプリコンパイル済み型情報が含まれます。
#include "stdafx.h"
extern CRITICAL_SECTION CS_CAPTION;
using namespace System::Collections;
// 落ちる前にエラー内容をロギング
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;
}
}
}
// 例外調査
void ApplicationThreadException(Object^ sender, Threading::ThreadExceptionEventArgs^ e)
{
WriteErrorLog(e->Exception->ToString(), "ThreadException");
MTINFO.ERRORED = true;
if(!MTINFO.SERVER_MODE){
MessageBox::Show("突然ですがLilithPort終了のお知らせです。", "緊急事態発生");
}
Application::Exit();
}
// 主にコンソールアプリの例外
void ApplicationUnhandledException(Object^ sender, UnhandledExceptionEventArgs^ e)
{
WriteErrorLog(safe_cast<Exception^>(e->ExceptionObject)->ToString(), "UnhandledException");
MTINFO.ERRORED = true;
if(!MTINFO.SERVER_MODE){
MessageBox::Show("突然ですがLilithPort終了のお知らせです。", "例外が飛んできました");
}
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に記述
TCHAR iniSystem[MAX_NAME], iniState[MAX_NAME], iniColor[MAX_NAME];
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[0]);
_tcscpy_s(iniSystem, static_cast<PTCHAR>(mp.ToPointer()));
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[1]);
_tcscpy_s(iniState, static_cast<PTCHAR>(mp.ToPointer()));
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[2]);
_tcscpy_s(iniColor, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
// グローバルセクション読み込み
// 1.04以下互換用
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;
// ブックマーク読み込み
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<String^>^ BookMarkNameList = bufBookMarkServerName->Split(',');
array<String^>^ BookMarkIPList = bufBookMarkConnectIP->Split(',');
array<String^>^ 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<PTCHAR>(mp.ToPointer()));
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkIPList[i]);
_tcscpy_s(MTOPTION.BOOKMARK_CONNECTION_IP[i], static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
// 1.04以下互換用
if(BookMarkTypeList != nullptr && BookMarkPortList != nullptr){
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkTypeList[i]);
_tcscpy_s(MTOPTION.BOOKMARK_CONNECTION_TYPE[i], static_cast<PTCHAR>(mp.ToPointer()));
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(BookMarkPortList[i]);
_tcscpy_s(MTOPTION.BOOKMARK_PORT[i], static_cast<PTCHAR>(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("ブックマーク情報の読み込みに失敗しました。\n", "ブックマーク読み込み", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
}
// プロファイルリスト読み込み
Profile::ProfileList->Clear();
if(_tcslen(MTOPTION.PROFILE_LIST) > 0){
String^ tmpList = gcnew String(MTOPTION.PROFILE_LIST);
array<String^>^ tmpProfile = tmpList->Split(',');
for(int i=0; i < tmpProfile->Length; i++){
Profile::ProfileList->Add(tmpProfile[i]);
// デフォルトプロファイル
if(tmpProfile[i] == gcnew String(MTOPTION.PROFILE)){
MTOPTION.PROFILE_INDEX = i;
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(tmpProfile[i]);
_tcscpy_s(bufSection, static_cast<PTCHAR>(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;
}
// プロファイルセクション読み込み
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);
// ウィンドウ位置読み込み
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);
// 色読み込み
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のタブを改行に
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以下互換用
if(iniVersion == 0){
DeleteSection(iniSection);
SaveMTOption();
}
}
// iniに書き出し
void SaveMTOption()
{
// 改行をタブに置換
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に記述
TCHAR iniSystem[MAX_NAME], iniState[MAX_NAME], iniColor[MAX_NAME];
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[0]);
_tcscpy_s(iniSystem, static_cast<PTCHAR>(mp.ToPointer()));
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[1]);
_tcscpy_s(iniState, static_cast<PTCHAR>(mp.ToPointer()));
mp = Runtime::InteropServices::Marshal::StringToHGlobalAuto(Profile::SystemSection[2]);
_tcscpy_s(iniColor, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
// グローバルセクション書き込み
_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);
// ブックマーク書き込み
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);
}
// プロファイルリスト書き込み
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<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
WritePrivateProfileString(iniSystem, _T("ProfileList"), MTOPTION.PROFILE_LIST, ini);
// プロファイルセクション書き込み
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);
// ウィンドウ位置書き込み
_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);
// 色書き込み
_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);
}
// プロファイルセクション削除
void DeleteSection(TCHAR* obj){
TCHAR ini[_MAX_PATH];
_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
WritePrivateProfileStruct(obj, NULL, NULL, 0, ini);
}
// プロファイル関連のみ書き出し
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<PTCHAR>(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<PTCHAR>(mp.ToPointer()));
WritePrivateProfileString(iniSystem, _T("ProfileList"), MTOPTION.PROFILE_LIST, ini);
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
}
// 設定値を軽くチェック
void CheckMTOption()
{
TCHAR buf[_MAX_PATH];
// 相対パス -> 絶対パス
_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);
}
// 絶対パスに変換されるとドライブ名が小文字になるのが気になっていけない
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]);
}
// 対戦中のタイトルバー
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){
// 最前面表示
if(MTINFO.SHOW_TOP == false){
// 格ツク95ウィンドウサイズ変更
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("2D格闘ツクール95")) == 0){
MTINFO.HWND = NULL;
}
}
}
LeaveCriticalSection(&CS_CAPTION);
}
// 暗号復号用乱数
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;
}
// 通常用
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;
}
// ランダムステージ用
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のエンコード
String^ EncryptionIP(String^ ip)
{
String ^ipString;
try {
ipString = Int64(Net::IPAddress::Parse(ip)->Address).ToString();
}
catch (ArgumentNullException^) {
return "変換失敗。IPぬるぽエラー";
}
catch (FormatException^) {
return "変換失敗。IP形式エラー";
}
array<Byte> ^binaryData = gcnew array<Byte>(11);
binaryData = System::Text::Encoding::ASCII->GetBytes(ipString);
String ^ipBase64;
try {
ipBase64 = Convert::ToBase64String(binaryData);
}
catch (ArgumentNullException^) {
return "変換失敗。Base64ぬるぽエラー";
}
catch (FormatException^) {
return "変換失敗。Base64形式エラー";
}
return ipBase64;
}
// IPの変換(MTSPアドレス)
String^ MTEncryptionIP(String^ ip)
{
String^ result, ^buf, ^part;
String^ dic = "そぞただちぢっつづてでとどなにぬねのはばabcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYGぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜ";
try{
// 10桁+シード
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アドレスのMTSP変換に失敗しました。";
}
}
// IPのデコード
_int64 DecryptionIP(String^ cipher_ip, bool enc)
{
array<Byte> ^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互換用
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;
}
}

519
LilithPort/stdafx.h Normal file
View file

@ -0,0 +1,519 @@
// stdafx.h : 標準のシステム インクルード ファイルのインクルード ファイル、または
// 参照回数が多く、かつあまり変更されない、プロジェクト専用のインクルード ファイル
// を記述します。
#pragma once
#pragma warning(disable: 4100)
// TODO: プログラムに必要な追加ヘッダーをここで参照してください。
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <mmsystem.h>
#include <deque>
#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);
// メンバー情報
public ref struct MemberInfo
{
IPEndPoint^ IP_EP;
String^ NAME;
String^ COMMENT;
UINT16 ID;
UINT TYPE;
UINT STATE;
UINT NUM_VS;
DWORD RESPONSE;
};
// バックアップ
public ref struct MemberInfoBackUp
{
IPEndPoint^ IP_EP;
UINT16 ID;
};
// プロファイルリスト
public ref class Profile
{
public:
static Generic::List<String^>^ ProfileList = gcnew Generic::List<String^>;
// バリデーション用
static array<String^>^ SystemSection = gcnew array<String^>{"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};
// バージョン情報
// LilithPort 1.03以上互換, それ以前はなし
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;
// チームプレイ人数
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<REPLAY_DATA> 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な接続要求
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で全員分
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:実行ファイルのハッシュ
PH_RES_VS, // 1:state
PH_REQ_VS_PING, // 1:ID 5個バラでsend
PH_RES_VS_PONG, // 1秒間に4個以上受信で対戦開始
PH_REQ_VS_SETTING, // 1:delay localとhostで大きな値にあわせる
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個分送信
PH_REQ_VS_DATA, // 4:frame パケット来てないので緊急要請
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:観戦開始 1:観戦不可
PH_WATCH_DATA, // 4:frame 40:10フレーム分のデータ
PH_WATCH_END, // 2:ID 自分のと同じIDなら観戦終了、他のIDならリストから削除
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<BYTE>(MAX_PACKET);
}
protected:
~PacketPacker()
{
if(Packet != nullptr){
delete Packet;
}
}
public:
int Length;
array<BYTE>^ Packet;
void Pack(BYTE data){
Packet[Length] = data;
Length++;
}
void Pack(array<BYTE>^% 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<BYTE>^ Packet;
PacketDivider(array<BYTE>^% datagram)
{
Length = 0;
Packet = datagram;
}
BYTE Divide(){
return Packet[Length++];
}
array<BYTE>^ Divide(int length){
array<BYTE>^ data = gcnew array<BYTE>(length);
Array::Copy(Packet, Length, data, 0, length);
Length += length;
return data;
}
};