summaryrefslogtreecommitdiff
path: root/include/user/paf/resource.h
blob: f5470df065d91dd7bc50e6c2616506f8e34dfa78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
	Vita Development Suite Libraries
*/

#ifndef _VDSUITE_USER_PAF_RESOURCE_H
#define _VDSUITE_USER_PAF_RESOURCE_H

#include <kernel.h>
#include <paf/common.h>

namespace paf {

	class Allocator;

	class Resource
	{
	public:

		enum Error
		{
			SCE_PAF_ERROR_RESOURCE_NOT_FOUND = 0x80AF0601
		};

		typedef void(*ResourceMemAllocator)(SceUInt32 opType, paf::Allocator *allocator, ScePVoid ptrIn, SceSize sizeIn, ScePVoid **ptrOut, SceSize *sizeOut);

		class LoadParam
		{
		public:

			SceUInt32 flags;
			paf::Allocator *memAllocator;
			ResourceMemAllocator memAllocFunction;
		};

		Resource(const char *resourcePath, LoadParam *resLoadParam);

		~Resource();

		static SceVoid DefaultMemAllocator(SceUInt32 opType, paf::Allocator *allocator, ScePVoid ptrIn, SceSize sizeIn, ScePVoid **ptrOut, SceSize *sizeOut);

		class Element
		{
		public:

			Element() : hash(0)
			{

			}

			~Element()
			{

			}

			SceUInt32 GetHashById(Element *src);

			paf::String id;
			SceUInt32 hash;
		};

		SceInt32 GetString(SceUInt32 hash, SceWChar16 **ppString, SceSize *pStringSize);

		SceInt32 GetString(const char *id, SceWChar16 **ppString, SceSize *pStringSize);
	};

}

#endif /* _VDSUITE_USER_PAF_RESOURCE_H */