That's USBnull down. (And yes, I'm aware the dialog boxes for USBnull & FWnull are incorrect. For now, I just told it to use the incorrect one that was already in the plugin.)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1107 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-02 02:29:48 +00:00
parent f64723951e
commit 6fb0070c33
20 changed files with 954 additions and 815 deletions

View File

@ -28,43 +28,6 @@
#include "FW.h"
#include "Config.h"
int ExecCfg(char *arg)
{
/*char cfg[256];
struct stat buf;
strcpy(cfg, "./cfgFWnull");
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
strcpy(cfg, "./plugins/cfgFWnull");
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
strcpy(cfg, "./cfg/cfgFWnull");
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
sprintf(cfg, "%s/cfgFWnull", getenv("HOME"));
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
printf("cfgFWnull file not found!\n");
return -1;*/
}
void SysMessage(char *fmt, ...)
{
va_list list;
@ -75,28 +38,16 @@ void SysMessage(char *fmt, ...)
vsprintf(msg, fmt, list);
va_end(list);
//sprintf(cmd, "message \"%s\"", msg);
cfgSysMessage(msg);
//ExecCfg(cmd);
}
void FWconfigure()
{
//char *file;
//getcwd(file, ArraySize(file));
//chdir("plugins");
//ExecCfg("configure");
//chdir(file);
CFGconfigure();
}
void FWabout()
{
//char *file;
//getcwd(file, ArraySize(file));
//chdir("plugins");
//ExecCfg("about");
//chdir(file);
CFGabout();
}

View File

@ -1,35 +0,0 @@
PLUGIN = libFWnull.so
CFG = cfgFWnull
CFLAGS+= -fPIC -Wall -I. -I.. -I../../../common/include -O3 -fomit-frame-pointer -fno-strict-aliasing
OBJS = ../FW.o
OBJS+= Linux.o Config.o
CFGOBJS = conf.o interface.o support.o Config.o
DEPS:= $(OBJS:.o=.d)
CFGDEPS:= $(CFGOBJS:.o=.d)
LIBS = -lpthread
CFLAGS+= $(shell pkg-config --cflags gtk+-2.0) -D__LINUX__
CFGLIBS = $(shell pkg-config --libs gtk+-2.0)
CC = gcc
all: plugin cfg
install: all
plugin: ${OBJS}
rm -f ${PLUGIN}
${CC} -shared -Wl,-soname,${PLUGIN} ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS}
strip --strip-unneeded --strip-debug ${PLUGIN}
cfg: ${CFGOBJS}
rm -f ${CFG}
${CC} ${CFLAGS} ${CFGOBJS} -o ${CFG} ${CFGLIBS}
strip ${CFG}
clean:
rm -f ${OBJS} ${DEPS} ${CFGOBJS} ${CFGDEPS} ${PLUGIN} ${CFG}
%.o: %.c
${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@)
-include ${DEPS}

View File

@ -1,59 +0,0 @@
/* USBnull
* Copyright (C) 2002-2004 USBnull 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 <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "USB.h"
void LoadConfig() {
/* FILE *f;
char cfg[256];
sprintf(cfg, "%s/.PS2E/CDVDiso.cfg", getenv("HOME"));
f = fopen(cfg, "r");
if (f == NULL) {
strcpy(IsoFile, DEV_DEF);
strcpy(CdDev, CDDEV_DEF);
return;
}
fscanf(f, "IsoFile = %[^\n]\n", IsoFile);
fscanf(f, "CdDev = %[^\n]\n", CdDev);
if (!strncmp(IsoFile, "CdDev =", 9)) *IsoFile = 0; // quick fix
if (*CdDev == 0) strcpy(CdDev, CDDEV_DEF);
fclose(f);*/
}
void SaveConfig() {
/* FILE *f;
char cfg[256];
sprintf(cfg, "%s/.PS2E", getenv("HOME"));
mkdir(cfg, 0755);
sprintf(cfg, "%s/.PS2E/CDVDiso.cfg", getenv("HOME"));
f = fopen(cfg, "w");
if (f == NULL)
return;
fprintf(f, "IsoFile = %s\n", IsoFile);
fprintf(f, "CdDev = %s\n", CdDev);
fclose(f);*/
}

View File

