Fixed Fighter Maker compatibility

This commit is contained in:
oldmud0 2016-02-12 21:11:51 -06:00
parent 6ba05ca392
commit 74414edca8
6 changed files with 27 additions and 10 deletions

1
.gitignore vendored
View file

@ -32,3 +32,4 @@ ipch*/
*.ipch
LilithPort.sdf
LilithPortCLI/
*.VC.opendb

View file

@ -1124,11 +1124,10 @@ void MainForm::ReceivePackets(IAsyncResult^ asyncResult)
// 格ツクじゃないよ
try{
//TODO: change FM exe check
String^ exe = gcnew String(MTOPTION.GAME_EXE);
FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(exe);
if(info->FileDescription != L"格闘ツクール2nd." && info->FileDescription != L"2D格闘ツクール95"){
if(!IsCompatibleFMExecutable(info->FileDescription)){
throw gcnew Exception;
}
/*
@ -1143,7 +1142,7 @@ void MainForm::ReceivePackets(IAsyncResult^ asyncResult)
if((INT32)(Path::GetFileNameWithoutExtension(exe)->GetHashCode()) != BitConverter::ToInt32(rcv, 3)){
send[1] = 0xFE;
}
if(info->FileDescription == L"格闘ツクール2nd."){
if(IsCompatibleFM2KExecutable(info->FileDescription)){
MTINFO.KGT2K = true;
}
else{
@ -1154,7 +1153,7 @@ void MainForm::ReceivePackets(IAsyncResult^ asyncResult)
catch(Exception^){
send[1] = 0xFF;
form->WriteMessage(L"ERROR: This is not a valid 2D Fighter Maker executable.\n", ErrorMessageColor);
form->WriteMessage(L"Please go to the settings menu and set it.\n", ErrorMessageColor);
form->WriteMessage(L"Please go to the settings menu and set the path to a compatible game executable.\n", ErrorMessageColor);
}
UDP->BeginSend(send, send->Length, ep, gcnew AsyncCallback(SendPackets), UDP);

View file

@ -5,13 +5,12 @@
using namespace LilithPort;
void OptionForm::SaveOption(bool apply){
//TODO: change FM exe check
MainForm^ parent = safe_cast<MainForm^>(this->Owner);
try{
FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(textBoxGameExe->Text);
if(info->FileDescription != L"格闘ツクール2nd." && info->FileDescription != L"2D格闘ツクール95"){
if(!IsCompatibleFMExecutable(info->FileDescription)){
throw gcnew Exception;
}
}

View file

@ -2407,14 +2407,13 @@ private: System::Windows::Forms::CheckBox^ checkBoxShowResult;
openFileDialog1->Title = gcnew String(L"Select a Fighter Maker executable file");
openFileDialog1->Filter = gcnew String(L"Executable file (*.exe)|*.exe");
//TODO: Again, detecting whether it is supported should NOT be dependent on the file description.
if(openFileDialog1->ShowDialog() == ::DialogResult::OK){
FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(openFileDialog1->FileName);
if (MTINFO.DEBUG)
MessageBox::Show(info->Language + "\n" + info->FileDescription, "Debug: File version info");
if(info->FileDescription == L"格闘ツクール2nd." || info->FileDescription == L"2D格闘ツクール95"){
if(IsCompatibleFMExecutable(info->FileDescription)){
textBoxGameExe->Text = openFileDialog1->FileName;
}
else{
@ -2628,8 +2627,7 @@ private: System::Windows::Forms::CheckBox^ checkBoxShowResult;
String^ extension = Path::GetExtension(file[0])->ToLower();
FileVersionInfo^ info = FileVersionInfo::GetVersionInfo(file[0]);
//TODO: game file detection
if(extension == ".exe" && (info->FileDescription == L"格闘ツクール2nd." || info->FileDescription == L"2D格闘ツクール95")){
if(extension == ".exe" && (IsCompatibleFMExecutable(info->FileDescription))) {
e->Effect = DragDropEffects::All;
}
}

View file

@ -606,6 +606,22 @@ void SetCaption()
LeaveCriticalSection(&CS_CAPTION);
}
bool IsCompatibleFM2KExecutable(String ^ fileDesc)
{
return fileDesc == L"格闘ツクール2nd." ||
fileDesc == L"2D Fighter Maker 2015";
}
bool IsCompatibleFM95Executable(String ^ fileDesc)
{
return fileDesc == L"2D格闘ツクール95";
}
bool IsCompatibleFMExecutable(String ^ fileDesc)
{
return IsCompatibleFM2KExecutable(fileDesc) || IsCompatibleFM95Executable(fileDesc);
}
// 暗号復号用乱数
UINT CipherRand(UINT32 seed)
{

View file

@ -35,6 +35,10 @@ void DeleteSection(TCHAR* obj);
void ChangeStageValue();
void SetCaption();
bool IsCompatibleFM2KExecutable(String^ fileDesc);
bool IsCompatibleFM95Executable(String^ fileDesc);
bool IsCompatibleFMExecutable(String^ fileDesc);
String^ EncryptionIP(String^ ip);
String^ MTEncryptionIP(String^ ip);
_int64 DecryptionIP(String^ cipher_ip, bool enc);