CiderPress Source README

Release notes for v3.0.0
Last updated: 25-Mar-2007

Contents:


What's CiderPress?

CiderPress is a Windows utility for manipulating Apple II disk images and file archives. It supports all major disk and archive formats used on the Apple II and by Apple II emulators.

CiderPress was sold by faddenSoft, LLC as a shareware product for about four years, starting in March 2003.

Why Bother?

Back in 2002 I decided it was time to learn how to write an application for Microsoft Windows. I had been a professional software engineer for many years -- including 2.5 years at Microsoft! -- but had never written a Windows program more complex than "Hello, world!".

I decided to write a Windows version of GS/ShrinkIt. I had already written NufxLib, which handled all of the ShrinkIt stuff, so I could focus on writing the Windows user interface code.

Somewhere in the early stages of the project, it occurred to me that a disk image isn't substantially different from a file archive. They're both just collections of files laid out in a well-defined manner. The decision to handle disk images as well as ShrinkIt archives seemed like a simple improvement at the time. The rest is history.

CiderPress has allowed me to explore a variety of interesting technologies. It has five different ways of reading a block from physical media, depending on your operating system and what sort of device you're reading from. I was able to take what I learned from a digital signal processing textbook and apply it to a real-world problem (decoding Apple II cassette data). It is also my first Shareware product, not to mention the initial product of my first small business venture (faddenSoft, LLC).

I could have written other things. No doubt they would have made more money. CiderPress is something that I find very useful, however, in the pursuit of my Apple II hobby.

Above all, this has been a labor of love. I have tried to get the details right, because in the end it's the little things that mean the difference between "good" and merely "good enough".

License

The source code to CiderPress is being made available under the BSD license:

Copyright (c) 2007, FaddenSoft, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY FaddenSoft, LLC ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FaddenSoft, LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

CiderPress requires three other libraries, all of which are included as either source or binaries:

The license allows you to do a great many things. For example, you could take the source code to CiderPress, compile it, and sell it. I'm not sure why anyone would buy it, but you're legally allowed to do so, as long as you retain the appropriate copyright notice.

If you retain libhfs, any changes you make to any part of CiderPress must be made available, due to the "viral" nature of the GPL license. If this is not acceptable, you can remove HFS disk image support from CiderPress (look for "EXCISE_GPL_CODE" in DiskImg.h).


Building the Sources

How to build your own copy of CiderPress.

Windows

The sources are distributed with the necessary project/solution files for Microsoft Visual Studio 6.0 and Microsoft Visual Studio 2003.  All you really need is the C++ compiler.  The free or student editions of the compilers will probably work.

I usually work on CiderPress in Visual C++ 6.0, and use that when building for distribution.  I chose to stick with 6.0 for CiderPress because you need an additional MSVC DLL when you build with 2003.  Also, the newer tools cause the newer file selection dialogs to be used, and the custom dialog code gets all wonky.

In 6.0, you need to select "app" as the build target (Build->Set active configuration), and hit F7.  This will build everything except MDC, which you can then build by selecting "mdc" and hitting F7.  You can also configure a batch build.  In 2003 just select "build solution".  The necessary prebuilt libraries should be there for both "debug" and "release" builds.  (You can tell how it has been built by looking at the version string in the About box.)

When the build completes, the necessary DLLs are copied around so you can execute the binary by launching it within Visual Studio (hit F5).  You will get a warning about not being able to find the NiftyList data file unless you copy that from "DIST" into the app source directory.

The distribution comes with prebuilt versions of NufxLib2 and zlib in DLL form.  If you like, you can download and compile your own.

There are two things you can't create with the standard tools:

Compiled help files are included, so you can still generate a new version of CiderPress even if you can't update the help.  You don't strictly need the installer either, though it is quite handy, and the uninstaller will clean up the registry entries CiderPress creates.

Linux

The "linux" directory has a few command-line utilities and a simple makefile.  It will build the diskimg and HFS libraries, then the sample utilities:

This are mostly intended for testing and illustration of the interfaces, but they can be useful as well.  Some other code is also provided:

The "prebuilt" directory has a pre-built copy of NufxLib, so you don't have to build your own.

If you're planning to hack on this stuff, use "make depend" before "make" to fill in the dependencies.


Source Notes

Some notes on what you'll find in the various directories.

Main Application

This is highly Windows-centric.  My goal was to learn how to write a Windows application, so I made no pretense at portability.  For better or worse, I avoided the Visual Studio "wizards" for the dialogs.

Much of the user interface text is in the resource file.  Much is not, especially when it comes to error messages.  This will need to be addressed if internationalization is attempted.

It may be possible to convert this for use with wxWidgets, which uses an MFC-like structure, and runs on Mac and Linux as well. The greatest barrier to entry is probably the heavy reliance on the Rich Edit control. Despite its bug-ridden history, the Rich Edit control allowed me to let Windows deal with a lot of text formatting and image display stuff.

MDC Application

MDC (Multi-Disk Catalog) was written as a simple demonstration of the value of having the DiskImg code in a DLL instead of meshed with the main application.  There's not much to it, and it hasn't changed substantially since it was first written.

DiskImg Library

This library provides access to disk images.  It automatically handles a wide variety of formats.

This library can be built under Linux or Windows. One of my key motivations for making it work under Linux was the availability of "valgrind". Similar tools for Windows usually very expensive or inferior (or both).

The basic classes, defined in DiskImg.h, are:

Sub-classes are defined in DiskImgDetail.h.  Most applications won't need to access this header file.  Each Apple II filesystem defines sub-classes of DiskFS, A2File, and A2FileDescr.

In an ideal world, the code would mimic the GS/OS file operations.  In practice, CiderPress didn't need the full range of capabilities, so the functions have some basic limitations:

Some things that can be improved:

The library depends on NufxLib and zlib for access to compressed images.

Reformat Library

This is probably the most "fun" component of CiderPress. It converts Apple II files to more easily accessible Windows equivalents.

Start in Reformat.h and ReformatBase.h. There are two basic kinds of reformatter: text and graphics. Everything else is a sub-class of one of the two basic types.

The general idea is to allow the reformatter to decide whether or not it is capable of reformatting a file. To this end, the file type information and file contents are presented to the "examine" function of each reformatter in turn. The level of confidence is specified in a range. If it's better than "no", it is presented to the user as an option, ordered by the strength of its convictions. If chosen, the "process" function is called to convert the data.

Bear in mind that reformatters may be disabled from the preferences menu.  Also, when extracting files for easy access in Windows, the "best" reformatter is employed by the extraction code.

Most of the code should be portable, though some of it uses the MFC CString class.  This could probably be altered to use STL strings or plain.

Util Library

Miscellaneous utility functions.

For a good time, look at SelectFilesDialog.cpp.

To enable debug logging for one of the applications, define _DEBUG_LOG in MyDebug.h in this library. You will see "_DEBUG_LOG" in the version string in the About box when this is defined. The log is written to C:\cplog.txt. An existing log file will be appended to if the previous log was written to less than 8 hours ago.


Enjoy!

Andy McFadden