@ -1,5 +1,5 @@
/* USBnull
* Copyright (C) 2002-2004 USBnull Team
* Copyright (C) 2002-2009 USBnull 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
@ -20,23 +20,34 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <gtk/gtk.h>
#include <signal.h>
#include <string>
using namespace std;
extern "C"
{
#include "interface.h"
#include "support.h"
#include "callbacks.h"
//#include "callbacks.h"
}
GtkWidget *MsgDlg;
#include "USB.h"
void OnMsg_Ok() {
GtkWidget *MsgDlg, *About, *Conf;
extern string s_strIniPath;
void OnMsg_Ok()
{
gtk_widget_destroy(MsgDlg);
gtk_main_quit();
}
void cfgSysMessage(char *fmt, ...) {
GtkWidget *Ok,*Txt;
GtkWidget *Box,*Box1;
void cfgSysMessage(char *fmt, ...)
{
GtkWidget *Ok, *Txt;
GtkWidget *Box, *Box1;
va_list list;
char msg[512];
@ -46,7 +57,7 @@ void cfgSysMessage(char *fmt, ...) {
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
MsgDlg = gtk_window_new (GTK_WINDOW_POPUP);
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), "USBnull Msg");
gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5);
@ -56,7 +67,7 @@ void cfgSysMessage(char *fmt, ...) {
gtk_widget_show(Box);
Txt = gtk_label_new(msg);
gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5);
gtk_widget_show(Txt);
@ -65,64 +76,87 @@ void cfgSysMessage(char *fmt, ...) {
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_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_widget_show(MsgDlg);
gtk_main();
}
GtkWidget *About;
void OnAbout_Ok(GtkButton *button, gpointer user_data) {
void OnAbout_Ok(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(About);
gtk_main_quit();
}
void CFGabout() {
void CFGabout()
{
About = create_About();
gtk_widget_show_all(About);
gtk_main();
}
GtkWidget *Conf;
void OnConf_Ok(GtkButton *button, gpointer user_data) {
void OnConf_Ok(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(Conf);
gtk_main_quit();
}
void OnConf_Cancel(GtkButton *button, gpointer user_data) {
void OnConf_Cancel(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(Conf);
gtk_main_quit();
}
void CFGconfigure() {
void CFGconfigure()
{
Conf = create_Config();
gtk_widget_show_all(Conf);
gtk_main();
}
long CFGmessage(char *msg) {
long CFGmessage(char *msg)
{
cfgSysMessage(msg);
return 0;
}
int main(int argc, char *argv[]) {
gtk_init(NULL, NULL);
void LoadConfig()
{
FILE *f;
char cfg[255];
if (!strcmp(argv[1], "configure")) {
CFGconfigure();
} else if (!strcmp(argv[1], "about")) {
CFGabout();
} else if (!strcmp(argv[1], "message")) {
CFGmessage(argv[2]);
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "r");
if (f == NULL)
{
printf("failed to open %s\n", s_strIniPath.c_str());
SaveConfig();//save and return
return;
}
return 0;
//fscanf(f, "options = %hhx\n", &confOptions);
fclose(f);
}
void SaveConfig()
{
FILE *f;
char cfg[255];
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg,"w");
if (f == NULL)
{
printf("failed to open %s\n", s_strIniPath.c_str());
return;
}
//fprintf(f, "options = %hhx\n", confOptions);
fclose(f);
}

View File

@ -1,5 +1,5 @@
/* USBnull
* Copyright (C) 2002-2004 USBnull Team
* Copyright (C) 2002-2009 USBnull 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
@ -18,3 +18,7 @@
void SaveConfig();
void LoadConfig();
void cfgSysMessage(char *fmt, ...);
void CFGabout();
void CFGconfigure();
long CFGmessage(char *msg);

View File

@ -1,5 +1,5 @@
/* USBnull
* Copyright (C) 2002-2004 USBnull Team
* Copyright (C) 2002-2009 USBnull 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
@ -15,7 +15,7 @@
* 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 <stdarg.h>
#include <stdlib.h>
@ -26,43 +26,7 @@
#include <unistd.h>
#include "USB.h"
int ExecCfg(char *arg)
{
char cfg[256];
struct stat buf;
strcpy(cfg, "./cfgUSBnull");
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
strcpy(cfg, "./plugins/cfgUSBnull");
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
strcpy(cfg, "./cfg/cfgUSBnull");
if (stat(cfg, &buf) != -1)
{ sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
sprintf(cfg, "%s/cfgUSBnull", getenv("HOME"));
if (stat(cfg, &buf) != -1)
{
sprintf(cfg, "%s %s", cfg, arg);
return system(cfg);
}
printf("cfgUSBnull file not found!\n");
return -1;
}
#include "Config.h"
void SysMessage(char *fmt, ...)
{
@ -74,25 +38,16 @@ void SysMessage(char *fmt, ...)
vsprintf(msg, fmt, list);
va_end(list);
sprintf(cmd, "message \"%s\"", msg);
ExecCfg(cmd);
cfgSysMessage(msg);
}
void USBconfigure()
{
char *file;
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("configure");
chdir(file);
CFGconfigure();
}
void USBabout()
{
char *file;
getcwd(file, ArraySize(file));
chdir("plugins");
ExecCfg("about");
chdir(file);
CFGabout();
}

View File

@ -0,0 +1,17 @@
/* USBnull
* Copyright (C) 2002-2009 USBnull 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
*/

View File

