Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
182 lines
4.4 KiB
C++
182 lines
4.4 KiB
C++
// ModifyPathDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "animscript.h"
|
|
#include "ModifyPathDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CModifyPathDlg dialog
|
|
/*
|
|
int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
|
{
|
|
RECT rect;
|
|
//
|
|
//Center the browse dialog on the screen...
|
|
//
|
|
switch (uMsg)
|
|
{
|
|
case BFFM_INITIALIZED:
|
|
{
|
|
char szPath[MAX_PATH];
|
|
strcpy(szPath,(char *)lpData);
|
|
//CString strCurrent = (CString)lpData;
|
|
char szCurDir[MAX_PATH];
|
|
GetCurrentDirectory(MAX_PATH,szCurDir);
|
|
strcat(szCurDir,"\\");
|
|
strcat(szCurDir,szPath);
|
|
SendMessage(hWnd,BFFM_SETSELECTION,TRUE,(LPARAM)szCurDir);
|
|
|
|
if (GetWindowRect(hWnd, &rect))
|
|
{
|
|
SetWindowPos(hWnd,
|
|
HWND_TOP,
|
|
(GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) >> 1,
|
|
(GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) >> 1,
|
|
0,
|
|
0,
|
|
SWP_NOSIZE);
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
CString BrowseDirectory(const char *strCurrent,CWnd *pWnd)
|
|
{
|
|
CString str;
|
|
TCHAR szBuffer[MAX_PATH];
|
|
LPITEMIDLIST pidlBrowse,pidlRoot;
|
|
BROWSEINFO bi;
|
|
|
|
LPMALLOC lpMalloc;
|
|
SHGetMalloc(&lpMalloc);
|
|
ASSERT(lpMalloc);
|
|
bi.hwndOwner = pWnd->GetSafeHwnd();
|
|
// Get the ID for the "My Computer" root folder
|
|
SHGetSpecialFolderLocation(pWnd->GetSafeHwnd(),CSIDL_DRIVES,&pidlRoot);
|
|
|
|
bi.pidlRoot = pidlRoot;
|
|
bi.pszDisplayName = szBuffer;
|
|
|
|
// Localize the descriptive text
|
|
bi.lpszTitle = "Select Destination Folder";
|
|
|
|
// BIF_EDITBOX and BIF_VALIDATE are for versions 4.71 and later, they
|
|
// might be ignored by older versions
|
|
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_EDITBOX;// | BIF_USENEWUI;// | BIF_VALIDATE;
|
|
bi.lParam = 0;
|
|
bi.iImage = NULL;
|
|
bi.lpfn = BrowseCallbackProc;
|
|
bi.lParam = (LPARAM)strCurrent;
|
|
//
|
|
//Call the Windows shell folder browsing routine...
|
|
//
|
|
pidlBrowse = SHBrowseForFolder(&bi);
|
|
if (NULL != pidlBrowse)
|
|
{
|
|
if (SHGetPathFromIDList(pidlBrowse, szBuffer))
|
|
{
|
|
if ('\\' == szBuffer[lstrlen(szBuffer)-1])
|
|
szBuffer[lstrlen(szBuffer)-1] = '\0';
|
|
str = CString(szBuffer);
|
|
}
|
|
else
|
|
str = "";
|
|
//
|
|
//Free up shell memory used...
|
|
//
|
|
lpMalloc->Free(pidlBrowse);
|
|
}
|
|
else
|
|
str = "";
|
|
lpMalloc->Free(pidlRoot);
|
|
lpMalloc->Release();
|
|
return str;
|
|
}
|
|
*/
|
|
|
|
CModifyPathDlg::CModifyPathDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CModifyPathDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CModifyPathDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CModifyPathDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CModifyPathDlg)
|
|
DDX_Control(pDX, IDC_EDIT_PATH, m_editPath);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CModifyPathDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CModifyPathDlg)
|
|
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CModifyPathDlg message handlers
|
|
|
|
void CModifyPathDlg::OnBrowse()
|
|
{
|
|
|
|
CString strCurrent;
|
|
m_editPath.GetWindowText(strCurrent);
|
|
char szCurDir[MAX_PATH];
|
|
GetCurrentDirectory(MAX_PATH,szCurDir);
|
|
strcat(szCurDir,"\\");
|
|
int curDirLen = strlen(szCurDir);
|
|
strcat(szCurDir,m_strPath);
|
|
|
|
char szDrive[MAX_PATH];
|
|
CFileDialog dlg(true);
|
|
{
|
|
char szDir[MAX_PATH];
|
|
char szOld[MAX_PATH];
|
|
strcpy(szOld,szCurDir);
|
|
_splitpath(szOld,szDrive,szDir,NULL,NULL);
|
|
strcat(szDrive,szDir);
|
|
if (szDrive[strlen(szDrive)-1] == '\\')
|
|
szDrive[strlen(szDrive)-1] = '\0';
|
|
dlg.m_ofn.lpstrInitialDir = szDrive;
|
|
}
|
|
dlg.m_ofn.lpstrFile = szCurDir;
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
CString path = dlg.GetPathName();
|
|
char *localpath = ((char *)(LPCTSTR)path)+curDirLen;
|
|
m_editPath.SetWindowText(localpath);
|
|
}
|
|
}
|
|
|
|
BOOL CModifyPathDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_strPath = m_pPathNode->GetValue();
|
|
|
|
m_editPath.SetWindowText(m_strPath);
|
|
m_editPath.SetFocus();
|
|
m_editPath.SetSel(MAKELONG(0,-1));
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CModifyPathDlg::OnOK()
|
|
{
|
|
m_pPathNode->SetValue(m_strPath);
|
|
CDialog::OnOK();
|
|
}
|