Skip to content

Commit

Permalink
external libs: rebuilt libmodplug after some updates :
Browse files Browse the repository at this point in the history
- load_med.cpp: fix an old incorrect logic in boundary check.
  from: libmodplug oob_read_fixes branch commit 187d2da725d4
- load_abc.cpp: don't increment p unless its non null
  from: libmodplug oob_read_fixes branch commit 6339dfccee2f
- a few _MSC_VER ifdef corrections
  from: libmodplug github PR/45
- changed several 'MSC_VER' checks into '_MSC_VER && _M_IX86' checks
  they are supposed to be guarding Visual Studio inline IX86 asm code
  from: libmodplug github PR/45
  • Loading branch information
sezero committed Nov 22, 2019
1 parent 5ce70ad commit 76bc1b9
Show file tree
Hide file tree
Showing 20 changed files with 339 additions and 56 deletions.
6 changes: 3 additions & 3 deletions VisualC/external/include/libmodplug/modplug.h
Expand Up @@ -138,13 +138,13 @@ MODPLUG_EXPORT char* ModPlug_GetMessage(ModPlugFile* file);
/*Export to a Scream Tracker 3 S3M module. EXPERIMENTAL (only works on Little-Endian platforms)*/
MODPLUG_EXPORT char ModPlug_ExportS3M(ModPlugFile* file, const char* filepath);

/*Export to a Extended Module (XM). EXPERIMENTAL (only works on Little-Endian platforms)*/
/*Export to an Extended Module (XM). EXPERIMENTAL (only works on Little-Endian platforms)*/
MODPLUG_EXPORT char ModPlug_ExportXM(ModPlugFile* file, const char* filepath);

/*Export to a Amiga MOD file. EXPERIMENTAL.*/
/*Export to an Amiga MOD file. EXPERIMENTAL.*/
MODPLUG_EXPORT char ModPlug_ExportMOD(ModPlugFile* file, const char* filepath);

/*Export to a Impulse Tracker IT file. Should work OK in Little-Endian & Big-Endian platforms :-) */
/*Export to an Impulse Tracker IT file. Should work OK in Little-Endian & Big-Endian platforms :-) */
MODPLUG_EXPORT char ModPlug_ExportIT(ModPlugFile* file, const char* filepath);
#endif /* MODPLUG_NO_FILESAVE */

Expand Down
Binary file modified VisualC/external/lib/x64/libmodplug-1.dll
Binary file not shown.
Binary file modified VisualC/external/lib/x86/libmodplug-1.dll
Binary file not shown.
Expand Up @@ -138,13 +138,13 @@ MODPLUG_EXPORT char* ModPlug_GetMessage(ModPlugFile* file);
/*Export to a Scream Tracker 3 S3M module. EXPERIMENTAL (only works on Little-Endian platforms)*/
MODPLUG_EXPORT char ModPlug_ExportS3M(ModPlugFile* file, const char* filepath);

/*Export to a Extended Module (XM). EXPERIMENTAL (only works on Little-Endian platforms)*/
/*Export to an Extended Module (XM). EXPERIMENTAL (only works on Little-Endian platforms)*/
MODPLUG_EXPORT char ModPlug_ExportXM(ModPlugFile* file, const char* filepath);

/*Export to a Amiga MOD file. EXPERIMENTAL.*/
/*Export to an Amiga MOD file. EXPERIMENTAL.*/
MODPLUG_EXPORT char ModPlug_ExportMOD(ModPlugFile* file, const char* filepath);

/*Export to a Impulse Tracker IT file. Should work OK in Little-Endian & Big-Endian platforms :-) */
/*Export to an Impulse Tracker IT file. Should work OK in Little-Endian & Big-Endian platforms :-) */
MODPLUG_EXPORT char ModPlug_ExportIT(ModPlugFile* file, const char* filepath);
#endif /* MODPLUG_NO_FILESAVE */