@ -1,35 +0,0 @@
PLUGIN = libUSBnull.so
CFG = cfgUSBnull
CFLAGS+= -fPIC -Wall -I. -I.. -I../../../common/include -O3 -fomit-frame-pointer -fno-strict-aliasing
OBJS = ../USB.o
OBJS+= Config.o Linux.o
CFGOBJS = conf.o interface.o support.o
DEPS:= $(OBJS:.o=.d)
CFGDEPS:= $(CFGOBJS:.o=.d)
LIBS = -lpthread
CFLAGS+= $(shell pkg-config --cflags gtk+-2.0) -D__LINUX__
CFGLIBS = $(shell pkg-config --libs gtk+-2.0)
CC = gcc
all: plugin cfg
install: all
plugin: ${OBJS}
# rm -f ${PLUGIN}
${CC} -shared -Wl,-soname,${PLUGIN} ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS}
strip --strip-unneeded --strip-debug ${PLUGIN}
cfg: ${CFGOBJS}
# rm -f ${CFG}
${CC} ${CFLAGS} ${CFGOBJS} -o ${CFG} ${CFGLIBS}
strip ${CFG}
clean:
rm -f ${OBJS} ${CFGOBJS} ${CFGDEPS} ${PLUGIN} ${CFG}
%.o: %.c
${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@)
#-include ${DEPS}

View File

