Files
firestorm/Gameleap/code/mw4/Tools/ImageGrinder/ModifyPath.cpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
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.
2026-06-24 21:28:16 -05:00

130 lines
2.6 KiB
C++

// ModifyPath.cpp : implementation file
//
#include "stdafx.h"
#include "ImageGrinder.h"
#include "ModifyPath.h"
/////////////////////////////////////////////////////////////////////////////
// CModifyPath dialog
CModifyPath::CModifyPath(CWnd* pParent /*=NULL*/)
: CDialog(CModifyPath::IDD, pParent)
{
//{{AFX_DATA_INIT(CModifyPath)
m_path = _T("");
//}}AFX_DATA_INIT
}
void CModifyPath::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CModifyPath)
DDX_Text(pDX, IDC_PATH, m_path);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CModifyPath, CDialog)
//{{AFX_MSG_MAP(CModifyPath)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
ON_EN_CHANGE(IDC_PATH, OnChangePath)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CModifyPath message handlers
void myILFree(LPITEMIDLIST pidl);
void myILFree(LPITEMIDLIST pidl)
{
LPMALLOC pMalloc;
if (pidl)
{
#ifdef DEBUG
UINT cbSize = ILGetSize(pidl);
VALIDATE_PIDL(pidl);
// Fill the memory with some bad value...
_fmemset(pidl, 0xE5, cbSize);
// If large enough try to save the call return address of who
// freed us in the 3-6 byte of the structure.
if (cbSize >= 6)
*((UINT*)((LPSTR)pidl + 2)) = *(((UINT*)&pidl) - 1);
#endif
SHGetMalloc(&pMalloc);
pMalloc->Free( pidl);
pMalloc->Release();
}
}
void CModifyPath::OnBrowse()
{
CString TexturePath;
char pname[MAX_PATH];
BROWSEINFO bi;
bi.hwndOwner =m_hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = NULL;
bi.lpszTitle = "Choose Texture Path...";
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = (LPARAM)this;
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
if (SHGetPathFromIDList(pidl,pname))
{
TexturePath=pname;
}
if (bi.pidlRoot)
{
myILFree( const_cast< ITEMIDLIST* >( bi.pidlRoot ) );
}
m_path=TexturePath;
UpdateData(FALSE);
}
int CModifyPath::DoModal()
{
return CDialog::DoModal();
}
void CModifyPath::OnChangePath()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData(TRUE);
}
void CModifyPath::OnOK()
{
// TODO: Add extra validation here
if(0xffffffff==GetFileAttributes( m_path ))
{
MessageBox("Invalid Path","Path Error",MB_ICONERROR|MB_OK);
}
else
CDialog::OnOK();
}