Expand Down
Binary file modified Xcode/Frameworks/modplug.framework/Versions/A/modplug
Binary file not shown.
2 changes: 1 addition & 1 deletion external/libmodplug-0.8.9.0/AUTHORS
Expand Up @@ -2,7 +2,7 @@ XMMS plugin:
Kenton Varda <temporal@gauge3d.org>
Konstanty Bialkowski <konstanty@ieee.org>

General Maintainence:
General Maintenance:
Konstanty Bialkowski <konstanty@ieee.org>

Sound Engine:
Expand Down
2 changes: 1 addition & 1 deletion external/libmodplug-0.8.9.0/ChangeLog
Expand Up @@ -86,7 +86,7 @@ date = 2-nov-2006 [Konstanty Bialkowski/Macro Trillo]
date = 20-jul-2006 [Peter Grootswagers]
-> file: src/load_abc.cpp
where: instrument loader functions
what: replaced with correspondig functions in load_pat.cpp
what: replaced with corresponding functions in load_pat.cpp
-> file: src/load_mid.cpp
where: whole source
what: new loader for midi files
Expand Down
12 changes: 0 additions & 12 deletions external/libmodplug-0.8.9.0/README
Expand Up @@ -50,18 +50,6 @@ Contents
- Plays 22 different mod formats, including:
MOD, S3M, XM, IT, 669, AMF (both of them), AMS, DBM, DMF, DSM, FAR,
MDL, MED, MTM, OKT, PTM, STM, ULT, UMX, MT2, PSM
- Plays zip, rar, gzip, and bzip2 compressed mods. The following
extensions are recognized: (Only in modplug-xmms)
zip: MDZ, S3Z, XMZ, ITZ
rar: MDR, S3R, XMR, ITR
gzip: MDGZ, S3GZ, XMGZ, ITGZ
You can also load plain old ZIP, RAR, and GZ files. If ModPlug finds
a mod in them, it will play it.
Note: To play these formats, you need to have the associated
decompression utilities (unzip, gunzip, unrar) installed.
Note(2): The format of the mod is NOT determined from the extension on
compressed mods. For example, if you zipped a UMX mod and gave it the
extension MDZ, it would work fine.
- plays timidity's GUS patch files (*.pat):
a multi sample pat file with n samples can be played with a Frere Jacques
canon with n voices.
Expand Down
304 changes: 304 additions & 0 deletions external/libmodplug-0.8.9.0/libmodplug-0.8.9.0-2.patch
@@ -0,0 +1,304 @@
- load_med.cpp: fix an old incorrect logic in boundary check.
from: libmodplug oob_read_fixes branch commit 187d2da725d4
- load_abc.cpp: don't increment p unless its non null
from: libmodplug oob_read_fixes branch commit 6339dfccee2f
- a few _MSC_VER ifdef corrections
from: libmodplug github PR/45
- changed several 'MSC_VER' checks into '_MSC_VER && _M_IX86' checks
they are supposed to be guarding Visual Studio inline IX86 asm code
from: libmodplug github PR/45

diff --git a/external/libmodplug-0.8.9.0/src/fastmix.cpp b/external/libmodplug-0.8.9.0/src/fastmix.cpp
--- a/external/libmodplug-0.8.9.0/src/fastmix.cpp
+++ b/external/libmodplug-0.8.9.0/src/fastmix.cpp
@@ -9,7 +9,7 @@
#include "sndfile.h"
#include <math.h>

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
#pragma bss_seg(".modplug")
#endif

@@ -27,7 +27,7 @@
float MixFloatBuffer[MIXBUFFERSIZE*2];
#endif

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
#pragma bss_seg()
#endif

@@ -1611,7 +1611,7 @@
#endif