@ -10,6 +10,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@ -18,6 +19,13 @@
#include "interface.h"
#include "support.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
GtkWidget*
create_Config (void)
{
@ -27,131 +35,146 @@ create_Config (void)
GtkWidget *hbox1;
GtkWidget *label4;
GtkWidget *GtkCombo_Eth;
GList *GtkCombo_Eth_items = NULL;
GtkWidget *combo_entry1;
GtkWidget *label1;
GtkWidget *frame3;
GtkWidget *hbox2;
GtkWidget *label5;
GtkWidget *GtkCombo_Hdd;
GList *GtkCombo_Hdd_items = NULL;
GtkWidget *entry1;
GtkWidget *label15;
GtkWidget *hbuttonbox1;
GtkWidget *button1;
GtkWidget *button2;
Config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (Config), "Config", Config);
gtk_widget_set_name (Config, "Config");
gtk_container_set_border_width (GTK_CONTAINER (Config), 5);
gtk_window_set_title (GTK_WINDOW (Config), "DEV9config");
gtk_window_set_position (GTK_WINDOW (Config), GTK_WIN_POS_CENTER);
gtk_window_set_title (GTK_WINDOW (Config), _("DEV9config"));
vbox1 = gtk_vbox_new (FALSE, 5);
gtk_widget_ref (vbox1);
gtk_object_set_data_full (GTK_OBJECT (Config), "vbox1", vbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (vbox1, "vbox1");
gtk_widget_show (vbox1);
gtk_container_add (GTK_CONTAINER (Config), vbox1);
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);
frame2 = gtk_frame_new ("Ethernet");
gtk_widget_ref (frame2);
gtk_object_set_data_full (GTK_OBJECT (Config), "frame2", frame2,
(GtkDestroyNotify) gtk_widget_unref);
frame2 = gtk_frame_new (NULL);
gtk_widget_set_name (frame2, "frame2");
gtk_widget_show (frame2);
gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0);
hbox1 = gtk_hbox_new (TRUE, 5);
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (Config), "hbox1", hbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (hbox1, "hbox1");
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (frame2), hbox1);
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);
label4 = gtk_label_new ("Device:");
gtk_widget_ref (label4);
gtk_object_set_data_full (GTK_OBJECT (Config), "label4", label4,
(GtkDestroyNotify) gtk_widget_unref);
label4 = gtk_label_new (_("Device:"));
gtk_widget_set_name (label4, "label4");
gtk_widget_show (label4);
gtk_box_pack_start (GTK_BOX (hbox1), label4, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER);
GtkCombo_Eth = gtk_combo_new ();
gtk_widget_ref (GtkCombo_Eth);
gtk_object_set_data_full (GTK_OBJECT (Config), "GtkCombo_Eth", GtkCombo_Eth,
(GtkDestroyNotify) gtk_widget_unref);
g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Eth)->popwin),
"GladeParentKey", GtkCombo_Eth);
gtk_widget_set_name (GtkCombo_Eth, "GtkCombo_Eth");
gtk_widget_show (GtkCombo_Eth);
gtk_box_pack_start (GTK_BOX (hbox1), GtkCombo_Eth, FALSE, FALSE, 0);
gtk_widget_set_usize (GtkCombo_Eth, 130, -2);
GtkCombo_Eth_items = g_list_append (GtkCombo_Eth_items, (gpointer) "");
gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Eth), GtkCombo_Eth_items);
g_list_free (GtkCombo_Eth_items);
combo_entry1 = GTK_COMBO (GtkCombo_Eth)->entry;
gtk_widget_ref (combo_entry1);
gtk_object_set_data_full (GTK_OBJECT (Config), "combo_entry1", combo_entry1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (combo_entry1, "combo_entry1");
gtk_widget_show (combo_entry1);
frame3 = gtk_frame_new ("Hdd");
gtk_widget_ref (frame3);
gtk_object_set_data_full (GTK_OBJECT (Config), "frame3", frame3,
(GtkDestroyNotify) gtk_widget_unref);
label1 = gtk_label_new (_("Ethernet"));
gtk_widget_set_name (label1, "label1");
gtk_widget_show (label1);
gtk_frame_set_label_widget (GTK_FRAME (frame2), label1);
frame3 = gtk_frame_new (NULL);
gtk_widget_set_name (frame3, "frame3");
gtk_widget_show (frame3);
gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0);
hbox2 = gtk_hbox_new (TRUE, 5);
gtk_widget_ref (hbox2);
gtk_object_set_data_full (GTK_OBJECT (Config), "hbox2", hbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (hbox2, "hbox2");
gtk_widget_show (hbox2);
gtk_container_add (GTK_CONTAINER (frame3), hbox2);
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5);
label5 = gtk_label_new ("Device:");
gtk_widget_ref (label5);
gtk_object_set_data_full (GTK_OBJECT (Config), "label5", label5,
(GtkDestroyNotify) gtk_widget_unref);
label5 = gtk_label_new (_("Device:"));
gtk_widget_set_name (label5, "label5");
gtk_widget_show (label5);
gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_CENTER);
GtkCombo_Hdd = gtk_combo_new ();
gtk_widget_ref (GtkCombo_Hdd);
gtk_object_set_data_full (GTK_OBJECT (Config), "GtkCombo_Hdd", GtkCombo_Hdd,
(GtkDestroyNotify) gtk_widget_unref);
g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Hdd)->popwin),
"GladeParentKey", GtkCombo_Hdd);
gtk_widget_set_name (GtkCombo_Hdd, "GtkCombo_Hdd");
gtk_widget_show (GtkCombo_Hdd);
gtk_box_pack_start (GTK_BOX (hbox2), GtkCombo_Hdd, FALSE, FALSE, 0);
gtk_widget_set_usize (GtkCombo_Hdd, 130, -2);
GtkCombo_Hdd_items = g_list_append (GtkCombo_Hdd_items, (gpointer) "");
gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Hdd), GtkCombo_Hdd_items);
g_list_free (GtkCombo_Hdd_items);
entry1 = GTK_COMBO (GtkCombo_Hdd)->entry;
gtk_widget_ref (entry1);
gtk_object_set_data_full (GTK_OBJECT (Config), "entry1", entry1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (entry1, "entry1");
gtk_widget_show (entry1);
label15 = gtk_label_new (_("Hdd"));
gtk_widget_set_name (label15, "label15");
gtk_widget_show (label15);
gtk_frame_set_label_widget (GTK_FRAME (frame3), label15);
hbuttonbox1 = gtk_hbutton_box_new ();
gtk_widget_ref (hbuttonbox1);
gtk_object_set_data_full (GTK_OBJECT (Config), "hbuttonbox1", hbuttonbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
gtk_widget_show (hbuttonbox1);
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0);
gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30);
button1 = gtk_button_new_with_label ("Ok");
gtk_widget_ref (button1);
gtk_object_set_data_full (GTK_OBJECT (Config), "button1", button1,
(GtkDestroyNotify) gtk_widget_unref);
button1 = gtk_button_new_with_mnemonic (_("Ok"));
gtk_widget_set_name (button1, "button1");
gtk_widget_show (button1);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
button2 = gtk_button_new_with_label ("Cancel");
gtk_widget_ref (button2);
gtk_object_set_data_full (GTK_OBJECT (Config), "button2", button2,
(GtkDestroyNotify) gtk_widget_unref);
button2 = gtk_button_new_with_mnemonic (_("Cancel"));
gtk_widget_set_name (button2, "button2");
gtk_widget_show (button2);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2);
GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button1), "clicked",
GTK_SIGNAL_FUNC (OnConf_Ok),
NULL);
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
GTK_SIGNAL_FUNC (OnConf_Cancel),
NULL);
g_signal_connect ((gpointer) button1, "clicked",
G_CALLBACK (OnConf_Ok),
NULL);
g_signal_connect ((gpointer) button2, "clicked",
G_CALLBACK (OnConf_Cancel),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config");
GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1");
GLADE_HOOKUP_OBJECT (Config, frame2, "frame2");
GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1");
GLADE_HOOKUP_OBJECT (Config, label4, "label4");
GLADE_HOOKUP_OBJECT (Config, GtkCombo_Eth, "GtkCombo_Eth");
GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1");
GLADE_HOOKUP_OBJECT (Config, label1, "label1");
GLADE_HOOKUP_OBJECT (Config, frame3, "frame3");
GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2");
GLADE_HOOKUP_OBJECT (Config, label5, "label5");
GLADE_HOOKUP_OBJECT (Config, GtkCombo_Hdd, "GtkCombo_Hdd");
GLADE_HOOKUP_OBJECT (Config, entry1, "entry1");
GLADE_HOOKUP_OBJECT (Config, label15, "label15");
GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1");
GLADE_HOOKUP_OBJECT (Config, button1, "button1");
GLADE_HOOKUP_OBJECT (Config, button2, "button2");
return Config;
}
@ -167,52 +190,50 @@ create_About (void)
GtkWidget *button3;
About = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (About), "About", About);
gtk_widget_set_name (About, "About");
gtk_container_set_border_width (GTK_CONTAINER (About), 5);
gtk_window_set_title (GTK_WINDOW (About), "DEV9about");
gtk_window_set_position (GTK_WINDOW (About), GTK_WIN_POS_CENTER);
gtk_window_set_title (GTK_WINDOW (About), _("DEV9about"));
vbox2 = gtk_vbox_new (FALSE, 5);
gtk_widget_ref (vbox2);
gtk_object_set_data_full (GTK_OBJECT (About), "vbox2", vbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (vbox2, "vbox2");
gtk_widget_show (vbox2);
gtk_container_add (GTK_CONTAINER (About), vbox2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5);
label2 = gtk_label_new ("DEV9linuz Driver");
gtk_widget_ref (label2);
gtk_object_set_data_full (GTK_OBJECT (About), "label2", label2,
(GtkDestroyNotify) gtk_widget_unref);
label2 = gtk_label_new (_("FireWire Driver"));
gtk_widget_set_name (label2, "label2");
gtk_widget_show (label2);
gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);
label3 = gtk_label_new ("Author: linuzappz <linuzappz@hotmail.com>");
gtk_widget_ref (label3);
gtk_object_set_data_full (GTK_OBJECT (About), "label3", label3,
(GtkDestroyNotify) gtk_widget_unref);
label3 = gtk_label_new (_("Author: linuzappz <linuzappz@hotmail.com>"));
gtk_widget_set_name (label3, "label3");
gtk_widget_show (label3);
gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
hbuttonbox2 = gtk_hbutton_box_new ();
gtk_widget_ref (hbuttonbox2);
gtk_object_set_data_full (GTK_OBJECT (About), "hbuttonbox2", hbuttonbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_name (hbuttonbox2, "hbuttonbox2");
gtk_widget_show (hbuttonbox2);
gtk_box_pack_start (GTK_BOX (vbox2), hbuttonbox2, TRUE, TRUE, 0);
gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30);
button3 = gtk_button_new_with_label ("Ok");
gtk_widget_ref (button3);
gtk_object_set_data_full (GTK_OBJECT (About), "button3", button3,
(GtkDestroyNotify) gtk_widget_unref);
button3 = gtk_button_new_with_mnemonic (_("Ok"));
gtk_widget_set_name (button3, "button3");
gtk_widget_show (button3);
gtk_container_add (GTK_CONTAINER (hbuttonbox2), button3);
GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button3), "clicked",
GTK_SIGNAL_FUNC (OnAbout_Ok),
NULL);
g_signal_connect ((gpointer) button3, "clicked",
G_CALLBACK (OnAbout_Ok),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About");
GLADE_HOOKUP_OBJECT (About, vbox2, "vbox2");
GLADE_HOOKUP_OBJECT (About, label2, "label2");
GLADE_HOOKUP_OBJECT (About, label3, "label3");
GLADE_HOOKUP_OBJECT (About, hbuttonbox2, "hbuttonbox2");
GLADE_HOOKUP_OBJECT (About, button3, "button3");
return About;
}

