From: <sag...@us...> - 2010-05-13 19:57:12
|
Revision: 593 http://modplug.svn.sourceforge.net/modplug/?rev=593&view=rev Author: saga-games Date: 2010-05-13 19:57:06 +0000 (Thu, 13 May 2010) Log Message: ----------- [New] Modules in gzip archives (single-file .gz archives) can now be imported, just to satisfy my laziness when downloading gzipped modules from Amiga Music Preservation. :-P [Ref] Moved functions related to endianness conversion to a separate file. [Mod] Updated release notes. NOTE: The old mptrack.sln has not been updated yet; references to the ungzip project are missing. Modified Paths: -------------- trunk/OpenMPT/mptrack/MPTRACK_08.sln trunk/OpenMPT/mptrack/mptrack.vcproj trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Added Paths: ----------- trunk/OpenMPT/soundlib/Endianness.h trunk/OpenMPT/ungzip/ trunk/OpenMPT/ungzip/ungzip.h trunk/OpenMPT/ungzip/ungzip_08.vcproj Modified: trunk/OpenMPT/mptrack/MPTRACK_08.sln =================================================================== --- trunk/OpenMPT/mptrack/MPTRACK_08.sln 2010-05-13 19:12:29 UTC (rev 592) +++ trunk/OpenMPT/mptrack/MPTRACK_08.sln 2010-05-13 19:57:06 UTC (rev 593) @@ -2,6 +2,7 @@ # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mptrack", "mptrack_08.vcproj", "{21D95071-FB97-4E69-B3B1-050D0D4A5021}" ProjectSection(ProjectDependencies) = postProject + {94CD7910-649A-4075-9F33-7EBEE614FD45} = {94CD7910-649A-4075-9F33-7EBEE614FD45} {44316F22-904E-48AA-B841-5A3A6AC77319} = {44316F22-904E-48AA-B841-5A3A6AC77319} {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8} = {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8} {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} = {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} @@ -21,6 +22,11 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "..\zlib\contrib\vstudio\vc9\zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ungzip", "..\ungzip\ungzip_08.vcproj", "{94CD7910-649A-4075-9F33-7EBEE614FD45}" + ProjectSection(ProjectDependencies) = postProject + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} = {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -70,6 +76,12 @@ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.Debug|Win32.ActiveCfg = Debug|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.Debug|Win32.Build.0 = Debug|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.Release|Win32.ActiveCfg = Release|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.Release|Win32.Build.0 = Release|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/mptrack/mptrack.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack.vcproj 2010-05-13 19:12:29 UTC (rev 592) +++ trunk/OpenMPT/mptrack/mptrack.vcproj 2010-05-13 19:57:06 UTC (rev 593) @@ -759,6 +759,9 @@ RelativePath=".\EffectVis.h"> </File> <File + RelativePath="..\soundlib\Endianness.h"> + </File> + <File RelativePath=".\fxp.h"> </File> <File Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-05-13 19:12:29 UTC (rev 592) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-05-13 19:57:06 UTC (rev 593) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="9.00" + Version="9,00" Name="mptrack" ProjectGUID="{21D95071-FB97-4E69-B3B1-050D0D4A5021}" RootNamespace="mptrack" @@ -1011,6 +1011,10 @@ > </File> <File + RelativePath="..\soundlib\Endianness.h" + > + </File> + <File RelativePath=".\fxp.h" > </File> Modified: trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html =================================================================== --- trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html 2010-05-13 19:12:29 UTC (rev 592) +++ trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html 2010-05-13 19:57:06 UTC (rev 593) @@ -88,7 +88,7 @@ to the other formats - The sequences are merged into one orderlist then. Sequences can be managed comfortably from the treeview.</li> <li>Support for <strong>new file formats</strong>: GDM (General Digital Music), IMF (Imago Orpheus), - J2B (Jazz Jackrabbit 2 music) and 8 channel Startrekker modules can now be imported. Scala tuning files can be used with OpenMPT's tuning editor now. + J2B (Jazz Jackrabbit 2 music) and 8 channel Startrekker modules can now be imported. Modules compressed with gzip can be loaded. Scala tuning files can be used with OpenMPT's tuning editor now. Support for other file formats was also notably improved: All PSM files (old and new Epic Megagames MASI) load correctly now, ULT (Ultratracker) import is more accurate, XM files compressed with BoobieSequeezer or made with early versions of Skale Tracker load correctly, etc...</li> <li>A countless number of <strong>playback behaviour fixes</strong> to maximise compatibility with ProTracker, Added: trunk/OpenMPT/soundlib/Endianness.h =================================================================== --- trunk/OpenMPT/soundlib/Endianness.h (rev 0) +++ trunk/OpenMPT/soundlib/Endianness.h 2010-05-13 19:57:06 UTC (rev 593) @@ -0,0 +1,27 @@ +#ifndef ENDIANNESS_H +#define ENDIANNESS_H + +// Ending swaps: +// BigEndian(x) may be used either to: +// -Convert DWORD x, which is in big endian format(for example read from file), +// to endian format of current architecture. +// -Convert value x from endian format of current architecture to big endian format. +// Similarly LittleEndian(x) converts known little endian format to format of current +// endian architecture or value x in format of current architecture to little endian +// format. +#ifdef PLATFORM_BIG_ENDIAN +// PPC +inline DWORD LittleEndian(DWORD x) { return ((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24); } +inline WORD LittleEndianW(WORD x) { return (WORD)(((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)); } +#define BigEndian(x) (x) +#define BigEndianW(x) (x) +#else +// x86 +inline DWORD BigEndian(DWORD x) { return ((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24); } +inline WORD BigEndianW(WORD x) { return (WORD)(((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)); } +#define LittleEndian(x) (x) +#define LittleEndianW(x) (x) +#endif + +#endif // ENDIANNESS_H + Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-05-13 19:12:29 UTC (rev 592) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-05-13 19:57:06 UTC (rev 593) @@ -29,6 +29,7 @@ #ifndef NO_ARCHIVE_SUPPORT #define UNRAR_SUPPORT #define UNLHA_SUPPORT +#define UNGZIP_SUPPORT #define ZIPPED_MOD_SUPPORT LPCSTR glpszModExtensions = "mod|s3m|xm|it|stm|nst|ult|669|wow|mtm|med|far|mdl|ams|dsm|amf|okt|dmf|ptm|psm|mt2|umx|gdm|imf|j2b" #ifndef NO_UNMO3_SUPPORT @@ -53,6 +54,10 @@ #include "../unlha/unlha32.h" #endif +#ifdef UNGZIP_SUPPORT +#include "../ungzip/ungzip.h" +#endif + #ifdef MMCMP_SUPPORT extern BOOL MMCMP_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength); #endif @@ -602,6 +607,17 @@ } } #endif +#ifdef UNGZIP_SUPPORT + CGzipArchive ungzip((LPBYTE)lpStream, dwMemLength); + if (ungzip.IsArchive()) + { + if (ungzip.ExtractFile() && ungzip.GetOutputFile()) + { + lpStream = ungzip.GetOutputFile(); + dwMemLength = ungzip.GetOutputFileLength(); + } + } +#endif #ifdef MMCMP_SUPPORT BOOL bMMCmp = MMCMP_Unpack(&lpStream, &dwMemLength); #endif Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-05-13 19:12:29 UTC (rev 592) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-05-13 19:57:06 UTC (rev 593) @@ -17,6 +17,7 @@ #include <bitset> #include "midi.h" #include "Snd_defs.h" +#include "Endianness.h" class CTuningBase; typedef CTuningBase CTuning; @@ -1010,30 +1011,7 @@ return NULL; } -// Ending swaps: -// BigEndian(x) may be used either to: -// -Convert DWORD x, which is in big endian format(for example read from file), -// to endian format of current architecture. -// -Convert value x from endian format of current architecture to big endian format. -// Similarly LittleEndian(x) converts known little endian format to format of current -// endian architecture or value x in format of current architecture to little endian -// format. -#ifdef PLATFORM_BIG_ENDIAN -// PPC -inline DWORD LittleEndian(DWORD x) { return ((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24); } -inline WORD LittleEndianW(WORD x) { return (WORD)(((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)); } -#define BigEndian(x) (x) -#define BigEndianW(x) (x) -#else -// x86 -inline DWORD BigEndian(DWORD x) { return ((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24); } -inline WORD BigEndianW(WORD x) { return (WORD)(((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)); } -#define LittleEndian(x) (x) -#define LittleEndianW(x) (x) -#endif - - ////////////////////////////////////////////////////////// // WAVE format information Added: trunk/OpenMPT/ungzip/ungzip.h =================================================================== --- trunk/OpenMPT/ungzip/ungzip.h (rev 0) +++ trunk/OpenMPT/ungzip/ungzip.h 2010-05-13 19:57:06 UTC (rev 593) @@ -0,0 +1,72 @@ +/* + * ungzip.h + * -------- + * Purpose: Header file for .gz loader + * Notes : (currently none) + * Authors: OpenMPT Devs + */ + +#pragma once + +#ifndef ZLIB_WINAPI +#define ZLIB_WINAPI +#endif // ZLIB_WINAPI +#include "../zlib/zlib.h" +#include "../mptrack/typedefs.h" + +#pragma pack(1) + +struct GZheader +{ + uint8 magic1; // 0x1F + uint8 magic2; // 0x8B + uint8 method; // 0-7 = reserved, 8 = deflate + uint8 flags; // See GZ_F* constants + uint32 mtime; // UNIX time + uint8 xflags; // Available for use by specific compression methods. We ignore this. + uint8 os; // Which OS was used to compress the file? We also ignore this. +}; + +struct GZtrailer +{ + uint32 crc32; // CRC32 of decompressed data + uint32 isize; // Size of decompressed data +}; + +#pragma pack() + +// magic bytes +#define GZ_HMAGIC1 0x1F +#define GZ_HMAGIC2 0x8B +#define GZ_HMDEFLATE 0x08 +// header flags +#define GZ_FTEXT 0x01 // File is probably ASCII text (who cares) +#define GZ_FHCRC 0x02 // CRC16 present +#define GZ_FEXTRA 0x04 // Extra fields present +#define GZ_FNAME 0x08 // Original filename present +#define GZ_FCOMMENT 0x10 // Comment is present +#define GZ_FRESERVED (~(GZ_FTEXT | GZ_FHCRC | GZ_FEXTRA | GZ_FNAME | GZ_FCOMMENT)) + + +//================ +class CGzipArchive +//================ +{ +public: + + LPBYTE GetOutputFile() const { return m_pOutputFile; } + DWORD GetOutputFileLength() const { return m_dwOutputLen; } + bool IsArchive(); + bool ExtractFile(); + + CGzipArchive(LPBYTE lpStream, DWORD dwMemLength); + ~CGzipArchive(); + +protected: + // in + LPBYTE m_lpStream; + DWORD m_dwStreamLen; + // out + Bytef *m_pOutputFile; + DWORD m_dwOutputLen; +}; Added: trunk/OpenMPT/ungzip/ungzip_08.vcproj =================================================================== --- trunk/OpenMPT/ungzip/ungzip_08.vcproj (rev 0) +++ trunk/OpenMPT/ungzip/ungzip_08.vcproj 2010-05-13 19:57:06 UTC (rev 593) @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="ungzip" + ProjectGUID="{94CD7910-649A-4075-9F33-7EBEE614FD45}" + RootNamespace="ungzip" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;ZLIB_WINAPI" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + DebugInformationFormat="3" + OmitDefaultLibName="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + PreprocessorDefinitions="WIN32;ZLIB_WINAPI" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + WarningLevel="3" + SuppressStartupBanner="false" + DebugInformationFormat="0" + OmitDefaultLibName="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\ungzip.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\ungzip.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |