summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MSVC/Baltisot - generic/Baltisot - generic.vcproj56
-rw-r--r--MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj8
-rw-r--r--compile/linux/Makefile13
-rw-r--r--compile/win32/Makefile15
-rw-r--r--includes/sliding-window.h54
-rw-r--r--lib/sliding-window.cpp37
6 files changed, 152 insertions, 31 deletions
diff --git a/MSVC/Baltisot - generic/Baltisot - generic.vcproj b/MSVC/Baltisot - generic/Baltisot - generic.vcproj
index ffb170e..8ef7c15 100644
--- a/MSVC/Baltisot - generic/Baltisot - generic.vcproj
+++ b/MSVC/Baltisot - generic/Baltisot - generic.vcproj
@@ -40,7 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include;..\dirent;..\regex"
- PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC"
+ PreprocessorDefinitions="_WINDOWS;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -107,7 +107,7 @@
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include;..\dirent;..\regex"
- PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC"
+ PreprocessorDefinitions="_WINDOWS;READLINE_STATIC;READLINE_LIBRARY;STDC_HEADERS;STDC"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -673,14 +673,6 @@
>
</File>
<File
- RelativePath="..\..\generic\lib\zlib\src\infblock.c"
- >
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\infcodes.c"
- >
- </File>
- <File
RelativePath="..\..\generic\lib\zlib\src\inffast.c"
>
</File>
@@ -693,10 +685,6 @@
>
</File>
<File
- RelativePath="..\..\generic\lib\zlib\src\infutil.c"
- >
- </File>
- <File
RelativePath="..\..\generic\lib\zlib\src\trees.c"
>
</File>
@@ -713,15 +701,11 @@
Name="Includes"
>
<File
- RelativePath="..\..\generic\lib\zlib\include\deflate.h"
+ RelativePath="..\..\generic\lib\zlib\include\crc32.h"
>
</File>
<File
- RelativePath="..\..\generic\lib\zlib\include\infblock.h"
- >
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\infcodes.h"
+ RelativePath="..\..\generic\lib\zlib\include\deflate.h"
>
</File>
<File
@@ -733,11 +717,11 @@
>
</File>
<File
- RelativePath="..\..\generic\lib\zlib\include\inftrees.h"
+ RelativePath="..\..\generic\lib\zlib\include\inflate.h"
>
</File>
<File
- RelativePath="..\..\generic\lib\zlib\include\infutil.h"
+ RelativePath="..\..\generic\lib\zlib\include\inftrees.h"
>
</File>
<File
@@ -1010,6 +994,34 @@
>
</File>
</Filter>
+ <Filter
+ Name="HashTables"
+ >
+ <File
+ RelativePath="..\..\generic\lib\hashtab.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generic\include\hashtab.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lookupa.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generic\include\lookupa.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\recycle.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\generic\include\recycle.h"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj b/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj
index 1015075..a414933 100644
--- a/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj
+++ b/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj
@@ -159,6 +159,14 @@
RelativePath="..\..\includes\lzss.h"
>
</File>
+ <File
+ RelativePath="..\..\lib\sliding-window.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\includes\sliding-window.h"
+ >
+ </File>
</Filter>
<Filter
Name="CD classes"
diff --git a/compile/linux/Makefile b/compile/linux/Makefile
index 8c5632d..d0443c6 100644
--- a/compile/linux/Makefile
+++ b/compile/linux/Makefile
@@ -41,10 +41,10 @@ ZLIB_SOURCES = \
../../generic/lib/zlib/src/adler32.c ../../generic/lib/zlib/src/inffast.c \
../../generic/lib/zlib/src/compress.c ../../generic/lib/zlib/src/inflate.c \
../../generic/lib/zlib/src/crc32.c ../../generic/lib/zlib/src/inftrees.c \
-../../generic/lib/zlib/src/deflate.c ../../generic/lib/zlib/src/infutil.c \
+../../generic/lib/zlib/src/deflate.c \
../../generic/lib/zlib/src/gzio.c ../../generic/lib/zlib/src/trees.c \
../../generic/lib/zlib/src/infblock.c ../../generic/lib/zlib/src/uncompr.c \
-../../generic/lib/zlib/src/infcodes.c ../../generic/lib/zlib/src/zutil.c
+../../generic/lib/zlib/src/zutil.c
LUA_SOURCES = \
../../generic/lib/lua/src/lapi.c ../../generic/lib/lua/src/lparser.c \
@@ -68,6 +68,10 @@ LUA_SOURCES = \
../../generic/lib/lua/src/LuaLib/ltablib.c \
../../generic/lib/lua/src/LuaLib/ldirlib.c
+HASH_SOURCES = \
+../../generic/lib/hashtab.c ../../generic/lib/lookupa.c \
+../../generic/lib/recycle.c
+
PSX_SOURCES = \
../../lib/cdabstract.cpp ../../lib/luacd.cpp \
../../lib/cdreader.cpp ../../lib/luapsx.cpp \
@@ -79,8 +83,9 @@ PSXDEV_SOURCES = \
../../psxdev/idctfst.c ../../psxdev/vlc.c
COMMON_SOURCES = \
-$(BALTISOT_SOURCES) $(ZLIB_SOURCES) $(REGEX_SOURCES) $(GETOPT_SOURCES)\
-$(LUA_SOURCES) $(PSX_SOURCES) $(PSXDEV_SOURCES) $(READLINE_SOURCES)
+$(BALTISOT_SOURCES) $(ZLIB_SOURCES) $(REGEX_SOURCES) $(GETOPT_SOURCES) \
+$(LUA_SOURCES) $(PSX_SOURCES) $(PSXDEV_SOURCES) $(READLINE_SOURCES) \
+$(HASH_SOURCES)
WHOLE_SOURCES = $(SOURCES) $(COMMON_SOURCES) $(MOGLTK_SOURCES)
diff --git a/compile/win32/Makefile b/compile/win32/Makefile
index f26829a..b5dd4b3 100644
--- a/compile/win32/Makefile
+++ b/compile/win32/Makefile
@@ -13,7 +13,7 @@ INCLUDES = -I../../includes -I../../psxdev -I../../generic/include \
CPPFLAGS = $(INCLUDES) -O4 -march=i686 -DSTDC_HEADERS -DREADLINE_STATIC -fexceptions
-LDFLAGS = -march=i586 -O4
+LDFLAGS =
SOURCES = \
../../cd-tool.cpp ../../luapatch.cpp
@@ -42,10 +42,10 @@ ZLIB_SOURCES = \
../../generic/lib/zlib/src/adler32.c ../../generic/lib/zlib/src/inffast.c \
../../generic/lib/zlib/src/compress.c ../../generic/lib/zlib/src/inflate.c \
../../generic/lib/zlib/src/crc32.c ../../generic/lib/zlib/src/inftrees.c \
-../../generic/lib/zlib/src/deflate.c ../../generic/lib/zlib/src/infutil.c \
+../../generic/lib/zlib/src/deflate.c \
../../generic/lib/zlib/src/gzio.c ../../generic/lib/zlib/src/trees.c \
../../generic/lib/zlib/src/infblock.c ../../generic/lib/zlib/src/uncompr.c \
-../../generic/lib/zlib/src/infcodes.c ../../generic/lib/zlib/src/zutil.c
+../../generic/lib/zlib/src/zutil.c
LUA_SOURCES = \
../../generic/lib/lua/src/lapi.c ../../generic/lib/lua/src/lparser.c \
@@ -69,6 +69,10 @@ LUA_SOURCES = \
../../generic/lib/lua/src/LuaLib/ltablib.c \
../../generic/lib/lua/src/LuaLib/ldirlib.c
+HASH_SOURCES = \
+../../generic/lib/hashtab.c ../../generic/lib/lookupa.c \
+../../generic/lib/recycle.c
+
PSX_SOURCES = \
../../lib/cdabstract.cpp ../../lib/luacd.cpp \
../../lib/cdreader.cpp ../../lib/luapsx.cpp \
@@ -86,8 +90,9 @@ GETOPT_SOURCES = \
../../MSVC/getopt/getopt.c ../../MSVC/getopt/getopt1.c
COMMON_SOURCES = \
-$(BALTISOT_SOURCES) $(ZLIB_SOURCES) $(REGEX_SOURCES) $(GETOPT_SOURCES)\
-$(LUA_SOURCES) $(PSX_SOURCES) $(PSXDEV_SOURCES) $(READLINE_SOURCES)
+$(BALTISOT_SOURCES) $(ZLIB_SOURCES) $(REGEX_SOURCES) $(GETOPT_SOURCES) \
+$(LUA_SOURCES) $(PSX_SOURCES) $(PSXDEV_SOURCES) $(READLINE_SOURCES) \
+$(HASH_SOURCES)
WHOLE_SOURCES = $(SOURCES) $(COMMON_SOURCES) $(MOGLTK_SOURCES)
diff --git a/includes/sliding-window.h b/includes/sliding-window.h
new file mode 100644
index 0000000..0b3477d
--- /dev/null
+++ b/includes/sliding-window.h
@@ -0,0 +1,54 @@
+/*
+ * PSX-Tools Bundle Pack
+ * Copyright (C) 2002-2005 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __SLIDING_WINDOW_H__
+#define __SLIDING_WINDOW_H__
+
+#include <Exceptions.h>
+#include <recycle.h>
+
+class sliding_window : public Base {
+ public:
+ struct entry_tree_t;
+ struct d_list_t {
+ struct entry_t * p;
+ struct d_list_t * next;
+ };
+ struct distance_t {
+ Uint32 d;
+ struct d_list_t * entries;
+ };
+ struct entry_tree_t {
+ struct entry_tree_t * hash[256];
+ struct distance_t * d;
+ };
+ sliding_window(Uint32 max_window, Uint32 max_size);
+ virtual ~sliding_window();
+ void push_byte(Uint8);
+ void push_bytes(Uint8 *, Uint32 size);
+ private:
+ struct entry_tree_t * root_entries[256];
+ Uint8 * stack;
+ Uint32 max_window;
+ Uint32 max_size;
+ reroot * entries_recycle;
+ Uint32 current_size;
+};
+
+#endif
diff --git a/lib/sliding-window.cpp b/lib/sliding-window.cpp
new file mode 100644
index 0000000..88b616a
--- /dev/null
+++ b/lib/sliding-window.cpp
@@ -0,0 +1,37 @@
+/*
+ * PSX-Tools Bundle Pack
+ * Copyright (C) 2002-2005 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <sliding-window.h>
+
+sliding_window::sliding_window(Uint32 _max_window, Uint32 _max_size) :
+ stack((Uint8 *) malloc(_max_size)), max_window(_max_window), max_size(_max_size), entries_recycle(remkroot(sizeof(struct sliding_window::entry_tree_t))), current_size(0) {
+ memset(root_entries, 0, 256 * sizeof(struct entry_tree_t));
+}
+
+sliding_window::~sliding_window() {
+ refree(entries_recycle);
+}
+
+void sliding_window::push_byte(Uint8 b) {
+ struct entry_tree_t * e = (struct entry_tree_t *) renewx(entries_recycle);
+
+ memset(e->hash, 0, 256 * sizeof(struct entry_tree_t *));
+
+// e->offset = current_size++;
+}