View File

@ -10,18 +10,12 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "support.h"
/* This is an internally used function to check if a pixmap file exists. */
static gchar* check_file_exists (const gchar *directory,
const gchar *filename);
/* This is an internally used function to create pixmaps. */
static GtkWidget* create_dummy_pixmap (GtkWidget *widget);
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
@ -34,47 +28,20 @@ lookup_widget (GtkWidget *widget,
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (!parent)
parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
widget_name);
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
/* This is a dummy pixmap we use when a pixmap can't be found. */
static char *dummy_pixmap_xpm[] = {
/* columns rows colors chars-per-pixel */
"1 1 1 1",
" c None",
/* pixels */
" "
};
/* This is an internally used function to create pixmaps. */
static GtkWidget*
create_dummy_pixmap (GtkWidget *widget)
{
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
NULL, dummy_pixmap_xpm);
if (gdkpixmap == NULL)
g_error ("Couldn't create replacement pixmap.");
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
@ -85,78 +52,93 @@ add_pixmap_directory (const gchar *directory)
g_strdup (directory));
}
/* This is an internally used function to find pixmap files. */
static gchar*
find_pixmap_file (const gchar *filename)
{
GList *elem;
/* We step through each of the pixmaps directory to find it. */
elem = pixmaps_directories;
while (elem)
{
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
G_DIR_SEPARATOR_S, filename);
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
return pathname;
g_free (pathname);
elem = elem->next;
}
return NULL;
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *found_filename = NULL;
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
gchar *pathname = NULL;
GtkWidget *pixmap;
GList *elem;
if (!filename || !filename[0])
return create_dummy_pixmap (widget);
return gtk_image_new ();
/* We first try any pixmaps directories set by the application. */
elem = pixmaps_directories;
while (elem)
pathname = find_pixmap_file (filename);
if (!pathname)
{
found_filename = check_file_exists ((gchar*)elem->data, filename);
if (found_filename)
break;
elem = elem->next;
g_warning (_("Couldn't find pixmap file: %s"), filename);
return gtk_image_new ();
}
/* If we haven't found the pixmap, try the source directory. */
if (!found_filename)
{
found_filename = check_file_exists ("pixmaps", filename);
}
if (!found_filename)
{
g_warning ("Couldn't find pixmap file: %s", filename);
return create_dummy_pixmap (widget);
}
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
NULL, found_filename);
if (gdkpixmap == NULL)
{
g_warning ("Error loading pixmap file: %s", found_filename);
g_free (found_filename);
return create_dummy_pixmap (widget);
}
g_free (found_filename);
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
pixmap = gtk_image_new_from_file (pathname);
g_free (pathname);
return pixmap;
}
/* This is an internally used function to check if a pixmap file exists. */
static gchar*
check_file_exists (const gchar *directory,
const gchar *filename)
/* This is an internally used function to create pixmaps. */
GdkPixbuf*
create_pixbuf (const gchar *filename)
{
gchar *full_filename;
struct stat s;
gint status;
gchar *pathname = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
full_filename = (gchar*) g_malloc (strlen (directory) + 1
+ strlen (filename) + 1);
strcpy (full_filename, directory);
strcat (full_filename, G_DIR_SEPARATOR_S);
strcat (full_filename, filename);
if (!filename || !filename[0])
return NULL;
status = stat (full_filename, &s);
if (status == 0 && S_ISREG (s.st_mode))
return full_filename;
g_free (full_filename);
return NULL;
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return NULL;
}
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
if (!pixbuf)
{
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
pathname, error->message);
g_error_free (error);
}
g_free (pathname);
return pixbuf;
}
/* This is used to set ATK action descriptions. */
void
glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description)
{
gint n_actions, i;
n_actions = atk_action_get_n_actions (action);
for (i = 0; i < n_actions; i++)
{
if (!strcmp (atk_action_get_name (action, i), action_name))
atk_action_set_description (action, i, description);
}
}

