mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-27 12:21:57 +01:00
7a3e7db40d
- cleaned up error handling in PNGU.
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
/****************************************************************************
|
|
* Copyright (C) 2013 FIX94
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
****************************************************************************/
|
|
#ifndef _MEM_MANAGER_HPP_
|
|
#define _MEM_MANAGER_HPP_
|
|
|
|
#include <ogcsys.h>
|
|
#include <ogc/mutex.h>
|
|
|
|
enum mem_states
|
|
{
|
|
MEM_FREE = (1<<0),//1
|
|
ALLOC_USED = (1<<1),//2
|
|
ALLOC_END = (1<<2),//4
|
|
MEM_END = (1<<3),//8
|
|
};
|
|
|
|
class MemManager {
|
|
public:
|
|
MemManager();
|
|
~MemManager();
|
|
void Init(u8 *start, u8 *list, u32 size);
|
|
void ClearMem();
|
|
void *Alloc(u32 size);
|
|
void Free(void *mem);
|
|
u32 MemBlockSize(void *mem);
|
|
u32 FreeSize();
|
|
void *ReAlloc(void *mem, u32 size);
|
|
private:
|
|
mutex_t memMutex;
|
|
u8 *startAddr;
|
|
u8 *memList;
|
|
u8 *memListEnd;
|
|
u32 memSize;
|
|
};
|
|
|
|
#endif
|