summaryrefslogtreecommitdiff
path: root/apps/codecs/dumb/src/allegro/packfile.c
diff options
context:
space:
mode:
authorMichiel Van Der Kolk <not.valid@email.address>2005-03-17 20:50:03 +0000
committerMichiel Van Der Kolk <not.valid@email.address>2005-03-17 20:50:03 +0000
commit27be5bc72855a0fbbdae230bc144624c9eb85f5e (patch)
treeb553f1321df924c4b744ffcab48dce5f4f081f7d /apps/codecs/dumb/src/allegro/packfile.c
parent7e7662bb716917ca431204f0113d400c1014f2e8 (diff)
downloadrockbox-27be5bc72855a0fbbdae230bc144624c9eb85f5e.tar.gz
rockbox-27be5bc72855a0fbbdae230bc144624c9eb85f5e.zip
Initial check in dumb 0.9.2 - has a few usages of floating point that should
be rewritten to fixed point. seems to compile cleanly for iriver. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6197 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/dumb/src/allegro/packfile.c')
-rw-r--r--apps/codecs/dumb/src/allegro/packfile.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/apps/codecs/dumb/src/allegro/packfile.c b/apps/codecs/dumb/src/allegro/packfile.c
new file mode 100644
index 0000000000..525baebd4e
--- /dev/null
+++ b/apps/codecs/dumb/src/allegro/packfile.c
@@ -0,0 +1,98 @@
1/* _______ ____ __ ___ ___
2 * \ _ \ \ / \ / \ \ / / ' ' '
3 * | | \ \ | | || | \/ | . .
4 * | | | | | | || ||\ /| |
5 * | | | | | | || || \/ | | ' ' '
6 * | | | | | | || || | | . .
7 * | |_/ / \ \__// || | |
8 * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
9 * / \
10 * / . \
11 * packfile.c - Packfile input module. / / \ \
12 * | < / \_
13 * By entheh. | \/ /\ /
14 * \_ / > /
15 * Note that this does not use file compression; | \ / /
16 * for that you must open the file yourself and | ' /
17 * then use dumbfile_open_packfile(). \__/
18 */
19
20#include <allegro.h>
21
22#include "aldumb.h"
23
24
25
26static void *dumb_packfile_open(const char *filename)
27{
28 return pack_fopen(filename, F_READ);
29}
30
31
32
33static int dumb_packfile_skip(void *f, long n)
34{
35 return pack_fseek(f, n);
36}
37
38
39
40static int dumb_packfile_getc(void *f)
41{
42 return pack_getc(f);
43}
44
45
46
47static long dumb_packfile_getnc(char *ptr, long n, void *f)
48{
49 return pack_fread(ptr, n, f);
50}
51
52
53
54static void dumb_packfile_close(void *f)
55{
56 pack_fclose(f);
57}
58
59
60
61static DUMBFILE_SYSTEM packfile_dfs = {
62 &dumb_packfile_open,
63 &dumb_packfile_skip,
64 &dumb_packfile_getc,
65 &dumb_packfile_getnc,
66 &dumb_packfile_close
67};
68
69
70
71void dumb_register_packfiles(void)
72{
73 register_dumbfile_system(&packfile_dfs);
74}
75
76
77
78static DUMBFILE_SYSTEM packfile_dfs_leave_open = {
79 NULL,
80 &dumb_packfile_skip,
81 &dumb_packfile_getc,
82 &dumb_packfile_getnc,
83 NULL
84};
85
86
87
88DUMBFILE *dumbfile_open_packfile(PACKFILE *p)
89{
90 return dumbfile_open_ex(p, &packfile_dfs_leave_open);
91}
92
93
94
95DUMBFILE *dumbfile_from_packfile(PACKFILE *p)
96{
97 return p ? dumbfile_open_ex(p, &packfile_dfs) : NULL;
98}