View File

@ -8,6 +8,31 @@
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# define Q_(String) g_strip_context ((String), gettext (String))
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define Q_(String) g_strip_context ((String), (String))
# define N_(String) (String)
#endif
/*
* Public Functions.
*/
@ -21,8 +46,6 @@
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* get_widget() is deprecated. Use lookup_widget instead. */
#define get_widget lookup_widget
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
@ -32,7 +55,15 @@ void add_pixmap_directory (const gchar *directory);
* Private Functions.
*/
/* This is used to create the pixmaps in the interface. */
/* This is used to create the pixmaps used in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
/* This is used to create the pixbufs used in the interface. */
GdkPixbuf* create_pixbuf (const gchar *filename);
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description);

View File

@ -1,300 +1,443 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>FireWire</name>
<program_name>dev9linuz</program_name>
<directory></directory>
<source_directory></source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>False</gnome_support>
<gettext_support>False</gettext_support>
<output_main_file>False</output_main_file>
<output_build_files>False</output_build_files>
<backup_source_files>False</backup_source_files>
</project>
<widget>
<class>GtkWindow</class>
<name>Config</name>
<border_width>5</border_width>
<title>DEV9config</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_CENTER</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<border_width>5</border_width>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<widget>
<class>GtkFrame</class>
<name>frame2</name>
<label>Ethernet</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox1</name>
<border_width>5</border_width>
<homogeneous>True</homogeneous>
<spacing>5</spacing>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<label>Device:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>GtkCombo_Eth</name>
<width>130</width>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>combo-entry1</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame3</name>
<label>Hdd</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<border_width>5</border_width>
<homogeneous>True</homogeneous>
<spacing>5</spacing>
<widget>
<class>GtkLabel</class>
<name>label5</name>
<label>Device:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>GtkCombo_Hdd</name>
<width>130</width>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>entry1</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkHButtonBox</class>
<name>hbuttonbox1</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>button1</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>OnConf_Ok</handler>
<last_modification_time>Sat, 06 Apr 2002 17:07:56 GMT</last_modification_time>
</signal>
<label>Ok</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>button2</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>OnConf_Cancel</handler>
<last_modification_time>Sat, 06 Apr 2002 17:08:08 GMT</last_modification_time>
</signal>
<label>Cancel</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkWindow</class>
<name>About</name>
<border_width>5</border_width>
<title>DEV9about</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_CENTER</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<name>vbox2</name>
<border_width>5</border_width>
<homogeneous>False</homogeneous>
<spacing>5</spacing>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>FireWire Driver</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<label>Author: linuzappz &lt;linuzappz@hotmail.com&gt;</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHButtonBox</class>
<name>hbuttonbox2</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>button3</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>OnAbout_Ok</handler>
<last_modification_time>Sun, 07 Apr 2002 03:43:49 GMT</last_modification_time>
</signal>
<label>Ok</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="Config">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="title" translatable="yes">DEV9config</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">Device:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="GtkCombo_Eth">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="convertwidget1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<child>
<widget class="GtkListItem" id="convertwidget2">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="convertwidget3">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Ethernet</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">Device:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="GtkCombo_Hdd">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="convertwidget4">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<child>
<widget class="GtkListItem" id="convertwidget5">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="convertwidget6">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="label" translatable="yes">Hdd</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">30</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Ok</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnConf_Ok"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Cancel</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnConf_Cancel"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="About">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="title" translatable="yes">DEV9about</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">FireWire Driver</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Author: linuzappz &lt;linuzappz@hotmail.com&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">30</property>
<child>
<widget class="GtkButton" id="button3">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Ok</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnAbout_Ok"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -0,0 +1,33 @@
# Create a shared library libUSBnull
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libUSBnull.a
INCLUDES = -I@srcdir@/../../common/include -I@srcdir@/../../3rdparty -I@srcdir@/Linux
libUSBnull_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
libUSBnull_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=libUSBnull
libUSBnull_SOURCES=
libUSBnull_DEPENDENCIES = libUSBnull.a
libUSBnull_LDFLAGS= @SHARED_LDFLAGS@
libUSBnull_LDFLAGS+=-Wl,-soname,@libUSBnull_SONAME@
libUSBnull_LDADD=$(libUSBnull_a_OBJECTS)
libUSBnull_a_SOURCES = USB.cpp Linux/Config.cpp Linux/Linux.cpp \
USB.h Linux/Config.h Linux/Linux.h
libUSBnull_a_SOURCES += \
Linux/interface.h Linux/support.c \
Linux/interface.c Linux/support.h \
Linux/callbacks.c Linux/callbacks.h
#SUBDIRS = Linux

