fix for corrupted graphics when manipulating config files
[open-ps2-loader.git] / include / texcache.h
blob3884f97a6dcd0c8aa2fbbcc17a737b6e2747cc49
1 #ifndef __TEX_CACHE_H
2 #define __TEX_CACHE_H
4 #include <gsToolkit.h>
5 #include "include/iosupport.h"
7 /// A single cache entry...
8 typedef struct {
9 GSTEXTURE texture;
11 // NULL not queued, otherwise queue request record
12 void* qr;
14 // frame counter the icon was used the last time - oldest get rewritten first in case new icon is requested and cache is full. negative numbers mean
15 // slot is free and can be used right now
16 int lastUsed;
18 int UID;
19 } cache_entry_t;
22 /// One texture cache instance
23 typedef struct {
24 /// User specified ID, not used in any way by the cache code (not even initialized!)
25 int userId;
27 /// count of entries (copy of the requested cache size upon cache initialization)
28 int count;
30 /// directory prefix for this cache (if any)
31 char* prefix;
32 int isPrefixRelative;
33 char* suffix;
35 int nextUID;
37 /// the cache entries itself
38 cache_entry_t* content;
39 } image_cache_t;
41 /** Initializes the cache subsystem.
43 void cacheInit();
45 /** Terminates the cache. Does nothing currently. Users of this code have to destroy caches via cacheDestroyCache
47 void cacheEnd();
49 /** Initializes a single cache
51 image_cache_t* cacheInitCache(int userId, char* prefix, int isPrefixRelative, char* suffix, int count);
53 /** Destroys a given cache (unallocates all memory stored there, disconnects the pixmaps from the usage points).
55 void cacheDestroyCache(image_cache_t* cache);
57 GSTEXTURE* cacheGetTexture(image_cache_t* cache, item_list_t* list, int* cacheId, int* UID, char* value);
59 #endif