From 465f35169f96c5e157a76058070ed12f19243d62 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 2 May 2009 04:39:05 +0000 Subject: [PATCH] And that's dev9, which was about as barebones as CDVDnull. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1111 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/CDVDnull/configure.ac | 4 +- plugins/dev9null/DEV9.cpp | 160 ++++++++++++++++++ plugins/dev9null/DEV9.h | 39 +++++ plugins/dev9null/Linux/Config.cpp | 79 +++++++++ plugins/dev9null/Makefile.am | 27 +++ .../{src => Windows}/DEV9null_vc2008.vcproj | 0 .../{src => Windows}/ProjectRootDir.vsprops | 0 .../dev9null/{src => Windows}/dev9null.def | 0 plugins/dev9null/build.sh | 33 +++- plugins/dev9null/configure.ac | 80 +++++++++ plugins/dev9null/install-sh | 1 + plugins/dev9null/missing | 1 + plugins/dev9null/src/DEV9.h | 17 -- plugins/dev9null/src/Makefile | 23 --- plugins/dev9null/src/dev9null.c | 152 ----------------- 15 files changed, 415 insertions(+), 201 deletions(-) create mode 100644 plugins/dev9null/DEV9.cpp create mode 100644 plugins/dev9null/DEV9.h create mode 100644 plugins/dev9null/Linux/Config.cpp create mode 100644 plugins/dev9null/Makefile.am rename plugins/dev9null/{src => Windows}/DEV9null_vc2008.vcproj (100%) rename plugins/dev9null/{src => Windows}/ProjectRootDir.vsprops (100%) rename plugins/dev9null/{src => Windows}/dev9null.def (100%) create mode 100644 plugins/dev9null/configure.ac create mode 120000 plugins/dev9null/install-sh create mode 120000 plugins/dev9null/missing delete mode 100644 plugins/dev9null/src/DEV9.h delete mode 100644 plugins/dev9null/src/Makefile delete mode 100644 plugins/dev9null/src/dev9null.c diff --git a/plugins/CDVDnull/configure.ac b/plugins/CDVDnull/configure.ac index 3953dd00f6..0ef1c2ae4c 100644 --- a/plugins/CDVDnull/configure.ac +++ b/plugins/CDVDnull/configure.ac @@ -1,6 +1,6 @@ -AC_INIT(CDVDnull, 0.5,arcum42@gmail.com) +AC_INIT(CDVDnull, 0.6,arcum42@gmail.com) -AM_INIT_AUTOMAKE(CDVDnull,0.7) +AM_INIT_AUTOMAKE(CDVDnull,0.6) AC_PROG_CC([gcc g++ cl KCC CC cxx cc++ xlC aCC c++]) AC_PROG_CXX([gcc g++ cl KCC CC cxx cc++ xlC aCC c++]) diff --git a/plugins/dev9null/DEV9.cpp b/plugins/dev9null/DEV9.cpp new file mode 100644 index 0000000000..0120d77f9d --- /dev/null +++ b/plugins/dev9null/DEV9.cpp @@ -0,0 +1,160 @@ +/* DEV9null + * Copyright (C) 2002-2009 Pcsx2 Team + * + * 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 +#include +#include +#include +#include "PS2Etypes.h" +#include "DEV9.h" + +const unsigned char version = PS2E_DEV9_VERSION; +const unsigned char revision = 0; +const unsigned char build = 4; // increase that with each version + +const char *libraryName = "DEV9null Driver"; + +void (*DEV9irq)(); +FILE *dev9Log; + +EXPORT_C_(u32) PS2EgetLibType() +{ + return PS2E_LT_DEV9; +} + +EXPORT_C_(char*) PS2EgetLibName() +{ + return (char *)libraryName; +} + +EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) +{ + return (version<<16) | (revision<<8) | build; +} + +void __Log(char *fmt, ...) +{ + va_list list; + + va_start(list, fmt); + vfprintf(dev9Log, fmt, list); + va_end(list); +} + +EXPORT_C_(s32) DEV9init() +{ + return 0; +} + +EXPORT_C_(void) DEV9shutdown() +{ +} + +EXPORT_C_(s32) DEV9open(void *pDsp) +{ + return 0; +} + +EXPORT_C_(void) DEV9close() +{ + +} + +EXPORT_C_(u8) DEV9read8(u32 addr) +{ + return 0; +} + +EXPORT_C_(u16 ) DEV9read16(u32 addr) +{ + return 0; +} + +EXPORT_C_(u32 ) DEV9read32(u32 addr) +{ + return 0; +} + +EXPORT_C_(void) DEV9write8(u32 addr, u8 value) +{ +} + +EXPORT_C_(void) DEV9write16(u32 addr, u16 value) +{ +} + +EXPORT_C_(void) DEV9write32(u32 addr, u32 value) +{ +} + +EXPORT_C_(void) DEV9readDMA8Mem(u32 *pMem, int size) +{ +} + +EXPORT_C_(void) DEV9writeDMA8Mem(u32* pMem, int size) +{ +} + +EXPORT_C_(void) DEV9irqCallback(DEV9callback callback) +{ + +} + +EXPORT_C_(DEV9handler) DEV9irqHandler(void) +{ + return NULL; +} + +// extended funcs + +EXPORT_C_(s32) DEV9test() +{ + return 0; +} + +EXPORT_C_(void) DEV9configure() +{ + SysMessage("Nothing to Configure"); +} + +EXPORT_C_(void) DEV9about() +{ +} + +#ifdef _WIN32 + +HINSTANCE hInst; + +void SysMessage(char *fmt, ...) +{ + va_list list; + char tmp[512]; + va_start(list,fmt); + vsprintf(tmp,fmt,list); + va_end(list); + MessageBox(0, tmp, "DEV9null Msg", 0); +} + +BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT + DWORD dwReason, + LPVOID lpReserved) { + hInst = (HINSTANCE)hModule; + return TRUE; // very quick :) +} + +#endif diff --git a/plugins/dev9null/DEV9.h b/plugins/dev9null/DEV9.h new file mode 100644 index 0000000000..a46501a56e --- /dev/null +++ b/plugins/dev9null/DEV9.h @@ -0,0 +1,39 @@ +#ifndef __DEV9_H__ +#define __DEV9_H__ + +#include + +#ifdef __LINUX__ +#include +#else +#include +#include +#include +#endif + +extern "C" +{ +#define DEV9defs +#include "PS2Edefs.h" +} + +#ifdef _MSC_VER +#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK +#else +#define EXPORT_C_(type) extern "C" type +#endif + +extern const unsigned char version; +extern const unsigned char revision; +extern const unsigned char build; +extern const unsigned int minor; +extern const char *libraryName; + +extern void (*DEV9irq)(); +extern void SysMessage(const char *fmt, ...); + +extern FILE *dev9Log; +void __Log(char *fmt, ...); + + +#endif diff --git a/plugins/dev9null/Linux/Config.cpp b/plugins/dev9null/Linux/Config.cpp new file mode 100644 index 0000000000..89b686d779 --- /dev/null +++ b/plugins/dev9null/Linux/Config.cpp @@ -0,0 +1,79 @@ +/* DEV9null + * Copyright (C) 2002-2009 Pcsx2 Team + * + * 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 "DEV9.h" + + +#include +#include +#include +#include + +GtkWidget *MsgDlg; + +void OnMsg_Ok() +{ + gtk_widget_destroy(MsgDlg); + gtk_main_quit(); +} + +void SysMessage(const char *fmt, ...) +{ + GtkWidget *Ok, *Txt; + GtkWidget *Box, *Box1; + va_list list; + char msg[512]; + + va_start(list, fmt); + vsprintf(msg, fmt, list); + va_end(list); + + if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0; + + MsgDlg = gtk_window_new(GTK_WINDOW_POPUP); + gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER); + gtk_window_set_title(GTK_WINDOW(MsgDlg), "SPU2null Msg"); + gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5); + + Box = gtk_vbox_new(5, 0); + gtk_container_add(GTK_CONTAINER(MsgDlg), Box); + gtk_widget_show(Box); + + Txt = gtk_label_new(msg); + + gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5); + gtk_widget_show(Txt); + + Box1 = gtk_hbutton_box_new(); + gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0); + gtk_widget_show(Box1); + + Ok = gtk_button_new_with_label("Ok"); + gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL); + gtk_container_add(GTK_CONTAINER(Box1), Ok); + GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT); + gtk_widget_show(Ok); + + gtk_widget_show(MsgDlg); + + gtk_main(); +} + +void LoadConfig() +{ +} diff --git a/plugins/dev9null/Makefile.am b/plugins/dev9null/Makefile.am new file mode 100644 index 0000000000..708b882df6 --- /dev/null +++ b/plugins/dev9null/Makefile.am @@ -0,0 +1,27 @@ +# Create a shared library libDEV9null +AUTOMAKE_OPTIONS = foreign +noinst_LIBRARIES = libDEV9null.a +INCLUDES = -I@srcdir@/../../common/include -I@srcdir@/../../3rdparty -I@srcdir@/Linux + +libDEV9null_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0) +libDEV9null_a_CFLAGS = $(shell pkg-config --cflags gtk+-2.0) + +# Create a shared object by faking an exe (thanks to ODE makefiles) +traplibdir=$(prefix) + +if DEBUGBUILD +preext=d +endif + +EXEEXT=$(preext)@so_ext@ + +traplib_PROGRAMS=libDEV9null +libDEV9null_SOURCES= +libDEV9null_DEPENDENCIES = libDEV9null.a +libDEV9null_LDFLAGS= @SHARED_LDFLAGS@ +libDEV9null_LDFLAGS+=-Wl,-soname,@libDEV9null_SONAME@ +libDEV9null_LDADD=$(libDEV9null_a_OBJECTS) + +libDEV9null_a_SOURCES = DEV9.cpp DEV9.h Linux/Config.cpp + +#SUBDIRS = Linux \ No newline at end of file diff --git a/plugins/dev9null/src/DEV9null_vc2008.vcproj b/plugins/dev9null/Windows/DEV9null_vc2008.vcproj similarity index 100% rename from plugins/dev9null/src/DEV9null_vc2008.vcproj rename to plugins/dev9null/Windows/DEV9null_vc2008.vcproj diff --git a/plugins/dev9null/src/ProjectRootDir.vsprops b/plugins/dev9null/Windows/ProjectRootDir.vsprops similarity index 100% rename from plugins/dev9null/src/ProjectRootDir.vsprops rename to plugins/dev9null/Windows/ProjectRootDir.vsprops diff --git a/plugins/dev9null/src/dev9null.def b/plugins/dev9null/Windows/dev9null.def similarity index 100% rename from plugins/dev9null/src/dev9null.def rename to plugins/dev9null/Windows/dev9null.def diff --git a/plugins/dev9null/build.sh b/plugins/dev9null/build.sh index 321284aa69..231a06d3c9 100644 --- a/plugins/dev9null/build.sh +++ b/plugins/dev9null/build.sh @@ -1,13 +1,32 @@ #!/bin/sh -echo ----------------- -echo Building dev9null -echo ----------------- +echo --------------- +echo Building DEV9null +echo --------------- curdir=`pwd` -cd ${curdir}/src -make clean -make $@ -cp libDEV9null.so ${PCSX2PLUGINS} +if test "${DEV9nullOPTIONS+set}" != set ; then +export DEV9nullOPTIONS="" +fi + +if [ $# -gt 0 ] && [ $1 = "all" ] +then + +aclocal +automake -a +autoconf + +./configure ${DEV9nullOPTIONS} --prefix=${PCSX2PLUGINS} +make clean +make install + +else +make $@ +fi + +if [ $? -ne 0 ] +then +exit 1 +fi diff --git a/plugins/dev9null/configure.ac b/plugins/dev9null/configure.ac new file mode 100644 index 0000000000..f2573aa6d2 --- /dev/null +++ b/plugins/dev9null/configure.ac @@ -0,0 +1,80 @@ +AC_INIT(DEV9null, 0.4,arcum42@gmail.com) + +AM_INIT_AUTOMAKE(DEV9null,0.4) + +AC_PROG_CC([gcc g++ cl KCC CC cxx cc++ xlC aCC c++]) +AC_PROG_CXX([gcc g++ cl KCC CC cxx cc++ xlC aCC c++]) +AC_PROG_CPP([gcc g++ cl KCC CC cxx cc++ xlC aCC c++]) + +AC_PROG_INSTALL +AC_PROG_RANLIB + +dnl necessary for compiling assembly +AM_PROG_AS + +AC_SUBST(DEV9null_CURRENT, 0) +AC_SUBST(DEV9null_REVISION, 8) +AC_SUBST(DEV9null_AGE, 0) +AC_SUBST(DEV9null_RELEASE,[$DEV9null_CURRENT].[$DEV9null_REVISION].[$DEV9null_AGE]) +AC_SUBST(DEV9null_SONAME,libDEV9null.so.[$DEV9null_CURRENT].[$DEV9null_REVISION].[$DEV9null_AGE]) + +CFLAGS= +CPPFLAGS= +CXXFLAGS= + +dnl Check for debug build +AC_MSG_CHECKING(debug build) +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]), +debug=$enableval,debug=no) +if test "x$debug" == xyes +then + AC_DEFINE(_DEBUG,1,[_DEBUG]) + CFLAGS+="-g -fPIC -Wall -Wno-unused-value " + CPPFLAGS+="-g -fPIC -Wall -Wno-unused-value " + CXXFLAGS+="-g -fPIC -Wall -Wno-unused-value " +else + AC_DEFINE(NDEBUG,1,[NDEBUG]) + CFLAGS+="-O3 -fomit-frame-pointer -fPIC -Wall -Wno-unused-value " + CPPFLAGS+="-O3 -fomit-frame-pointer -fPIC -Wall -Wno-unused-value " + CXXFLAGS+="-O3 -fomit-frame-pointer -fPIC -Wall -Wno-unused-value " +fi +AM_CONDITIONAL(DEBUGBUILD, test x$debug = xyes) +AC_MSG_RESULT($debug) + +AC_DEFINE(__LINUX__,1,[__LINUX__]) + +dnl Check for dev build +AC_MSG_CHECKING(for development build...) +AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]), + devbuild=$enableval,devbuild=no) +if test "x$devbuild" == xyes +then + AC_DEFINE(DEV9null_DEVBUILD,1,[DEV9null_DEVBUILD]) +fi +AC_MSG_RESULT($devbuild) +AM_CONDITIONAL(RELEASE_TO_PUBLIC, test x$devbuild = xno) + +AC_CHECK_FUNCS([ _aligned_malloc _aligned_free ], AC_DEFINE(HAVE_ALIGNED_MALLOC)) + +dnl gtk +AC_MSG_CHECKING(gtk2+) +AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config) +LIBS+=$(pkg-config --libs gtk+-2.0) + +dnl bindir = pcsx2exe + +dnl assuming linux environment +so_ext=".so.$DEV9null_RELEASE" +SHARED_LDFLAGS="-shared" +AC_SUBST(so_ext) +AC_SUBST(SHARED_LDFLAGS) + +AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"]) + +AC_OUTPUT([ + Makefile + ]) + +echo "Configuration:" +echo " Debug build? $debug" +echo " Dev build? $devbuild" \ No newline at end of file diff --git a/plugins/dev9null/install-sh b/plugins/dev9null/install-sh new file mode 120000 index 0000000000..8272958b56 --- /dev/null +++ b/plugins/dev9null/install-sh @@ -0,0 +1 @@ +/usr/share/automake-1.10/install-sh \ No newline at end of file diff --git a/plugins/dev9null/missing b/plugins/dev9null/missing new file mode 120000 index 0000000000..1f0fe88e65 --- /dev/null +++ b/plugins/dev9null/missing @@ -0,0 +1 @@ +/usr/share/automake-1.10/missing \ No newline at end of file diff --git a/plugins/dev9null/src/DEV9.h b/plugins/dev9null/src/DEV9.h deleted file mode 100644 index a3b475d6c6..0000000000 --- a/plugins/dev9null/src/DEV9.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __DEV9_H__ -#define __DEV9_H__ - -#include - -#define DEV9defs - -#include "PS2Edefs.h" - - -FILE *dev9Log; -void __Log(char *fmt, ...); -void (*DEV9irq)(); -void SysMessage(char *fmt, ...); - - -#endif diff --git a/plugins/dev9null/src/Makefile b/plugins/dev9null/src/Makefile deleted file mode 100644 index d0fa8ea301..0000000000 --- a/plugins/dev9null/src/Makefile +++ /dev/null @@ -1,23 +0,0 @@ - -CC = gcc - -PLUGIN = libDEV9null.so -CFLAGS+= -fPIC -Wall -O2 -fomit-frame-pointer -D__LINUX__ -I../../../common/include -OBJS = dev9null.o -DEPS:= $(OBJS:.o=.d) - -all: plugin -install: all - -plugin: ${OBJS} - rm -f ${PLUGIN} - gcc -shared -Wl,-soname,${PLUGIN} ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS} - strip --strip-unneeded --strip-debug ${PLUGIN} - -clean: - rm -f ${OBJS} ${DEPS} - -%.o: %.c - ${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@) - --include ${DEPS} diff --git a/plugins/dev9null/src/dev9null.c b/plugins/dev9null/src/dev9null.c deleted file mode 100644 index 85b1d998be..0000000000 --- a/plugins/dev9null/src/dev9null.c +++ /dev/null @@ -1,152 +0,0 @@ - - -#ifdef _WIN32 - -#include -#include -#include - -#endif - -#include -#include -#include -#include -#include "PS2Etypes.h" -#include "DEV9.h" - -#ifdef _WIN32 - -HINSTANCE hInst; - -void SysMessage(char *fmt, ...) { - va_list list; - char tmp[512]; - va_start(list,fmt); - vsprintf(tmp,fmt,list); - va_end(list); - MessageBox(0, tmp, "DEV9null Msg", 0); -} - -#else - -#include - -void SysMessage(char *fmt, ...) { -} - -#endif - -const unsigned char version = PS2E_DEV9_VERSION; -const unsigned char revision = 0; -const unsigned char build = 3; // increase that with each version - -static char *libraryName = "DEV9null Driver"; - -u32 CALLBACK PS2EgetLibType() { - return PS2E_LT_DEV9; -} - -char* CALLBACK PS2EgetLibName() { - return libraryName; -} - -u32 CALLBACK PS2EgetLibVersion2(u32 type) { - return (version<<16) | (revision<<8) | build; -} - -void __Log(char *fmt, ...) { - va_list list; - -// if (!Log) return; - - va_start(list, fmt); - vfprintf(dev9Log, fmt, list); - va_end(list); -} - -s32 CALLBACK DEV9init() { - - return 0; -} - -void CALLBACK DEV9shutdown() { -} - -s32 CALLBACK DEV9open(void *pDsp) { - -#ifdef _WIN32 -#else - Display* dsp = *(Display**)pDsp; -#endif - return 0; -} - -void CALLBACK DEV9close() { - -} - - -u8 CALLBACK DEV9read8(u32 addr) { - return 0; -} - -u16 CALLBACK DEV9read16(u32 addr) { - return 0; -} - -u32 CALLBACK DEV9read32(u32 addr) { - return 0; -} - -void CALLBACK DEV9write8(u32 addr, u8 value) { -} - -void CALLBACK DEV9write16(u32 addr, u16 value) { - -} - -void CALLBACK DEV9write32(u32 addr, u32 value) { - -} - -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size) { - -} - -void CALLBACK DEV9writeDMA8Mem(u32* pMem, int size) { - -} - - -void CALLBACK DEV9irqCallback(DEV9callback callback) { - -} - -DEV9handler CALLBACK DEV9irqHandler(void) { - return NULL; -} - - -// extended funcs - -s32 CALLBACK DEV9test() { - return 0; -} - -void CALLBACK DEV9configure() -{ - SysMessage("Nothing to Configure"); -} -void CALLBACK DEV9about(){} - -#ifdef _WIN32 - -BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT - DWORD dwReason, - LPVOID lpReserved) { - hInst = (HINSTANCE)hModule; - return TRUE; // very quick :) -} - -#endif