// Clip and convert to 8 bit
-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
__declspec(naked) DWORD MPPASMCALL X86_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
//------------------------------------------------------------------------------
{
@@ -1701,7 +1701,7 @@
#endif //MSC_VER, else


-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
// Clip and convert to 16 bit
__declspec(naked) DWORD MPPASMCALL X86_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
//------------------------------------------------------------------------------
@@ -1794,7 +1794,7 @@
}
#endif //MSC_VER, else

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
// Clip and convert to 24 bit
__declspec(naked) DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
//------------------------------------------------------------------------------
@@ -1902,7 +1902,7 @@
}
#endif

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
// Clip and convert to 32 bit
__declspec(naked) DWORD MPPASMCALL X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
//------------------------------------------------------------------------------
@@ -1992,7 +1992,7 @@
#endif


-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
void MPPASMCALL X86_InitMixBuffer(int *pBuffer, UINT nSamples)
//------------------------------------------------------------
{
@@ -2034,7 +2034,7 @@
#endif


-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
__declspec(naked) void MPPASMCALL X86_InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nSamples)
//------------------------------------------------------------------------------
{
@@ -2079,7 +2079,7 @@
#endif


-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
VOID MPPASMCALL X86_MonoFromStereo(int *pMixBuf, UINT nSamples)
//-------------------------------------------------------------
{
@@ -2116,7 +2116,7 @@
#define OFSDECAYMASK 0xFF


-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
void MPPASMCALL X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs)
//------------------------------------------------------------------------------
{
@@ -2217,7 +2217,7 @@
}
#endif

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
void MPPASMCALL X86_EndChannelOfs(MODCHANNEL *pChannel, int *pBuffer, UINT nSamples)
//------------------------------------------------------------------------------
{
@@ -2291,7 +2291,7 @@
#define MIXING_LIMITMAX (0x08100000)
#define MIXING_LIMITMIN (-MIXING_LIMITMAX)

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
__declspec(naked) UINT MPPASMCALL X86_AGC(int *pBuffer, UINT nSamples, UINT nAGC)
//------------------------------------------------------------------------------
{
@@ -2327,7 +2327,6 @@
jmp agcrecover
}
}
-
#pragma warning (default:4100)
#else
// Version for GCC
@@ -2378,11 +2377,9 @@
}


-
void CSoundFile::ResetAGC()
//-------------------------
{
gnAGC = AGC_UNITY;
}
-
#endif // NO_AGC
diff --git a/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h b/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h
--- a/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h
+++ b/external/libmodplug-0.8.9.0/src/libmodplug/sndfile.h
@@ -952,7 +952,7 @@
#define AGC_UNITY (1 << AGC_PRECISION)

// Calling conventions
-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
#define MPPASMCALL __cdecl
#define MPPFASTCALL __fastcall
#else
diff --git a/external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h b/external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h
--- a/external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h
+++ b/external/libmodplug-0.8.9.0/src/libmodplug/stdafx.h
@@ -33,7 +33,7 @@

#ifdef _WIN32

