From 674ea949e9087102274721008b60cb2376f498ac Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 14 Feb 2016 18:25:59 -0600 Subject: [PATCH] Use PathCombine for working directory generation Fix right click issue in player list --- LilithPort/LilithPort.cpp | 3 ++- LilithPort/LilithPort.vcxproj | 4 ++-- LilithPort/MainForm.cpp | 6 ++++-- LilithPort/MainForm.h | 25 +++++++++++++++++++------ LilithPort/stdafx.cpp | 12 ++++++++---- LilithPort/stdafx.h | 1 + 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/LilithPort/LilithPort.cpp b/LilithPort/LilithPort.cpp index 47381ff..6599535 100644 --- a/LilithPort/LilithPort.cpp +++ b/LilithPort/LilithPort.cpp @@ -26,7 +26,8 @@ int main(array ^args) 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); + //_stprintf_s(MTOPTION.PATH, _T("%s%s"), drive, dir); + PathCombine(MTOPTION.PATH, drive, dir); // コマンドライン引数 if(args->Length > 0){ diff --git a/LilithPort/LilithPort.vcxproj b/LilithPort/LilithPort.vcxproj index bda4085..1cf38b4 100644 --- a/LilithPort/LilithPort.vcxproj +++ b/LilithPort/LilithPort.vcxproj @@ -63,7 +63,7 @@ ProgramDatabase - + Shlwapi.lib false true true @@ -81,7 +81,7 @@ ProgramDatabase - + Shlwapi.lib false true Windows diff --git a/LilithPort/MainForm.cpp b/LilithPort/MainForm.cpp index f4f0c38..df35306 100644 --- a/LilithPort/MainForm.cpp +++ b/LilithPort/MainForm.cpp @@ -2252,7 +2252,8 @@ void MainForm::RunGame(Object^ obj) // 作業ディレクトリ _tsplitpath_s(MTOPTION.GAME_EXE, drive, _MAX_DRIVE, buf, _MAX_DIR, NULL, 0, NULL, 0); - _stprintf_s(wdir, _T("%s%s"), drive, buf); + //_stprintf_s(wdir, _countof(drive)+_countof(buf), _T("%s%s"), drive, buf); + PathCombine(wdir, drive, buf); if(CreateProcess(MTOPTION.GAME_EXE, NULL, NULL, NULL, false, DEBUG_PROCESS, NULL, wdir, &si, &pi)){ if(run_type == RT_PLAYBACK){ @@ -2822,7 +2823,8 @@ void MainForm::RunGame(Object^ obj) if(MTOPTION.CHANGE_WINDOW_SIZE){ TCHAR val[32]; - _stprintf_s(buf, _T("%sgame.ini"), wdir); + //_stprintf_s(buf, _T("%sgame.ini"), wdir); + PathCombine(buf, wdir, L"game.ini"); if(File::Exists(gcnew String(buf))){ _itot_s(640, val, 10); diff --git a/LilithPort/MainForm.h b/LilithPort/MainForm.h index 177209e..47a94a6 100644 --- a/LilithPort/MainForm.h +++ b/LilithPort/MainForm.h @@ -720,7 +720,7 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2; // listBoxMember // this->listBoxMember->BorderStyle = System::Windows::Forms::BorderStyle::None; - this->listBoxMember->ContextMenu = this->contextMenuStripMember; + //this->listBoxMember->ContextMenu = this->contextMenuStripMember; this->listBoxMember->Dock = System::Windows::Forms::DockStyle::Fill; this->listBoxMember->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawFixed; this->listBoxMember->FormattingEnabled = true; @@ -729,7 +729,8 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2; this->listBoxMember->Name = L"listBoxMember"; this->listBoxMember->Size = System::Drawing::Size(94, 373); this->listBoxMember->TabIndex = 2; - this->listBoxMember->MouseClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseClick); + this->listBoxMember->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseDown); + this->listBoxMember->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseUp); this->listBoxMember->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler(this, &MainForm::listBoxMember_DrawItem); this->listBoxMember->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseDoubleClick); // @@ -2558,9 +2559,9 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2; } } - System::Void listBoxMember_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { + System::Void listBoxMember_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { int index = listBoxMember->IndexFromPoint(e->X, e->Y); - + if(index == -1 || MTOPTION.CONNECTION_TYPE == CT_FREE || ListView == LV_BLIND){ toolTipMember->Active = false; return; @@ -2582,6 +2583,16 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2; } toolTipMember->SetToolTip(listBoxMember, cap); } + + System::Void listBoxMember_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { + int index = listBoxMember->IndexFromPoint(e->X, e->Y); + + if (index != -1 && e->Button == ::MouseButtons::Right) { + listBoxMember->SelectedIndex = index; + this->contextMenuStripMember->Show(listBoxMember, e->Location); + } + } + System::Void toolStripMenuItemSetting_Click(System::Object^ sender, System::EventArgs^ e) { if(Option == nullptr || Option->IsDisposed){ toolStripDropDownButtonProfile->Enabled = false; @@ -3122,11 +3133,13 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2; if(IsCompatibleFM2KExecutable(info->FileDescription)){ b2nd = true; - _stprintf_s(ini, _T("%s%sgame.ini"), drive, dir); + //_stprintf_s(ini, _T("%s%sgame.ini"), drive, dir); + PathCombine(ini, PathCombine(ini, drive, dir), L"game.ini"); } else{ b2nd = false; - _stprintf_s(ini, _T("%s%s2D格闘ツクール95.ini"), drive, dir); + //_stprintf_s(ini, _T("%s%s2D格闘ツクール95.ini"), drive, dir); + PathCombine(ini, PathCombine(ini, drive, dir), L"2D格闘ツクール95.ini"); } if(File::Exists(gcnew String(ini))){ diff --git a/LilithPort/stdafx.cpp b/LilithPort/stdafx.cpp index 6ce5e5e..a72dd70 100644 --- a/LilithPort/stdafx.cpp +++ b/LilithPort/stdafx.cpp @@ -62,7 +62,8 @@ void LoadMTOption() tmpType[MAX_TITLE], tmpPort[MAX_TITLE], bufSection[MAX_ARRAY]; TCHAR* iniSection = _T("LilithPort"); UINT iniVersion; - _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + //_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini"); // stdafx.hに記述 TCHAR iniSystem[MAX_NAME], iniState[MAX_NAME], iniColor[MAX_NAME]; @@ -287,7 +288,8 @@ void SaveMTOption() _tcscpy_s(iniColor, static_cast(mp.ToPointer())); Runtime::InteropServices::Marshal::FreeHGlobal(mp); - _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + //_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini"); // グローバルセクション書き込み _itot_s(LP_VERSION, buf, 10); @@ -475,13 +477,15 @@ void SaveMTOption() // プロファイルセクション削除 void DeleteSection(TCHAR* obj){ TCHAR ini[_MAX_PATH]; - _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + //_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini"); WritePrivateProfileStruct(obj, NULL, NULL, 0, ini); } // プロファイル関連のみ書き出し void SaveProfileOption(){ TCHAR ini[_MAX_PATH]; - _stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + //_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH); + PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini"); IntPtr mp; TCHAR iniSystem[MAX_NAME]; diff --git a/LilithPort/stdafx.h b/LilithPort/stdafx.h index f4efba4..af4bafe 100644 --- a/LilithPort/stdafx.h +++ b/LilithPort/stdafx.h @@ -6,6 +6,7 @@ // TODO: プログラムに必要な追加ヘッダーをここで参照してください。 #include +#include #include #include #include