ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ll_system.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef WATCHMAKER_LL_SYSTEM_H
23 #define WATCHMAKER_LL_SYSTEM_H
24 
25 #include "watchmaker/types.h"
26 #include "common/stream.h"
27 #include "common/ptr.h"
28 
29 namespace Watchmaker {
30 
31 //------------------------- Memory Functions -------------------------------
32 void *t3dMalloc(uint32 n);
33 void *t3dCalloc(uint32 n);
34 
35 template<typename T>
36 T *t3dMalloc(uint32 num) {
37  return static_cast<T *>(t3dMalloc(sizeof(T) * num));
38 }
39 
40 template<typename T>
41 T *t3dCalloc(uint32 num) {
42  // HACK: There are a few places where we actually access the first element even when zero-sized
43  // those need to be fixed, but for now, let's pad.
44  if (num == 0) {
45  num++;
46  }
47  return (T *)t3dCalloc(sizeof(T) * num);
48 }
49 void *t3dRealloc(void *p, uint32 additionalBytes);
50 void t3dFree(void *p);
51 
52 //------------------------- Time Functions ---------------------------------
53 void t3dStartTime();
54 void t3dEndTime();
55 uint32 t3dReadTime();
56 
57 bool t3dFastFileInit(const char *name);
58 void t3dForceNOFastFile(char valore);
59 int t3dAccessFile(char *name);
60 bool t3dGetFileDate(uint32 *date, uint32 *time, const char *name);
61 bool checkFileExists(const Common::String &filename);
62 Common::SeekableReadStream *resolveFile(const char *path);
63 Common::SharedPtr<Common::SeekableReadStream> openFile(const Common::String &filename, int offset = 0, int size = -1);
64 
65 } // End of namespace Watchmaker
66 
67 #endif // WATCHMAKER_LL_SYSTEM_H
Definition: 2d_stuff.h:30
Definition: str.h:59
Definition: stream.h:745