chore: clean up
This commit is contained in:
1 parent
f994be0bc6
commit
1e763528bd
2307 files changed
+107
-21308
No files matched your search
@@ -55,36 +55,23 @@ void SoundEngine::playMusicTick() {};
|
||||
|
||||
#else
|
||||
|
||||
char SoundEngine::m_szMusicPath[]={"Common\\music\\"};
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
char SoundEngine::m_szSoundPath[]={"Durango\\Sound\\"};
|
||||
char SoundEngine::m_szMusicPath[]={"music\\"};
|
||||
char SoundEngine::m_szRedistName[]={"redist64"};
|
||||
char SoundEngine::m_szRedistName[]={"Windows64\\redist64"};
|
||||
#elif defined _DURANGO
|
||||
char SoundEngine::m_szSoundPath[]={"Sound\\"};
|
||||
char SoundEngine::m_szMusicPath[]={"music\\"};
|
||||
char SoundEngine::m_szRedistName[]={"redist64"};
|
||||
#elif defined __ORBIS__
|
||||
|
||||
#ifdef _CONTENT_PACKAGE
|
||||
char SoundEngine::m_szSoundPath[]={"Sound/"};
|
||||
#elif defined _ART_BUILD
|
||||
char SoundEngine::m_szSoundPath[]={"Sound/"};
|
||||
#else
|
||||
// just use the host Durango folder for the sound. In the content package, we'll have moved this in the .gp4 file
|
||||
char SoundEngine::m_szSoundPath[]={"Durango/Sound/"};
|
||||
#endif
|
||||
char SoundEngine::m_szMusicPath[]={"music/"};
|
||||
char SoundEngine::m_szSoundPath[]={"Orbis/Sound/"};
|
||||
char SoundEngine::m_szRedistName[]={"redist64"};
|
||||
#elif defined __PSVITA__
|
||||
char SoundEngine::m_szSoundPath[]={"PSVita/Sound/"};
|
||||
char SoundEngine::m_szMusicPath[]={"music/"};
|
||||
char SoundEngine::m_szRedistName[]={"redist"};
|
||||
#elif defined __PS3__
|
||||
//extern const char* getPS3HomePath();
|
||||
char SoundEngine::m_szSoundPath[]={"PS3/Sound/"};
|
||||
char SoundEngine::m_szMusicPath[]={"music/"};
|
||||
char SoundEngine::m_szRedistName[]={"redist"};
|
||||
|
||||
#define USE_SPURS
|
||||
|
||||
#ifdef USE_SPURS
|
||||
@@ -92,7 +79,6 @@ char SoundEngine::m_szRedistName[]={"redist"};
|
||||
#else
|
||||
#include <sys/spu_image.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
F32 AILCALLBACK custom_falloff_function (HSAMPLE S,
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
class C4JMemoryPool
|
||||
{
|
||||
public:
|
||||
unsigned int Align(unsigned int val, unsigned int align) { return int((val+(align-1))/align) * align; }
|
||||
virtual void* Alloc(size_t size) = 0;
|
||||
virtual void Free(void* ptr) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Fast Efficient Fixed-Size Memory Pool : No Loops and No Overhead
|
||||
// http://www.alogicalmind.com/memory_pools/index.htm
|
||||
class C4JMemoryPoolFixed : public C4JMemoryPool
|
||||
{
|
||||
// Basic type define
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned char uchar;
|
||||
uint m_numOfBlocks; // Num of blocks
|
||||
uint m_sizeOfEachBlock; // Size of each block
|
||||
uint m_numFreeBlocks; // Num of remaining blocks
|
||||
uint m_numInitialized; // Num of initialized blocks
|
||||
uchar* m_memStart; // Beginning of memory pool
|
||||
uchar* m_memEnd; // End of memory pool
|
||||
uchar* m_next; // Num of next free block
|
||||
// CRITICAL_SECTION m_CS;
|
||||
public:
|
||||
C4JMemoryPoolFixed()
|
||||
{
|
||||
m_numOfBlocks = 0;
|
||||
m_sizeOfEachBlock = 0;
|
||||
m_numFreeBlocks = 0;
|
||||
m_numInitialized = 0;
|
||||
m_memStart = NULL;
|
||||
m_memEnd = NULL;
|
||||
m_next = 0;
|
||||
}
|
||||
|
||||
C4JMemoryPoolFixed(uint sizeOfEachBlock, uint numOfBlocks)
|
||||
{
|
||||
CreatePool(sizeOfEachBlock, numOfBlocks);
|
||||
}
|
||||
|
||||
~C4JMemoryPoolFixed() { DestroyPool(); }
|
||||
|
||||
void CreatePool(uint sizeOfEachBlock, uint numOfBlocks)
|
||||
{
|
||||
assert(sizeOfEachBlock >= 4); // has to be at least the size of an int, for book keeping
|
||||
m_numOfBlocks = numOfBlocks;
|
||||
m_sizeOfEachBlock = sizeOfEachBlock;
|
||||
m_numFreeBlocks = numOfBlocks;
|
||||
m_numInitialized = 0;
|
||||
m_memStart = new uchar[ m_sizeOfEachBlock *
|
||||
m_numOfBlocks ];
|
||||
m_memEnd = m_memStart + (m_sizeOfEachBlock * m_numOfBlocks);
|
||||
m_next = m_memStart;
|
||||
// InitializeCriticalSection(&m_CS);
|
||||
}
|
||||
|
||||
void DestroyPool()
|
||||
{
|
||||
delete[] m_memStart;
|
||||
m_memStart = NULL;
|
||||
}
|
||||
|
||||
uchar* AddrFromIndex(uint i) const
|
||||
{
|
||||
return m_memStart + ( i * m_sizeOfEachBlock );
|
||||
}
|
||||
|
||||
uint IndexFromAddr(const uchar* p) const
|
||||
{
|
||||
return (((uint)(p - m_memStart)) / m_sizeOfEachBlock);
|
||||
}
|
||||
|
||||
virtual void* Alloc(size_t size)
|
||||
{
|
||||
if(size > m_sizeOfEachBlock)
|
||||
return ::malloc(size);
|
||||
// EnterCriticalSection(&m_CS);
|
||||
if (m_numInitialized < m_numOfBlocks )
|
||||
{
|
||||
uint* p = (uint*)AddrFromIndex( m_numInitialized );
|
||||
*p = m_numInitialized + 1;
|
||||
m_numInitialized++;
|
||||
}
|
||||
void* ret = NULL;
|
||||
if ( m_numFreeBlocks > 0 )
|
||||
{
|
||||
ret = (void*)m_next;
|
||||
--m_numFreeBlocks;
|
||||
if (m_numFreeBlocks!=0)
|
||||
{
|
||||
m_next = AddrFromIndex( *((uint*)m_next) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_next = NULL;
|
||||
}
|
||||
}
|
||||
// LeaveCriticalSection(&m_CS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual void Free(void* ptr)
|
||||
{
|
||||
if(ptr < m_memStart || ptr > m_memEnd)
|
||||
{
|
||||
::free(ptr);
|
||||
return;
|
||||
}
|
||||
// EnterCriticalSection(&m_CS);
|
||||
if (m_next != NULL)
|
||||
{
|
||||
(*(uint*)ptr) = IndexFromAddr( m_next );
|
||||
m_next = (uchar*)ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint*)ptr) = m_numOfBlocks;
|
||||
m_next = (uchar*)ptr;
|
||||
}
|
||||
++m_numFreeBlocks;
|
||||
// LeaveCriticalSection(&m_CS);
|
||||
}
|
||||
}; // End pool class
|
||||
|
||||
|
||||
// this pool will constantly grow until it is reset (automatically when all allocs have been "freed")
|
||||
class C4JMemoryPoolGrow : public C4JMemoryPool
|
||||
{
|
||||
uint32_t m_totalSize;
|
||||
uint32_t m_memUsed;
|
||||
uint32_t m_numAllocations;
|
||||
uint8_t* m_pMemory;
|
||||
uint32_t m_currentOffset;
|
||||
|
||||
public:
|
||||
C4JMemoryPoolGrow(uint32_t size = 64*1024)
|
||||
{
|
||||
size = Align(size, 4);
|
||||
m_totalSize = size;
|
||||
m_pMemory = new uint8_t[size];
|
||||
m_currentOffset = 0;
|
||||
m_memUsed = 0;
|
||||
m_numAllocations = 0;
|
||||
}
|
||||
|
||||
virtual void* Alloc(size_t size)
|
||||
{
|
||||
size = Align(size, 4); // 4 byte align the memory
|
||||
assert((m_currentOffset + size) < m_totalSize); // make sure we haven't ran out of space
|
||||
void* returnMem = &m_pMemory[m_currentOffset]; // grab the return memory
|
||||
m_currentOffset += size;
|
||||
m_numAllocations++;
|
||||
return returnMem;
|
||||
}
|
||||
virtual void Free(void* ptr)
|
||||
{
|
||||
m_numAllocations--;
|
||||
if(m_numAllocations == 0)
|
||||
m_currentOffset = 0; // reset the pool when we reach zero allocations
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
#include "..\Minecraft.Client\Common\C4JMemoryPool.h"
|
||||
|
||||
// Custom allocator, takes a C4JMemoryPool class, which can be one of a number of pool implementations.
|
||||
|
||||
template <class T>
|
||||
class C4JPoolAllocator
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
|
||||
//! A struct to construct an allocator for a different type.
|
||||
template<typename U>
|
||||
struct rebind { typedef C4JPoolAllocator<U> other; };
|
||||
|
||||
|
||||
C4JMemoryPool* m_pPool;
|
||||
bool m_selfAllocated;
|
||||
|
||||
C4JPoolAllocator( C4JMemoryPool* pool = new C4JMemoryPoolFixed(32, 4096 )) : m_pPool( pool ), m_selfAllocated(true)
|
||||
{
|
||||
printf("allocated mempool\n");
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
C4JPoolAllocator(C4JPoolAllocator<U> const& obj) : m_pPool( obj.m_pPool ), m_selfAllocated(false) // copy constructor
|
||||
{
|
||||
printf("C4JPoolAllocator constructed from 0x%08x\n", &obj);
|
||||
assert(obj.m_pPool);
|
||||
}
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
~C4JPoolAllocator()
|
||||
{
|
||||
if(m_selfAllocated)
|
||||
delete m_pPool;
|
||||
}
|
||||
|
||||
pointer address( reference r ) const { return &r; }
|
||||
const_pointer address( const_reference r ) const { return &r; }
|
||||
|
||||
pointer allocate( size_type n, const void* /*hint*/=0 )
|
||||
{
|
||||
assert(m_pPool);
|
||||
return (pointer)m_pPool->Alloc(n * sizeof(T));
|
||||
}
|
||||
|
||||
void deallocate( pointer p, size_type /*n*/ )
|
||||
{
|
||||
assert(m_pPool);
|
||||
m_pPool->Free(p);
|
||||
}
|
||||
|
||||
void construct( pointer p, const T& val )
|
||||
{
|
||||
new (p) T(val);
|
||||
}
|
||||
|
||||
void destroy( pointer p )
|
||||
{
|
||||
p->~T();
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{
|
||||
return ULONG_MAX / sizeof(T);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
operator==( const C4JPoolAllocator<T>& left, const C4JPoolAllocator<T>& right )
|
||||
{
|
||||
if (left.m_pPool == right.m_pPool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
operator!=( const C4JPoolAllocator<T>& left, const C4JPoolAllocator<T>& right)
|
||||
{
|
||||
if (left.m_pPool != right.m_pPool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
This file only exists so that I can add this folder to TFS. I am not ready to add the contents. Stu
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 2307 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user