diff --git a/common/build/Utilities/utilities.vcxproj b/common/build/Utilities/utilities.vcxproj index 74ad637fe7..1ee3d0194f 100644 --- a/common/build/Utilities/utilities.vcxproj +++ b/common/build/Utilities/utilities.vcxproj @@ -99,7 +99,11 @@ - + + true + true + true + @@ -154,6 +158,7 @@ + diff --git a/common/build/Utilities/utilities.vcxproj.filters b/common/build/Utilities/utilities.vcxproj.filters index ae40b772b7..35d467a66d 100644 --- a/common/build/Utilities/utilities.vcxproj.filters +++ b/common/build/Utilities/utilities.vcxproj.filters @@ -23,9 +23,6 @@ - - Source Files - Source Files @@ -122,6 +119,9 @@ Source Files + + Source Files\Linux + @@ -225,5 +225,8 @@ Header Files + + Header Files + diff --git a/common/include/Utilities/ScopedAlloc.h b/common/include/Utilities/ScopedAlloc.h index 9437495e19..84737b75b5 100644 --- a/common/include/Utilities/ScopedAlloc.h +++ b/common/include/Utilities/ScopedAlloc.h @@ -48,16 +48,11 @@ #define safe_aligned_free( ptr ) \ ((void) ( _aligned_free( ptr ), (ptr) = NULL )) - -extern void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align); -extern void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align); -extern void pcsx2_aligned_free(void* pmem); - // aligned_malloc: Implement/declare linux equivalents here! -#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC) -# define _aligned_malloc pcsx2_aligned_malloc -# define _aligned_free pcsx2_aligned_free -# define _aligned_realloc pcsx2_aligned_realloc +#if !defined(_MSC_VER) +extern void* __fastcall _aligned_malloc(size_t size, size_t align); +extern void* __fastcall _aligned_realloc(void* handle, size_t size, size_t align); +extern void _aligned_free(void* pmem); #endif // -------------------------------------------------------------------------------------- diff --git a/common/src/Utilities/AlignedMalloc.cpp b/common/src/Utilities/AlignedMalloc.cpp index b921f8c0b8..dde8c8efb3 100644 --- a/common/src/Utilities/AlignedMalloc.cpp +++ b/common/src/Utilities/AlignedMalloc.cpp @@ -18,20 +18,10 @@ #include "PrecompiledHeader.h" -struct AlignedMallocHeader -{ - size_t size; // size of the allocated buffer (minus alignment and header) - void* baseptr; // offset of the original allocated pointer -}; - -static const uint headsize = sizeof(AlignedMallocHeader); - -void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align) +void* __fastcall _aligned_malloc(size_t size, size_t align) { pxAssert( align < 0x10000 ); -#ifdef _WIN32 - return _aligned_malloc(size, align); -#elif defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9 +#if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9 return aligned_alloc(align, size); #else void *result = 0; @@ -40,25 +30,21 @@ void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align) #endif } -void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align) +void* __fastcall _aligned_realloc(void* handle, size_t size, size_t align) { pxAssert( align < 0x10000 ); - void* newbuf = pcsx2_aligned_malloc( size, align ); + void* newbuf = _aligned_malloc( size, align ); if( handle != NULL ) { memcpy( newbuf, handle, size ); - pcsx2_aligned_free(handle); + _aligned_free(handle); } return newbuf; } -__fi void pcsx2_aligned_free(void* pmem) +__fi void _aligned_free(void* pmem) { -#ifdef _WIN32 - _aligned_free(pmem); -#else free(pmem); -#endif }