-#ifdef MSC_VER
+#ifdef _MSC_VER
#pragma warning (disable:4201)
#pragma warning (disable:4514)
#endif
diff --git a/external/libmodplug-0.8.9.0/src/load_abc.cpp b/external/libmodplug-0.8.9.0/src/load_abc.cpp
--- a/external/libmodplug-0.8.9.0/src/load_abc.cpp
+++ b/external/libmodplug-0.8.9.0/src/load_abc.cpp
@@ -1476,7 +1476,7 @@
d[chordnote] = i;
break;
}
- p++;
+ if (*p) p++;
switch(*p) {
case 'b':
d[chordnote]--;
@@ -1498,7 +1498,7 @@
d[chordbase] = i;
break;
}
- p++;
+ if (*p) p++;
switch(*p) {
case 'b':
d[chordbase]--;
diff --git a/external/libmodplug-0.8.9.0/src/load_med.cpp b/external/libmodplug-0.8.9.0/src/load_med.cpp
--- a/external/libmodplug-0.8.9.0/src/load_med.cpp
+++ b/external/libmodplug-0.8.9.0/src/load_med.cpp
@@ -876,7 +876,7 @@
{
DWORD nameofs = bswapBE32(pbi->blockname);
UINT namelen = bswapBE32(pbi->blocknamelen);
- if ((nameofs < dwMemLength) && (namelen < dwMemLength + nameofs))
+ if ((nameofs < dwMemLength) && (namelen < dwMemLength - nameofs))
{
SetPatternName(iBlk, (LPCSTR)(lpStream+nameofs));
}
diff --git a/external/libmodplug-0.8.9.0/src/load_xm.cpp b/external/libmodplug-0.8.9.0/src/load_xm.cpp
--- a/external/libmodplug-0.8.9.0/src/load_xm.cpp
+++ b/external/libmodplug-0.8.9.0/src/load_xm.cpp
@@ -11,7 +11,7 @@
////////////////////////////////////////////////////////
// FastTracker II XM file support

-#ifdef MSC_VER
+#ifdef _MSC_VER
#pragma warning(disable:4244)
#endif

diff --git a/external/libmodplug-0.8.9.0/src/snd_flt.cpp b/external/libmodplug-0.8.9.0/src/snd_flt.cpp
--- a/external/libmodplug-0.8.9.0/src/snd_flt.cpp
+++ b/external/libmodplug-0.8.9.0/src/snd_flt.cpp
@@ -13,12 +13,11 @@

#ifndef NO_FILTER

-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
#define _ASM_MATH
#endif

#ifdef _ASM_MATH
-
// pow(a,b) returns a^^b -> 2^^(b.log2(a))
static float pow(float a, float b)
{
@@ -42,7 +41,6 @@
return result;
}

-
#else

#include <math.h>
diff --git a/external/libmodplug-0.8.9.0/src/snd_fx.cpp b/external/libmodplug-0.8.9.0/src/snd_fx.cpp
--- a/external/libmodplug-0.8.9.0/src/snd_fx.cpp
+++ b/external/libmodplug-0.8.9.0/src/snd_fx.cpp
@@ -9,7 +9,7 @@
#include "sndfile.h"
#include "tables.h"

-#ifdef MSC_VER
+#ifdef _MSC_VER
#pragma warning(disable:4244)
#endif

diff --git a/external/libmodplug-0.8.9.0/src/sndfile.cpp b/external/libmodplug-0.8.9.0/src/sndfile.cpp
--- a/external/libmodplug-0.8.9.0/src/sndfile.cpp
+++ b/external/libmodplug-0.8.9.0/src/sndfile.cpp
@@ -1661,8 +1661,7 @@
DWORD CSoundFile::TransposeToFrequency(int transp, int ftune)
//-----------------------------------------------------------
{
-
-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
const float _fbase = 8363;
const float _factor = 1.0f/(12.0f*128.0f);
int result;
@@ -1702,8 +1701,7 @@
int CSoundFile::FrequencyToTranspose(DWORD freq)
//----------------------------------------------
{
-
-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
const float _f1_8363 = 1.0f / 8363.0f;
const float _factor = 128 * 12;
LONG result;
diff --git a/external/libmodplug-0.8.9.0/src/sndmix.cpp b/external/libmodplug-0.8.9.0/src/sndmix.cpp
--- a/external/libmodplug-0.8.9.0/src/sndmix.cpp
+++ b/external/libmodplug-0.8.9.0/src/sndmix.cpp
@@ -80,7 +80,7 @@
// Return (a*b)/c - no divide error
int _muldiv(long a, long b, long c)
{
-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
int sign, result;
_asm {
mov eax, a
@@ -123,11 +123,10 @@
#endif
}

-
// Return (a*b+c/2)/c - no divide error
int _muldivr(long a, long b, long c)
{
-#ifdef MSC_VER
+#if defined(_MSC_VER) && defined(_M_IX86)
int sign, result;
_asm {
mov eax, a
@@ -340,7 +339,6 @@
}


-
/////////////////////////////////////////////////////////////////////////////
// Handles navigation/effects


0 comments on commit 76bc1b9

Please sign in to comment.