View File

@ -19,30 +19,39 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <string>
using namespace std;
#include "USB.h"
string s_strIniPath;
const unsigned char version = PS2E_USB_VERSION;
const unsigned char revision = 0;
const unsigned char build = 5; // increase that with each version
const unsigned char build = 6; // increase that with each version
static char *libraryName = "USBnull Driver";
//void (*USBirq)();
USBcallback USBirq;
Config conf;
FILE *usbLog;
u32 CALLBACK PS2EgetLibType() {
EXPORT_C_(u32) PS2EgetLibType()
{
return PS2E_LT_USB;
}
char* CALLBACK PS2EgetLibName() {
EXPORT_C_(char*) PS2EgetLibName()
{
return libraryName;
}
u32 CALLBACK PS2EgetLibVersion2(u32 type) {
return (version<<16) | (revision<<8) | build;
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
{
return (version << 16) | (revision << 8) | build;
}
void __Log(char *fmt, ...) {
void __Log(char *fmt, ...)
{
va_list list;
if (!conf.Log || usbLog == NULL) return;
@ -52,119 +61,100 @@ void __Log(char *fmt, ...) {
va_end(list);
}
s32 CALLBACK USBinit() {
LoadConfig();
EXPORT_C_(s32) USBinit()
{
LoadConfig();
#ifdef USB_LOG
usbLog = fopen("logs/usbLog.txt", "w");
if (usbLog) setvbuf(usbLog, NULL, _IONBF, 0);
USB_LOG("usbnull plugin version %d,%d\n",revision,build);
USB_LOG("usbnull plugin version %d,%d\n", revision, build);
USB_LOG("USBinit\n");
#endif
return 0;
}
void CALLBACK USBshutdown() {
EXPORT_C_(void) USBshutdown()
{
#ifdef USB_LOG
if (usbLog) fclose(usbLog);
#endif
}
s32 CALLBACK USBopen(void *pDsp) {
#ifdef USB_LOG
EXPORT_C_(s32) USBopen(void *pDsp)
{
USB_LOG("USBopen\n");
#endif
#ifdef _WIN32
#else
Display* dsp = *(Display**)pDsp;
#endif
return 0;
}
void CALLBACK USBclose() {
EXPORT_C_(void) USBclose()
{
}
u8 CALLBACK USBread8(u32 addr) {
#ifdef USB_LOG
EXPORT_C_(u8 ) USBread8(u32 addr)
{
USB_LOG("*UnKnown 8bit read at address %lx ", addr);
#endif
return 0;
}
u16 CALLBACK USBread16(u32 addr) {
#ifdef USB_LOG
EXPORT_C_(u16) USBread16(u32 addr)
{
USB_LOG("*UnKnown 16bit read at address %lx", addr);
#endif
return 0;
}
u32 CALLBACK USBread32(u32 addr) {
#ifdef USB_LOG
EXPORT_C_(u32) USBread32(u32 addr)
{
USB_LOG("*UnKnown 32bit read at address %lx", addr);
#endif
return 0;
}
void CALLBACK USBwrite8(u32 addr, u8 value) {
#ifdef USB_LOG
EXPORT_C_(void) USBwrite8(u32 addr, u8 value)
{
USB_LOG("*UnKnown 8bit write at address %lx value %x\n", addr, value);
#endif
}
void CALLBACK USBwrite16(u32 addr, u16 value) {
#ifdef USB_LOG
EXPORT_C_(void) USBwrite16(u32 addr, u16 value)
{
USB_LOG("*UnKnown 16bit write at address %lx value %x\n", addr, value);
#endif
}
void CALLBACK USBwrite32(u32 addr, u32 value) {
#ifdef USB_LOG
EXPORT_C_(void) USBwrite32(u32 addr, u32 value)
{
USB_LOG("*UnKnown 32bit write at address %lx value %lx\n", addr, value);
#endif
}
void CALLBACK USBirqCallback(USBcallback callback) {
USBirq = callback;
EXPORT_C_(void) USBirqCallback(USBcallback callback)
{
USBirq = callback;
}
int CALLBACK _USBirqHandler(void) {
EXPORT_C_(int) _USBirqHandler(void)
{
return 0;
}
USBhandler CALLBACK USBirqHandler(void) {
EXPORT_C_(USBhandler) USBirqHandler(void)
{
return (USBhandler)_USBirqHandler;
}
void CALLBACK USBsetRAM(void *mem) {
EXPORT_C_(void) USBsetRAM(void *mem)
{
}
// extended funcs
s32 CALLBACK USBfreeze(int mode, freezeData *data) {
EXPORT_C_(s32) USBfreeze(int mode, freezeData *data)
{
return 0;
}
s32 CALLBACK USBtest() {
EXPORT_C_(s32) USBtest()
{
return 0;
}

View File

@ -22,8 +22,11 @@
#include <stdio.h>
extern "C"
{
#define USBdefs
#include "PS2Edefs.h"
}
#ifdef _WIN32
@ -46,19 +49,24 @@ typedef struct {
int Log;
} Config;
Config conf;
//extern void (*USBirq)();
extern USBcallback USBirq;
extern Config conf;
extern FILE *usbLog;
#ifdef _MSC_VER
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
#else
#define EXPORT_C_(type) extern "C" type
#endif
#define PSXCLK 36864000 /* 36.864 Mhz */
USBcallback USBirq;
void SaveConfig();
void LoadConfig();
FILE *usbLog;
void __Log(char *fmt, ...);
void SysMessage(char *fmt, ...);

View File

@ -161,7 +161,7 @@
>
</File>
<File
RelativePath="..\USB.c"
RelativePath="..\USB.cpp"
>
</File>
<File

View File

@ -1,20 +1,37 @@
#!/bin/sh
echo ----------------
echo ---------------
echo Building USBnull
echo ----------------
echo ---------------
curdir=`pwd`
cd ${curdir}/Linux
if test "${USBnullOPTIONS+set}" != set ; then
export USBnullOPTIONS=""
fi
if [ $# -gt 0 ] && [ $1 = "all" ]
then
aclocal
automake -a
autoconf
./configure ${USBnullOPTIONS} --prefix=${PCSX2PLUGINS}
make clean
make install
else
make $@
fi
if [ $? -ne 0 ]
then
exit 1
fi
if [ -s cfgUSBnull ] && [ -s libUSBnull.so ]
then
cp cfgUSBnull libUSBnull.so ${PCSX2PLUGINS}
fi
#if [ -s cfgFWnull ] && [ -s libUSBnull.so ]
#then
#cp cfgFWnull libFWnull.so ${PCSX2PLUGINS}
#fi

View File

@ -0,0 +1,80 @@
AC_INIT(USBnull, 0.5,arcum42@gmail.com)
AM_INIT_AUTOMAKE(USBnull,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++])
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(USBnull_CURRENT, 0)
AC_SUBST(USBnull_REVISION, 6)
AC_SUBST(USBnull_AGE, 0)
AC_SUBST(USBnull_RELEASE,[$USBnull_CURRENT].[$USBnull_REVISION].[$USBnull_AGE])
AC_SUBST(USBnull_SONAME,libUSBnull.so.[$USBnull_CURRENT].[$USBnull_REVISION].[$USBnull_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(USBnull_DEVBUILD,1,[USBnull_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.$USBnull_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/USBnull/install-sh Symbolic link
View File

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

1
plugins/USBnull/missing Symbolic link
View File

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