And that's CDVDnull. Given how barebones this plugin is, it's closer to making a null plugin then cleaning it up...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1110 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-02 04:12:29 +00:00
parent 456672168e
commit 6cc85d6050
15 changed files with 408 additions and 214 deletions

140
plugins/CDVDnull/CDVD.cpp Normal file
View File

@ -0,0 +1,140 @@
/* CDVDnull
* 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 <stdio.h>
#include "CDVD.h"
const char *LibName = "CDVDnull Driver";
const unsigned char version = PS2E_CDVD_VERSION;
const unsigned char revision = 0;
const unsigned char build = 6;
EXPORT_C_(char*) PS2EgetLibName()
{
return (char *)LibName;
}
EXPORT_C_(u32) PS2EgetLibType()
{
return PS2E_LT_CDVD;
}
EXPORT_C_(u32) CALLBACK PS2EgetLibVersion2(u32 type)
{
return (version << 16) | (revision << 8) | build;
}
#ifdef _WIN32
void SysMessage(const char *fmt, ...)
{
va_list list;
char tmp[512];
va_start(list, fmt);
vsprintf(tmp, fmt, list);
va_end(list);
MessageBox(0, tmp, "CDVDnull Msg", 0);
}
#endif
EXPORT_C_(s32) CDVDinit()
{
return 0;
}
EXPORT_C_(s32) CDVDopen(const char* pTitle)
{
return 0;
}
EXPORT_C_(void) CDVDclose()
{
}
EXPORT_C_(void) CDVDshutdown()
{
}
EXPORT_C_(s32) CDVDreadTrack(u32 lsn, int mode)
{
return -1;
}
// return can be NULL (for async modes)
EXPORT_C_(u8*) CDVDgetBuffer()
{
return NULL;
}
EXPORT_C_(s32) CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
{
return -1;
}
EXPORT_C_(s32) CDVDgetTN(cdvdTN *Buffer)
{
return -1;
}
EXPORT_C_(s32) CDVDgetTD(u8 Track, cdvdTD *Buffer)
{
return -1;
}
EXPORT_C_(s32) CDVDgetTOC(void* toc)
{
return -1;
}
EXPORT_C_(s32) CDVDgetDiskType()
{
return CDVD_TYPE_NODISC;
}
EXPORT_C_(s32) CDVDgetTrayStatus()
{
return CDVD_TRAY_CLOSE;
}
EXPORT_C_(s32) CDVDctrlTrayOpen()
{
return 0;
}
EXPORT_C_(s32) CDVDctrlTrayClose()
{
return 0;
}
EXPORT_C_(void) CDVDconfigure()
{
SysMessage("Nothing to Configure");
}
EXPORT_C_(void) CDVDabout()
{
SysMessage("%s %d.%d", LibName, revision, build);
}
EXPORT_C_(s32) CDVDtest()
{
return 0;
}

52
plugins/CDVDnull/CDVD.h Normal file
View File

@ -0,0 +1,52 @@
/* CDVDnull
* 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
*/
#ifndef __CDVD_H__
#define __CDVD_H__
#ifdef _WIN32
#include <windows.h>
#endif
extern "C"
{
#define CDVDdefs
#include "PS2Edefs.h"
}
#ifdef __LINUX__
#include <gtk/gtk.h>
#else
#include <windows.h>
#include <windowsx.h>
#endif
#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 *LibName;
extern void SysMessage(const char *fmt, ...);
#endif /* __CDVD_H__ */

View File

@ -0,0 +1,78 @@
/* CDVDnull
* 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 "CDVD.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
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()
{
}

View File

@ -0,0 +1,27 @@
# Create a shared library libCDVDnull
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libCDVDnull.a
INCLUDES = -I@srcdir@/../../common/include -I@srcdir@/../../3rdparty -I@srcdir@/Linux
libCDVDnull_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libCDVDnull_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=libCDVDnull
libCDVDnull_SOURCES=
libCDVDnull_DEPENDENCIES = libCDVDnull.a
libCDVDnull_LDFLAGS= @SHARED_LDFLAGS@
libCDVDnull_LDFLAGS+=-Wl,-soname,@libCDVDnull_SONAME@
libCDVDnull_LDADD=$(libCDVDnull_a_OBJECTS)
libCDVDnull_a_SOURCES = CDVD.cpp CDVD.h Linux/Config.cpp
#SUBDIRS = Linux

View File

@ -1,145 +0,0 @@
#include <stdio.h>
#include "CDVD.h"
char *LibName = "CDVDnull Driver";
const unsigned char version = PS2E_CDVD_VERSION;
const unsigned char revision = 0;
const unsigned char build = 6;
char* CALLBACK PS2EgetLibName() {
return LibName;
}
u32 CALLBACK PS2EgetLibType() {
return PS2E_LT_CDVD;
}
u32 CALLBACK PS2EgetLibVersion2(u32 type) {
return (version << 16) | (revision << 8) | build;
}
#ifdef _WIN32
void SysMessage(char *fmt, ...) {
va_list list;
char tmp[512];
va_start(list,fmt);
vsprintf(tmp,fmt,list);
va_end(list);
MessageBox(0, tmp, "CDVDnull Msg", 0);
}
#else
void SysMessage(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), "GSsoft 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();*/
}
#endif
s32 CALLBACK CDVDinit() {
return 0;
}
s32 CALLBACK CDVDopen(const char* pTitle) {
return 0;
}
void CALLBACK CDVDclose() {
}
void CALLBACK CDVDshutdown() {
}
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) {
return -1;
}
// return can be NULL (for async modes)
u8* CALLBACK CDVDgetBuffer() {
return NULL;
}
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) {
return -1;
}
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer) {
return -1;
}
s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer) {
return -1;
}
s32 CALLBACK CDVDgetTOC(void* toc) {
return -1;
}
s32 CALLBACK CDVDgetDiskType() {
return CDVD_TYPE_NODISC;
}
s32 CALLBACK CDVDgetTrayStatus() {
return CDVD_TRAY_CLOSE;
}
s32 CALLBACK CDVDctrlTrayOpen() {
return 0;
}
s32 CALLBACK CDVDctrlTrayClose() {
return 0;
}
void CALLBACK CDVDconfigure() {
SysMessage("Nothing to Configure");
}
void CALLBACK CDVDabout() {
SysMessage("%s %d.%d", LibName, revision, build);
}
s32 CALLBACK CDVDtest() {
return 0;
}

