Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
external libs: imported Konstanty/libmodplug#50
Fixes broken bitshifts in libmodplug/src/fastmix.cpp:X86_Convert32To24()
  • Loading branch information
sezero committed Oct 1, 2020
1 parent 887fdad commit 09ad029
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
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.
Binary file modified Xcode/Frameworks/modplug.framework/Versions/A/modplug
Binary file not shown.
21 changes: 21 additions & 0 deletions external/libmodplug-0.8.9.0/libmodplug-0.8.9.0.patch
Expand Up @@ -7,6 +7,7 @@ synced with libmodplug git -- with further changes, including:
- removed experimental file save support: no one uses it, ever.
- removed irrelevant/dead modplug tracker/player code: not enabled ever.
- load_med.cpp: fix an old incorrect logic in boundary check.
- merge libmodplug github PR/50 (fix broken bitshifts in X86_Convert32To24)
- merge libmodplug github PR/46 (unbalanced pragma pack fix)
- merge libmodplug github PR/39 (case-sensitive STM signature checks)
- merge libmodplug github PR/45 (_MSC_VER ifdef corrections)
Expand Down Expand Up @@ -440,6 +441,26 @@ index d693d20..7aad373 100644
// Clip and convert to 24 bit
__declspec(naked) DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount, LPLONG lpMin, LPLONG lpMax)
//------------------------------------------------------------------------------
@@ -1887,13 +1893,13 @@ DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount
vumax = n;
p = n >> (8-MIXING_ATTENUATION) ; // 24-bit signed
#ifdef WORDS_BIGENDIAN
- buf[i*3+0] = p & 0xFF0000 >> 24;
- buf[i*3+1] = p & 0x00FF00 >> 16 ;
- buf[i*3+2] = p & 0x0000FF ;
+ buf[i*3+0] = (p >> 16) & 0xFF;
+ buf[i*3+1] = (p >> 8) & 0xFF;
+ buf[i*3+2] = (p >> 0) & 0xFF;
#else
- buf[i*3+0] = p & 0x0000FF ;
- buf[i*3+1] = p & 0x00FF00 >> 16;
- buf[i*3+2] = p & 0xFF0000 >> 24;
+ buf[i*3+0] = (p >> 0) & 0xFF;
+ buf[i*3+1] = (p >> 8) & 0xFF;
+ buf[i*3+2] = (p >> 16) & 0xFF;
#endif
}
*lpMin = vumin;
@@ -1902,7 +1908,7 @@ DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount
}
#endif
Expand Down
12 changes: 6 additions & 6 deletions external/libmodplug-0.8.9.0/src/fastmix.cpp
Expand Up @@ -1893,13 +1893,13 @@ DWORD MPPASMCALL X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount
vumax = n;
p = n >> (8-MIXING_ATTENUATION) ; // 24-bit signed
#ifdef WORDS_BIGENDIAN
buf[i*3+0] = p & 0xFF0000 >> 24;
buf[i*3+1] = p & 0x00FF00 >> 16 ;
buf[i*3+2] = p & 0x0000FF ;
buf[i*3+0] = (p >> 16) & 0xFF;
buf[i*3+1] = (p >> 8) & 0xFF;
buf[i*3+2] = (p >> 0) & 0xFF;
#else
buf[i*3+0] = p & 0x0000FF ;
buf[i*3+1] = p & 0x00FF00 >> 16;
buf[i*3+2] = p & 0xFF0000 >> 24;
buf[i*3+0] = (p >> 0) & 0xFF;
buf[i*3+1] = (p >> 8) & 0xFF;
buf[i*3+2] = (p >> 16) & 0xFF;
#endif
}
*lpMin = vumin;
Expand Down

0 comments on commit 09ad029

Please sign in to comment.