summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Noble <nnoble@blizzard.com>2009-03-16 14:05:47 -0700
committerNicolas Noble <nnoble@blizzard.com>2009-03-16 14:05:47 -0700
commit76aa3260f43ef0d74bbfa04982b620961af61eab (patch)
treeaccd626d62b73398c05cda04f407d351d50d72a8
Initial commit.
-rw-r--r--Makefile96
-rw-r--r--src/plugin-luacd.cc18
-rw-r--r--src/plugin-luapsx.cc13
3 files changed, 127 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..170127f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,96 @@
+SYSTEM=$(shell uname)
+ifeq ($(SYSTEM),Darwin)
+ARCH_FLAGS=
+SHARED_FLAGS=-dynamiclib
+SHARED_EXT=dylib
+CPPFLAGS = -dynamic
+LD = g++
+else
+ARCH_FLAGS=-march=i686 -m32
+SHARED_FLAGS=-shared
+SHARED_EXT=so
+LD = g++ -m32
+endif
+CC = gcc
+CXX = g++
+STRIP = strip
+
+INCLUDES = \
+-I../Baltisot/include \
+-I../Baltisot/lib/zlib/include \
+-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
+-I /sw/include \
+-I../PSX-Bundle/includes -I../PSX-Bundle/psxdev \
+
+HAVES = -DHAVE_VSSCANF -DHAVE_FCNTL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_BYTESWAP_H
+
+CPPFLAGS += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN $(ARCH_FLAGS) $(HAVES)
+
+LDFLAGS += $(ARCH_FLAGS) $(SHARED_FLAGS) ./lua-interface.$(SHARED_EXT)
+
+vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev
+vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev
+vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../PSX-Bundle/lib:../PSX-Bundle/psxdev
+vpath %.lua ../Baltisot/lib:../Baltisot/src
+
+LUACD_SOURCES = \
+plugin-luacd.cc \
+luacd.cpp \
+cdabstract.cpp \
+cdreader.cpp \
+cdutils.cpp \
+dvdabstract.cpp \
+isobuilder.cpp \
+yazedc.cpp \
+
+LUAPSX_SOURCES = \
+plugin-luapsx.cc \
+luapsx.cpp \
+bs.c \
+idctfst.c \
+jfdctint.c \
+vlc.c \
+xadecode.c \
+
+WHOLE_SOURCES = \
+$(LUAPSX_SOURCES) \
+$(LUACD_SOURCES) \
+
+MODULES_LIST = \
+luapsx.$(SHARED_EXT) \
+luacd.$(SHARED_EXT) \
+
+ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES) $(LUA_LIB))))
+ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES))))
+
+all: dep modules
+
+modules: $(MODULES_LIST)
+
+dep: $(ALL_DEPS)
+
+luapsx.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(LUAPSX_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(LUAPSX_LIBS)
+
+luacd.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(LUACD_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(LUACD_LIBS)
+
+clean:
+ rm -f *.o *.dep *.so *.dylib
+
+%.dep : %.c
+ $(CC) $(CPPFLAGS) -M -MF $@ $<
+
+%.dep : %.cpp
+ $(CXX) $(CPPFLAGS) -M -MF $@ $<
+
+%.dep : %.cc
+ $(CXX) $(CPPFLAGS) -M -MF $@ $<
+
+%.c : %.clua
+ bin2c $< $@ $(basename $@)
+
+%.clua : %.lua
+ ./luac -o $@ $<
+
+-include $(ALL_DEPS)
diff --git a/src/plugin-luacd.cc b/src/plugin-luacd.cc
new file mode 100644
index 0000000..5b10abc
--- /dev/null
+++ b/src/plugin-luacd.cc
@@ -0,0 +1,18 @@
+#include <BLua.h>
+#include <luacd.h>
+
+static void _init_plugin(Lua * L) {
+ static bool done = false;
+ if (done) return;
+ done = true;
+ CD_PUSHSTATICS(L);
+}
+
+
+extern "C" {
+
+void luacd_init(Lua * L) {
+ _init_plugin(L);
+}
+
+}
diff --git a/src/plugin-luapsx.cc b/src/plugin-luapsx.cc
new file mode 100644
index 0000000..e1f820c
--- /dev/null
+++ b/src/plugin-luapsx.cc
@@ -0,0 +1,13 @@
+#include <BLua.h>
+#include <luapsx.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ static bool done = false;
+ if (done) return;
+ done = true;
+ Luapsx::pushstatics(L);
+}
+
+}