mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-18 07:51:53 +01:00
971b5bdb52
to be divisible with 4 anymore, you can use what you want -moved sound buffers back in mem2, idk but for wiiflow it gives a better result -added mem2 memalign placeholder for new memory manager (after a week still everything but finished) -updated other small things, cleaned up source structure a bit
49 lines
991 B
C++
49 lines
991 B
C++
#ifndef CCACHE
|
|
#define CCACHE
|
|
|
|
#include <sys/types.h>
|
|
#include <ogcsys.h>
|
|
#include <fstream>
|
|
#include <vector>
|
|
#include "loader/disc.h"
|
|
|
|
//#include "gecko.h"
|
|
using namespace std;
|
|
|
|
const char io[4][5] = {
|
|
"wb",
|
|
"rb",
|
|
"ab",
|
|
"wb",
|
|
};
|
|
|
|
enum CMode
|
|
{
|
|
SAVE,
|
|
LOAD,
|
|
ADD,
|
|
REMOVE
|
|
};
|
|
|
|
template <typename T>
|
|
class CCache
|
|
{
|
|
public:
|
|
CCache(T &tmp, string path, u32 index, CMode mode); /* Load/Save One */
|
|
CCache(vector<T> &list, string path, CMode mode); /* Load/Save All */
|
|
CCache(vector<T> &list, string path, T tmp, CMode mode); /* Add One */
|
|
CCache(vector<T> &list, string path, u32 index, CMode mode); /* Remove One */
|
|
~CCache();
|
|
private:
|
|
void SaveAll(vector<T> list);
|
|
void SaveOne(T tmp, u32 index);
|
|
void LoadAll(vector<T> &list);
|
|
void LoadOne(T &tmp, u32 index);
|
|
|
|
void AddOne(vector<T> &list, T tmp);
|
|
void RemoveOne(vector<T> &list, u32 index);
|
|
|
|
FILE *cache;
|
|
string filename;
|
|
};
|
|
#endif |