View File

@ -1,11 +0,0 @@
#ifndef __CDVD_H__
#define __CDVD_H__
#ifdef _WIN32
#include <windows.h>
#endif
#define CDVDdefs
#include "PS2Edefs.h"
#endif /* __CDVD_H__ */

View File

@ -1,48 +0,0 @@
#
# Makefile for MINGW32
#
all: cdvdnull
install: all
PLUGIN = libCDVDnull.so
CC = gcc
NASM = nasmw
RM = rm -f
AR = ar
STRIP = strip
RC = windres
OPTIMIZE = -O2 -fomit-frame-pointer -finline-functions -ffast-math -fno-strict-aliasing
FLAGS = -DENABLE_NLS -DPACKAGE=\"pcsx2\"
RC1FLAGS =
LIBS =
RESOBJ = cdvdnull.o
OBJS = CDVD.o
DEPS:= $(OBJS:.o=.d)
CFLAGS = -Wall ${OPTIMIZE} -I../../../common/include -I. -I/usr/local/include ${FLAGS} -fPIC
cdvdnull: ${OBJS}
# dllwrap --def plugin.def -o ${PLUGIN} ${OBJS} ${LIBS}
${CC} -shared -Wl,-soname,${PLUGIN} ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS}
${STRIP} ${PLUGIN}
.PHONY: clean cdvdnull
clean:
${RM} ${OBJS} ${DEPS} ${PCSX2}
%.o: %.asm
${NASM} ${ASMFLAGS} -o $@ $<
%.o: %.c
${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@)
${RESOBJ}: CDVDnull.rc
${RC} -D__MINGW32__ -I rc -O coff -o $@ -i $<
-include ${DEPS}

View File

@ -102,11 +102,11 @@
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\CDVD.c"
RelativePath="..\CDVD.cpp"
>
</File>
<File
RelativePath=".\CDVD.h"
RelativePath="..\CDVD.h"
>
</File>
<File

View File

@ -1,13 +1,32 @@
#!/bin/sh
echo ---------------
echo Building CDVDnull
echo ---------------
curdir=`pwd`
echo -----------------
echo Building CDVDnull
echo -----------------
cd ${curdir}/Src
make clean
make $@
# copy the files
cp libCDVDnull.so ${PCSX2PLUGINS}
if test "${CDVDnullOPTIONS+set}" != set ; then
export CDVDnullOPTIONS=""
fi
if [ $# -gt 0 ] && [ $1 = "all" ]
then
aclocal
automake -a
autoconf
./configure ${CDVDnullOPTIONS} --prefix=${PCSX2PLUGINS}
make clean
make install
else
make $@
fi
if [ $? -ne 0 ]
then
exit 1
fi

View File

@ -0,0 +1,80 @@
AC_INIT(CDVDnull, 0.5,arcum42@gmail.com)
AM_INIT_AUTOMAKE(CDVDnull,0.7)
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(CDVDnull_CURRENT, 0)
AC_SUBST(CDVDnull_REVISION, 8)
AC_SUBST(CDVDnull_AGE, 0)
AC_SUBST(CDVDnull_RELEASE,[$CDVDnull_CURRENT].[$CDVDnull_REVISION].[$CDVDnull_AGE])
AC_SUBST(CDVDnull_SONAME,libCDVDnull.so.[$CDVDnull_CURRENT].[$CDVDnull_REVISION].[$CDVDnull_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(CDVDnull_DEVBUILD,1,[CDVDnull_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.$CDVDnull_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"

1
plugins/CDVDnull/install-sh Symbolic link
View File

@ -0,0 +1 @@
/usr/share/automake-1.10/install-sh

1
plugins/CDVDnull/missing Symbolic link
View File

@ -0,0 +1 @@
/usr/share/automake-1.10/missing