summaryrefslogtreecommitdiff
path: root/plugins/dumb/dumb-kode54/src/allegro/datduh.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-11 15:01:21 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-11 15:01:21 +0200
commite763dfa3ddf5c499875a6e1e9ec91d7fc154c076 (patch)
tree8fddc5ecbb1d867afa4690cfdde245929cafb21c /plugins/dumb/dumb-kode54/src/allegro/datduh.c
parentdc0b9121ff16d57f92f4ab2b16bf78518d3a8b9b (diff)
moved DUMB to dynamic plugin
Diffstat (limited to 'plugins/dumb/dumb-kode54/src/allegro/datduh.c')
-rw-r--r--plugins/dumb/dumb-kode54/src/allegro/datduh.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/dumb/dumb-kode54/src/allegro/datduh.c b/plugins/dumb/dumb-kode54/src/allegro/datduh.c
new file mode 100644
index 00000000..5dec3975
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/src/allegro/datduh.c
@@ -0,0 +1,60 @@
+/* _______ ____ __ ___ ___
+ * \ _ \ \ / \ / \ \ / / ' ' '
+ * | | \ \ | | || | \/ | . .
+ * | | | | | | || ||\ /| |
+ * | | | | | | || || \/ | | ' ' '
+ * | | | | | | || || | | . .
+ * | |_/ / \ \__// || | |
+ * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
+ * / \
+ * / . \
+ * datduh.c - Integration with Allegro's / / \ \
+ * datafiles. | < / \_
+ * | \/ /\ /
+ * By entheh. \_ / > /
+ * | \ / /
+ * | ' /
+ * \__/
+ */
+
+#include <allegro.h>
+
+#include "aldumb.h"
+#include "internal/aldumb.h"
+
+
+
+static void *dat_read_duh(PACKFILE *f, long size)
+{
+ DUMBFILE *df;
+ DUH *duh;
+
+ (void)size;
+
+ df = dumbfile_open_packfile(f);
+
+ if (!df)
+ return NULL;
+
+ duh = read_duh(df);
+
+ dumbfile_close(df);
+
+ return duh;
+}
+
+
+
+/* dumb_register_dat_duh(): tells Allegro about the DUH datafile object. If
+ * you intend to load a datafile containing a DUH object, you must call this
+ * function first. It is recommended you pass DAT_DUH, but you may have a
+ * reason to use a different type (apart from pride, that doesn't count).
+ */
+void dumb_register_dat_duh(long type)
+{
+ register_datafile_object(
+ type,
+ &dat_read_duh,
+ &_dat_unload_duh
+ );
+}