2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Disk image "archive" support.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#ifndef APP_DISKARCHIVE_H
|
|
|
|
#define APP_DISKARCHIVE_H
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
#include "GenericArchive.h"
|
|
|
|
#include "../diskimg/DiskImg.h"
|
|
|
|
|
|
|
|
class RenameEntryDialog;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* One file in a disk image.
|
|
|
|
*/
|
|
|
|
class DiskEntry : public GenericEntry {
|
|
|
|
public:
|
2014-11-04 00:26:53 +00:00
|
|
|
DiskEntry(A2File* pFile) : fpFile(pFile)
|
|
|
|
{}
|
|
|
|
virtual ~DiskEntry(void) {}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual int ExtractThreadToBuffer(int which, char** ppText, long* pLength,
|
2014-11-21 21:18:20 +00:00
|
|
|
CString* pErrMsg) const override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual int ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
|
2014-11-21 21:18:20 +00:00
|
|
|
ConvertHighASCII convHA, CString* pErrMsg) const override;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
virtual long GetSelectionSerial(void) const override
|
|
|
|
{ return -1; } // idea: T/S block number
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Figure out whether or not we're allowed to change a file's type and
|
|
|
|
* aux type.
|
|
|
|
*/
|
|
|
|
virtual bool GetFeatureFlag(Feature feature) const override;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
// return the underlying FS format for this file
|
|
|
|
virtual DiskImg::FSFormat GetFSFormat(void) const {
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(fpFile != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
return fpFile->GetFSFormat();
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
A2File* GetA2File(void) const { return fpFile; }
|
|
|
|
void SetA2File(A2File* pFile) { fpFile = pFile; }
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Copy data from the open A2File to outfp, possibly converting EOL along
|
|
|
|
* the way.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError CopyData(A2FileDescr* pOpenFile, FILE* outfp, ConvertEOL conv,
|
|
|
|
ConvertHighASCII convHA, CString* pMsg) const;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
A2File* fpFile;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disk image add-ons to GenericArchive.
|
|
|
|
*/
|
|
|
|
class DiskArchive : public GenericArchive {
|
|
|
|
public:
|
2014-11-18 05:13:13 +00:00
|
|
|
DiskArchive(void) : fpPrimaryDiskFS(NULL), fIsReadOnly(false),
|
|
|
|
fpAddDataHead(NULL), fpAddDataTail(NULL)
|
2014-11-04 00:26:53 +00:00
|
|
|
{}
|
|
|
|
virtual ~DiskArchive(void) { (void) Close(); }
|
|
|
|
|
|
|
|
/* pass this as the "options" value to the New() function */
|
|
|
|
typedef struct {
|
|
|
|
DiskImgLib::DiskImg::FSFormat format;
|
|
|
|
DiskImgLib::DiskImg::SectorOrder sectorOrder;
|
|
|
|
} NewOptionsBase;
|
|
|
|
typedef union {
|
|
|
|
NewOptionsBase base;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
NewOptionsBase base;
|
|
|
|
long numBlocks;
|
|
|
|
} blank;
|
|
|
|
struct {
|
|
|
|
NewOptionsBase base;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* volName;
|
2014-11-04 00:26:53 +00:00
|
|
|
long numBlocks;
|
|
|
|
} prodos;
|
|
|
|
struct {
|
|
|
|
NewOptionsBase base;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* volName;
|
2014-11-04 00:26:53 +00:00
|
|
|
long numBlocks;
|
|
|
|
} pascalfs; // "pascal" is reserved token in MSVC++
|
|
|
|
struct {
|
|
|
|
NewOptionsBase base;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
const WCHAR* volName;
|
2014-11-04 00:26:53 +00:00
|
|
|
long numBlocks;
|
|
|
|
} hfs;
|
|
|
|
struct {
|
|
|
|
NewOptionsBase base;
|
|
|
|
int volumeNum;
|
|
|
|
long numTracks;
|
|
|
|
int numSectors;
|
|
|
|
bool allocDOSTracks;
|
|
|
|
} dos;
|
|
|
|
} NewOptions;
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Perform one-time initialization of the DiskLib library.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static CString AppInit(void);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Perform one-time cleanup of DiskImgLib at shutdown time.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static void AppCleanup(void);
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Finish instantiating a DiskArchive object by opening an existing file.
|
|
|
|
*/
|
|
|
|
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
|
|
|
|
CString* pErrMsg) override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Finish instantiating a DiskArchive object by creating a new archive.
|
|
|
|
*
|
|
|
|
* Returns an error string on failure, or "" on success.
|
|
|
|
*/
|
|
|
|
virtual CString New(const WCHAR* filename, const void* options) override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flush the DiskArchive object.
|
|
|
|
*
|
|
|
|
* Most of the stuff we do with disk images goes straight through, but in
|
|
|
|
* the case of compressed disks we don't normally re-compress them until
|
|
|
|
* it's time to close them. This forces us to update the copy on disk.
|
|
|
|
*
|
|
|
|
* Returns an empty string on success, or an error message on failure.
|
|
|
|
*/
|
|
|
|
virtual CString Flush(void) override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reload the stuff from the underlying DiskFS.
|
|
|
|
*
|
|
|
|
* This also does a "lite" flush of the disk data. For files that are
|
|
|
|
* essentially being written as we go, this does little more than clear
|
|
|
|
* the "dirty" flag. Files that need to be recompressed or have some
|
|
|
|
* other slow operation remain dirty.
|
|
|
|
*
|
|
|
|
* We don't need to do the flush as part of the reload -- we can load the
|
|
|
|
* contents with everything in a perfectly dirty state. We don't need to
|
|
|
|
* do it at all. We do it to keep the "dirty" flag clear when nothing is
|
|
|
|
* really dirty, and we do it here because almost all of our functions call
|
|
|
|
* "reload" after making changes, which makes it convenient to call from here.
|
|
|
|
*/
|
|
|
|
virtual CString Reload(void) override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns true if the archive has un-flushed modifications pending.
|
|
|
|
*/
|
|
|
|
virtual bool IsModified(void) const override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return an description of the disk archive, suitable for display in the
|
|
|
|
* main title bar.
|
|
|
|
*/
|
2015-01-13 23:54:10 +00:00
|
|
|
virtual CString GetDescription() const override;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool BulkAdd(ActionProgressDialog* pActionProgress,
|
2014-11-21 21:18:20 +00:00
|
|
|
const AddFilesDialog* pAddOpts) override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool AddDisk(ActionProgressDialog* pActionProgress,
|
2014-11-21 21:18:20 +00:00
|
|
|
const AddFilesDialog* pAddOpts) override
|
2014-11-04 00:26:53 +00:00
|
|
|
{ ASSERT(false); return false; }
|
|
|
|
virtual bool CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
|
2014-11-21 21:18:20 +00:00
|
|
|
const WCHAR* newName) override;
|
|
|
|
virtual bool TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) override
|
2014-11-04 00:26:53 +00:00
|
|
|
{ ASSERT(false); return false; }
|
2014-11-21 21:18:20 +00:00
|
|
|
virtual bool DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) override;
|
|
|
|
virtual bool RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual CString TestPathName(const GenericEntry* pGenericEntry,
|
2014-11-21 21:18:20 +00:00
|
|
|
const CString& basePath, const CString& newName,
|
|
|
|
char newFssep) const override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool RenameVolume(CWnd* pMsgWnd, DiskFS* pDiskFS,
|
2014-11-21 21:18:20 +00:00
|
|
|
const WCHAR* newName) override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual CString TestVolumeName(const DiskFS* pDiskFS,
|
2014-11-21 21:18:20 +00:00
|
|
|
const WCHAR* newName) const override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual bool RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
|
2014-11-21 21:18:20 +00:00
|
|
|
const RecompressOptionsDialog* pRecompOpts) override
|
2014-11-04 00:26:53 +00:00
|
|
|
{ ASSERT(false); return false; }
|
|
|
|
virtual bool GetComment(CWnd* pMsgWnd, const GenericEntry* pEntry,
|
2014-11-21 21:18:20 +00:00
|
|
|
CString* pStr) override
|
2014-11-04 00:26:53 +00:00
|
|
|
{ ASSERT(false); return false; }
|
|
|
|
virtual bool SetComment(CWnd* pMsgWnd, GenericEntry* pEntry,
|
2014-11-21 21:18:20 +00:00
|
|
|
const CString& str) override
|
2014-11-04 00:26:53 +00:00
|
|
|
{ ASSERT(false); return false; }
|
2014-11-21 21:18:20 +00:00
|
|
|
virtual bool DeleteComment(CWnd* pMsgWnd, GenericEntry* pEntry) override
|
2014-11-04 00:26:53 +00:00
|
|
|
{ ASSERT(false); return false; }
|
|
|
|
virtual bool SetProps(CWnd* pMsgWnd, GenericEntry* pEntry,
|
2014-11-21 21:18:20 +00:00
|
|
|
const FileProps* pProps) override;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* User has updated their preferences. Take note.
|
|
|
|
*
|
|
|
|
* Setting preferences in a DiskFS causes those prefs to be pushed down
|
|
|
|
* to all sub-volumes.
|
|
|
|
*/
|
|
|
|
virtual void PreferencesChanged(void) override;
|
|
|
|
|
|
|
|
virtual long GetCapability(Capability cap) override;
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual XferStatus XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
|
2014-11-21 21:18:20 +00:00
|
|
|
ActionProgressDialog* pActionProgress,
|
|
|
|
const XferFileOptions* pXferOpts) override;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
virtual bool IsReadOnly(void) const { return fIsReadOnly; }
|
2014-11-04 00:26:53 +00:00
|
|
|
const DiskImg* GetDiskImg(void) const { return &fDiskImg; }
|
|
|
|
DiskFS* GetDiskFS(void) const { return fpPrimaryDiskFS; }
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Progress update callback, called from DiskImgLib during read/write
|
|
|
|
* operations.
|
|
|
|
*
|
|
|
|
* Returns "true" if we should continue;
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static bool ProgressCallback(DiskImgLib::A2FileDescr* pFile,
|
|
|
|
DiskImgLib::di_off_t max, DiskImgLib::di_off_t current, void* state);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
private:
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Close the DiskArchive ojbect.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual CString Close(void);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
virtual void XferPrepare(const XferFileOptions* pXferOpts) override;
|
2015-01-05 05:04:01 +00:00
|
|
|
virtual CString XferFile(LocalFileDetails* pDetails, uint8_t** pDataBuf,
|
2014-11-21 21:18:20 +00:00
|
|
|
long dataLen, uint8_t** pRsrcBuf, long rsrcLen) override;
|
|
|
|
virtual void XferAbort(CWnd* pMsgWnd) override;
|
|
|
|
virtual void XferFinish(CWnd* pMsgWnd) override;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Progress update callback, called from DiskImgLib while scanning a volume
|
|
|
|
* during Open().
|
|
|
|
*
|
|
|
|
* "str" must not contain a '%'. (TODO: fix that)
|
|
|
|
*
|
|
|
|
* Returns "true" if we should continue.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static bool ScanProgressCallback(void* cookie, const char* str,
|
|
|
|
int count);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Internal class used to keep track of files we're adding.
|
|
|
|
*/
|
|
|
|
class FileAddData {
|
|
|
|
public:
|
2015-01-05 05:04:01 +00:00
|
|
|
FileAddData(const LocalFileDetails* pDetails, char* fsNormalPathMOR) {
|
2014-11-04 00:26:53 +00:00
|
|
|
fDetails = *pDetails;
|
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
fFSNormalPathMOR = fsNormalPathMOR;
|
2014-11-18 05:13:13 +00:00
|
|
|
fpOtherFork = NULL;
|
|
|
|
fpNext = NULL;
|
2014-11-04 00:26:53 +00:00
|
|
|
}
|
|
|
|
virtual ~FileAddData(void) {}
|
|
|
|
|
|
|
|
FileAddData* GetNext(void) const { return fpNext; }
|
|
|
|
void SetNext(FileAddData* pNext) { fpNext = pNext; }
|
|
|
|
FileAddData* GetOtherFork(void) const { return fpOtherFork; }
|
|
|
|
void SetOtherFork(FileAddData* pData) { fpOtherFork = pData; }
|
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
const LocalFileDetails* GetDetails(void) const { return &fDetails; }
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the "FS-normal" path, i.e. exactly what we want to appear
|
|
|
|
* on the disk image. This has the result of any conversions, so
|
2015-01-05 05:04:01 +00:00
|
|
|
* we need to store it as a narrow Mac OS Roman string.
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
*/
|
2015-01-05 05:04:01 +00:00
|
|
|
const char* GetFSNormalPath(void) const { return fFSNormalPathMOR; }
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
private:
|
2015-01-05 05:04:01 +00:00
|
|
|
LocalFileDetails fDetails;
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
|
2015-01-05 05:04:01 +00:00
|
|
|
// The DiskFS-normalized version of the storage name. This is the
|
|
|
|
// name as it will appear on the Apple II disk image.
|
|
|
|
CStringA fFSNormalPathMOR;
|
2014-11-04 00:26:53 +00:00
|
|
|
|
|
|
|
FileAddData* fpOtherFork;
|
|
|
|
FileAddData* fpNext;
|
|
|
|
};
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
virtual ArchiveKind GetArchiveKind(void) override { return kArchiveDiskImage; }
|
2014-11-04 00:26:53 +00:00
|
|
|
virtual NuError DoAddFile(const AddFilesDialog* pAddOpts,
|
2015-01-05 05:04:01 +00:00
|
|
|
LocalFileDetails* pDetails) override;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Reload the contents of the archive, showing an error message if the
|
|
|
|
* reload fails.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on failure.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
int InternalReload(CWnd* pMsgWnd);
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Compare DiskEntry display names in descending order (Z-A).
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static int CompareDisplayNamesDesc(const void* ventry1, const void* ventry2);
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* Load the contents of a "disk archive". Returns 0 on success.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
int LoadContents(void);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Load the contents of a DiskFS.
|
|
|
|
*
|
|
|
|
* Recursively handle sub-volumes. "volName" holds the name of the
|
|
|
|
* sub-volume as it should appear in the list.
|
|
|
|
*/
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
int LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
void DowncaseSubstring(CString* pStr, int startPos, int endPos,
|
|
|
|
bool prevWasSpace);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle a debug message from the DiskImg library.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
static void DebugMsgHandler(const char* file, int line, const char* msg);
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
/*
|
|
|
|
* A file we're adding clashes with an existing file. Decide what to do
|
|
|
|
* about it.
|
|
|
|
*
|
|
|
|
* Returns one of the following:
|
|
|
|
* kNuOverwrite - overwrite the existing file
|
|
|
|
* kNuSkip - skip adding the existing file
|
|
|
|
* kNuRename - user wants to rename the file
|
|
|
|
* kNuAbort - cancel out of the entire add process
|
|
|
|
*
|
|
|
|
* Side effects:
|
|
|
|
* Sets fOverwriteExisting and fOverwriteNoAsk if a "to all" button is hit
|
|
|
|
* Replaces pDetails->storageName if the user elects to rename
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
NuResult HandleReplaceExisting(const A2File* pExisting,
|
2015-01-05 05:04:01 +00:00
|
|
|
LocalFileDetails* pDetails);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Process the list of pending file adds.
|
|
|
|
*
|
|
|
|
* This is where the rubber (finally!) meets the road.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
CString ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Load a file into a buffer, possibly converting EOL markers and setting
|
|
|
|
* "high ASCII" along the way.
|
|
|
|
*
|
|
|
|
* Returns a pointer to a newly-allocated buffer (new[]) and the data length.
|
|
|
|
* If the file is empty, no buffer will be allocated.
|
|
|
|
*
|
|
|
|
* Returns an empty string on success, or an error message on failure.
|
|
|
|
*/
|
2014-11-21 02:10:18 +00:00
|
|
|
CString LoadFile(const WCHAR* pathName, uint8_t** pBuf, long* pLen,
|
2014-11-04 00:26:53 +00:00
|
|
|
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add a file with the supplied data to the disk image.
|
|
|
|
*
|
|
|
|
* Forks that exist but are empty have a length of zero. Forks that don't
|
|
|
|
* exist have a length of -1.
|
|
|
|
*
|
|
|
|
* Called by XferFile and ProcessFileAddData.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
DIError AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
|
2014-11-21 02:10:18 +00:00
|
|
|
const uint8_t* dataBuf, long dataLen,
|
|
|
|
const uint8_t* rsrcBuf, long rsrcLen) const;
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add an entry to the end of the FileAddData list.
|
|
|
|
*
|
|
|
|
* If "storageName" (the Windows filename with type goodies stripped, but
|
|
|
|
* without filesystem normalization) matches an entry already in the list,
|
|
|
|
* we check to see if these are forks of the same file. If they are
|
|
|
|
* different forks and we don't already have both forks, we put the
|
|
|
|
* pointer into the "fork pointer" of the existing file rather than adding
|
|
|
|
* it to the end of the list.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void AddToAddDataList(FileAddData* pData);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Free all entries in the FileAddData list.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
void FreeAddDataList(void);
|
2014-11-21 21:18:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up a RenameEntryDialog for the entry in "*pEntry".
|
|
|
|
*
|
|
|
|
* Returns true on success, false on failure.
|
|
|
|
*/
|
2014-11-04 00:26:53 +00:00
|
|
|
bool SetRenameFields(CWnd* pMsgWnd, DiskEntry* pEntry,
|
|
|
|
RenameEntryDialog* pDialog);
|
|
|
|
|
|
|
|
DiskImg fDiskImg; // DiskImg object for entire disk
|
|
|
|
DiskFS* fpPrimaryDiskFS; // outermost DiskFS
|
|
|
|
bool fIsReadOnly;
|
|
|
|
|
|
|
|
/* active state while adding files */
|
|
|
|
FileAddData* fpAddDataHead;
|
|
|
|
FileAddData* fpAddDataTail;
|
|
|
|
bool fOverwriteExisting;
|
|
|
|
bool fOverwriteNoAsk;
|
|
|
|
|
|
|
|
/* state during xfer */
|
|
|
|
//CString fXferStoragePrefix;
|
|
|
|
DiskFS* fpXferTargetFS;
|
2007-03-27 17:47:10 +00:00
|
|
|
};
|
|
|
|
|
Large set of changes to restore CiderPress build.
CiderPress and MDC now compile, and execute far enough to open
their respective "about" boxes, but I doubt they'll do much
more than that.
* Switch from MBCS to UNICODE APIs
Microsoft switched to UTF-16 (by way of UCS-2) a long time ago,
and the support for MBCS seems to be getting phased out. So it's
time to switch to wide strings.
This is a bit awkward for CiderPress because it works with disk
and file archives with 8-bit filenames, and I want NufxLib and
DiskImgLib to continue to work on Linux (which has largely taken
the UTF-8 approach to Unicode). The libraries will continue to
work with 8-bit filenames, with CiderPress/MDC doing the
conversion at the appropriate point.
There were a couple of places where strings from a structure
handed back by one of the libraries were used directly in the UI,
or vice-versa, which is a problem because we have nowhere to
store the result of the conversion. These currently have fixed
place-holder "xyzzy" strings.
All UI strings are now wide.
Various format strings now use "%ls" and "%hs" to explicitly
specify wide and narrow. This doesn't play well with gcc, so
only the Windows-specific parts use those.
* Various updates to vcxproj files
The project-file conversion had some cruft that is now largely
gone. The build now has a common output directory for the EXEs
and libraries, avoiding the old post-build copy steps.
* Added zlib 1.2.8 and nufxlib 2.2.2 source snapshots
The old "prebuilts" directory is now gone. The libraries are now
built as part of building the apps.
I added a minimal set of files for zlib, and a full set for nufxlib.
The Linux-specific nufxlib goodies are included for the benefit of
the Linux utilities, which are currently broken (don't build).
* Replace symbols used for include guards
Symbols with a leading "__" are reserved.
2014-11-10 23:32:55 +00:00
|
|
|
#endif /*APP_DISKARCHIVE_H*/
|