From 2342d48be31847e7ead9d1cc682452e8f0122351 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Sat, 20 Jul 2002 22:07:31 +0000 Subject: initial commit of modplugin --- (limited to 'core/multimedia/opieplayer/modplug/load_umx.cpp') diff --git a/core/multimedia/opieplayer/modplug/load_umx.cpp b/core/multimedia/opieplayer/modplug/load_umx.cpp new file mode 100644 index 0000000..4c54fcf --- a/dev/null +++ b/core/multimedia/opieplayer/modplug/load_umx.cpp @@ -0,0 +1,56 @@ +/* + * This program is free software; you can redistribute it and modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the license or (at your + * option) any later version. + * + * Authors: Olivier Lapicque +*/ + +#include "stdafx.h" +#include "sndfile.h" + +#define MODMAGIC_OFFSET (20+31*30+130) + + +BOOL CSoundFile::ReadUMX(const BYTE *lpStream, DWORD dwMemLength) +//--------------------------------------------------------------- +{ + if ((!lpStream) || (dwMemLength < 0x800)) return FALSE; + // Rip Mods from UMX + if ((bswapLE32(*((DWORD *)(lpStream+0x20))) < dwMemLength) + && (bswapLE32(*((DWORD *)(lpStream+0x18))) <= dwMemLength - 0x10) + && (bswapLE32(*((DWORD *)(lpStream+0x18))) >= dwMemLength - 0x200)) + { + for (UINT uscan=0x40; uscan<0x500; uscan++) + { + DWORD dwScan = bswapLE32(*((DWORD *)(lpStream+uscan))); + // IT + if (dwScan == 0x4D504D49) + { + DWORD dwRipOfs = uscan; + return ReadIT(lpStream + dwRipOfs, dwMemLength - dwRipOfs); + } + // S3M + if (dwScan == 0x4D524353) + { + DWORD dwRipOfs = uscan - 44; + return ReadS3M(lpStream + dwRipOfs, dwMemLength - dwRipOfs); + } + // XM + if (!strnicmp((LPCSTR)(lpStream+uscan), "Extended Module", 15)) + { + DWORD dwRipOfs = uscan; + return ReadXM(lpStream + dwRipOfs, dwMemLength - dwRipOfs); + } + // MOD + if ((uscan > MODMAGIC_OFFSET) && (dwScan == 0x2e4b2e4d)) + { + DWORD dwRipOfs = uscan - MODMAGIC_OFFSET; + return ReadMod(lpStream+dwRipOfs, dwMemLength-dwRipOfs); + } + } + } + return FALSE; +} + -- cgit v0.9.0.2