From 989cb029e28a1c3d90f2c9ebcaa6389bfba36a5a Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 9 Mar 2026 08:54:00 -0700 Subject: [PATCH] Add support for .hdv (ProDOS) disk images. --- generic.disk.cpp | 33 +++++++++++++++++++++++++++++---- prodos.cpp | 1 + 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/generic.disk.cpp b/generic.disk.cpp index 6eae3e5..67dc4e0 100644 --- a/generic.disk.cpp +++ b/generic.disk.cpp @@ -113,7 +113,25 @@ } -// --- Size --- +// --- File Formats --- + + struct FileExtensionType_t + { + const char *pExtension; + SectorOrder_e eSectorOrder; + }; + + const FileExtensionType_t gaFileExtensionsType[] = + { + { ".dsk", INTERLEAVE_DOS33_ORDER } + , { ".do" , INTERLEAVE_DOS33_ORDER } + , { ".hdv", INTERLEAVE_PRODOS_ORDER } + , { ".po" , INTERLEAVE_PRODOS_ORDER } + }; + const size_t gnFileExtensionsType = sizeof(gaFileExtensionsType) / sizeof(gaFileExtensionsType[0]); + + +// --- Size --- int File_Size( FILE *pFile ) { @@ -152,9 +170,16 @@ bool DskGetInterleave( const char *dsk_filename ) const char *pExt = file_GetExtension( dsk_filename ); if( pExt ) { - if( stricmp( pExt, ".do" ) == 0 ) giInterleaveLastUsed = INTERLEAVE_DOS33_ORDER ; - if( stricmp( pExt, ".po" ) == 0 ) giInterleaveLastUsed = INTERLEAVE_PRODOS_ORDER; - if( stricmp( pExt, ".dsk") == 0 ) giInterleaveLastUsed = INTERLEAVE_DOS33_ORDER ; + const int nExtensions = (int)gnFileExtensionsType; + for (int iExtension = 0; iExtension < nExtensions; iExtension++) + { + const FileExtensionType_t *pExtType = &gaFileExtensionsType[iExtension]; + if (stricmp(pExt, pExtType->pExtension) == 0) + { + giInterleaveLastUsed = pExtType->eSectorOrder; + break; + } + } } #if DEBUG_DSK_INTERLEAVE diff --git a/prodos.cpp b/prodos.cpp index 72cfd85..47420db 100644 --- a/prodos.cpp +++ b/prodos.cpp @@ -210,6 +210,7 @@ int usage() " .dsk (Assumes DOS3.3 sector order)\n" " .do (DOS3.3 sector order)\n" " .po (ProDOS sector order)\n" +" .hdv (ProDOS sector order)\n" "\n" "NOTE: To skip always having to specify the <.dsk> name set the environment variable:\n" "\n"