summaryrefslogtreecommitdiff
path: root/src/common/grfio.h
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2016-03-01 08:16:37 +0200
committerHaru <haru@dotalux.com>2016-07-12 20:58:44 +0200
commitd0358265beff02fd9c094ba480f1a9583035cf64 (patch)
tree6c8433dfda39ba19a721e66f70b0f11fce45eeeb /src/common/grfio.h
parentb0a4a441f582810c91aeec458fdbe7cc6cc78db9 (diff)
downloadhercules-d0358265beff02fd9c094ba480f1a9583035cf64.tar.gz
hercules-d0358265beff02fd9c094ba480f1a9583035cf64.tar.bz2
hercules-d0358265beff02fd9c094ba480f1a9583035cf64.tar.xz
hercules-d0358265beff02fd9c094ba480f1a9583035cf64.zip
Interface grfio.c
Diffstat (limited to 'src/common/grfio.h')
-rw-r--r--src/common/grfio.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/common/grfio.h b/src/common/grfio.h
index 36ed8fb39..72afad274 100644
--- a/src/common/grfio.h
+++ b/src/common/grfio.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -21,16 +21,24 @@
#ifndef COMMON_GRFIO_H
#define COMMON_GRFIO_H
-#ifdef HERCULES_CORE
-void grfio_init(const char* fname);
-void grfio_final(void);
-void* grfio_reads(const char* fname, int* size);
-char* grfio_find_file(const char* fname);
-#define grfio_read(fn) grfio_reads((fn), NULL)
+#include "common/hercules.h"
+
+struct grfio_interface {
+ void (*init) (const char *fname);
+ void (*final) (void);
+ void *(*reads) (const char *fname, int *size);
+ char *(*find_file) (const char *fname);
+
+ unsigned long (*crc32) (const unsigned char *buf, unsigned int len);
+ int (*decode_zip) (void *dest, unsigned long *destLen, const void *source, unsigned long sourceLen);
+ int (*encode_zip) (void *dest, unsigned long *destLen, const void *source, unsigned long sourceLen);
+};
-unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
-int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
-int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
+#define grfio_read(fn) grfio->reads((fn), NULL)
+
+#ifdef HERCULES_CORE
+void grfio_defaults(void);
#endif // HERCULES_CORE
+HPShared struct grfio_interface *grfio;
#endif /* COMMON_GRFIO_H */