From 27be5bc72855a0fbbdae230bc144624c9eb85f5e Mon Sep 17 00:00:00 2001 From: Michiel Van Der Kolk Date: Thu, 17 Mar 2005 20:50:03 +0000 Subject: 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 --- apps/codecs/dumb/src/allegro/packfile.c | 98 +++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 apps/codecs/dumb/src/allegro/packfile.c (limited to 'apps/codecs/dumb/src/allegro/packfile.c') 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 @@ +/* _______ ____ __ ___ ___ + * \ _ \ \ / \ / \ \ / / ' ' ' + * | | \ \ | | || | \/ | . . + * | | | | | | || ||\ /| | + * | | | | | | || || \/ | | ' ' ' + * | | | | | | || || | | . . + * | |_/ / \ \__// || | | + * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque + * / \ + * / . \ + * packfile.c - Packfile input module. / / \ \ + * | < / \_ + * By entheh. | \/ /\ / + * \_ / > / + * Note that this does not use file compression; | \ / / + * for that you must open the file yourself and | ' / + * then use dumbfile_open_packfile(). \__/ + */ + +#include + +#include "aldumb.h" + + + +static void *dumb_packfile_open(const char *filename) +{ + return pack_fopen(filename, F_READ); +} + + + +static int dumb_packfile_skip(void *f, long n) +{ + return pack_fseek(f, n); +} + + + +static int dumb_packfile_getc(void *f) +{ + return pack_getc(f); +} + + + +static long dumb_packfile_getnc(char *ptr, long n, void *f) +{ + return pack_fread(ptr, n, f); +} + + + +static void dumb_packfile_close(void *f) +{ + pack_fclose(f); +} + + + +static DUMBFILE_SYSTEM packfile_dfs = { + &dumb_packfile_open, + &dumb_packfile_skip, + &dumb_packfile_getc, + &dumb_packfile_getnc, + &dumb_packfile_close +}; + + + +void dumb_register_packfiles(void) +{ + register_dumbfile_system(&packfile_dfs); +} + + + +static DUMBFILE_SYSTEM packfile_dfs_leave_open = { + NULL, + &dumb_packfile_skip, + &dumb_packfile_getc, + &dumb_packfile_getnc, + NULL +}; + + + +DUMBFILE *dumbfile_open_packfile(PACKFILE *p) +{ + return dumbfile_open_ex(p, &packfile_dfs_leave_open); +} + + + +DUMBFILE *dumbfile_from_packfile(PACKFILE *p) +{ + return p ? dumbfile_open_ex(p, &packfile_dfs) : NULL; +} -- cgit v1.2.3