mirror of https://github.com/PCSX2/pcsx2.git
FWnull & USBnull have been converted to use PS2Enull.h as well.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2420 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
d6a1ff4a93
commit
20f5dbde3d
|
@ -0,0 +1,89 @@
|
|||
/* FWnull
|
||||
* Copyright (C) 2004-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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <signal.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "FW.h"
|
||||
#include "Config.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
extern PluginLog FWLog;
|
||||
PluginConf Ini;
|
||||
|
||||
void setLoggingState()
|
||||
{
|
||||
if (conf.Log)
|
||||
{
|
||||
FWLog.WriteToConsole = true;
|
||||
FWLog.WriteToFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FWLog.WriteToConsole = false;
|
||||
FWLog.WriteToFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWabout()
|
||||
{
|
||||
SysMessage("FWnull: A simple null plugin.");
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/FWnull.ini";
|
||||
if (!Ini.Open(IniPath, READ_FILE))
|
||||
{
|
||||
FWLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
conf.Log = Ini.ReadInt("logging");
|
||||
setLoggingState();
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/FWnull.ini";
|
||||
if (!Ini.Open(IniPath, WRITE_FILE))
|
||||
{
|
||||
FWLog.WriteLn("Failed to open %s\n", IniPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
void SaveConf();
|
||||
void LoadConf();
|
||||
void SysMessage(char *fmt, ...);
|
||||
void SysMessage(const char *fmt, ...);
|
||||
|
||||
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
|
@ -17,25 +17,23 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "FW.h"
|
||||
|
||||
const u8 version = PS2E_FW_VERSION;
|
||||
const u8 revision = 0;
|
||||
const u8 build = 5; // increase that with each version
|
||||
const u8 build = 6; // increase that with each version
|
||||
|
||||
static char *libraryName = "FWnull Driver";
|
||||
|
||||
s8 *fwregs;
|
||||
FILE *fwLog;
|
||||
Config conf;
|
||||
string s_strIniPath="inis/";
|
||||
|
||||
s8 *fwregs;
|
||||
Config conf;
|
||||
PluginLog FWLog;
|
||||
|
||||
void (*FWirq)();
|
||||
|
||||
EXPORT_C_(u32) PS2EgetLibType()
|
||||
|
@ -53,58 +51,43 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
|||
return (version<<16) | (revision<<8) | build;
|
||||
}
|
||||
|
||||
void __Log(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (!conf.Log || fwLog == NULL) return;
|
||||
|
||||
va_start(list, fmt);
|
||||
vfprintf(fwLog, fmt, list);
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) FWinit()
|
||||
{
|
||||
LoadConfig();
|
||||
|
||||
#ifdef FW_LOG
|
||||
fwLog = fopen("logs/fwLog.txt", "w");
|
||||
if (fwLog) setvbuf(fwLog, NULL, _IONBF, 0);
|
||||
FW_LOG("FWnull plugin version %d,%d\n",revision,build);
|
||||
FW_LOG("FW init\n");
|
||||
#endif
|
||||
setLoggingState();
|
||||
FWLog.Open("logs/FWnull.log");
|
||||
FWLog.WriteLn("FWnull plugin version %d,%d", revision, build);
|
||||
FWLog.WriteLn("Initializing FWnull");
|
||||
|
||||
// Initializing our registers.
|
||||
fwregs = (s8*)malloc(0x10000);
|
||||
if (fwregs == NULL)
|
||||
{
|
||||
SysMessage("Error allocating Memory\n");
|
||||
FWLog.Message("Error allocating Memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(fwregs, 0, 0x10000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWshutdown()
|
||||
{
|
||||
// Freeing the registers.
|
||||
free(fwregs);
|
||||
|
||||
#ifdef FW_LOG
|
||||
if (fwLog) fclose(fwLog);
|
||||
#endif
|
||||
FWLog.Close();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) FWopen(void *pDsp)
|
||||
{
|
||||
#ifdef FW_LOG
|
||||
FW_LOG("FW open\n");
|
||||
#endif
|
||||
FWLog.WriteLn("Opening FWnull.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWclose()
|
||||
{
|
||||
// Close the plugin.
|
||||
FWLog.WriteLn("Closing FWnull.");
|
||||
}
|
||||
|
||||
EXPORT_C_(u32) FWread32(u32 addr)
|
||||
|
@ -113,16 +96,19 @@ EXPORT_C_(u32) FWread32(u32 addr)
|
|||
|
||||
switch (addr)
|
||||
{
|
||||
// We should document what this location is.
|
||||
case 0x1f808410:
|
||||
ret = 0x8;
|
||||
break;
|
||||
|
||||
|
||||
// Include other relevant 32 bit addresses we need to catch here.
|
||||
default:
|
||||
// By default, read fwregs.
|
||||
ret = fwRu32(addr);
|
||||
break;
|
||||
}
|
||||
|
||||
FW_LOG("FW read mem 0x%x: 0x%x\n", addr, ret);
|
||||
FWLog.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -131,29 +117,58 @@ EXPORT_C_(void) FWwrite32(u32 addr, u32 value)
|
|||
{
|
||||
switch (addr)
|
||||
{
|
||||
// Include other memory locations we want to catch here.
|
||||
// For example:
|
||||
//
|
||||
// case 0x1f808400:
|
||||
// case 0x1f808414:
|
||||
// case 0x1f808420:
|
||||
// case 0x1f808428:
|
||||
// case 0x1f808430:
|
||||
//
|
||||
// Are addresses to look at.
|
||||
case 0x1f808410: fwRu32(addr) = value; break;
|
||||
default:
|
||||
// By default, just write it to fwregs.
|
||||
fwRu32(addr) = value;
|
||||
break;
|
||||
}
|
||||
FW_LOG("FW write mem 0x%x: 0x%x\n", addr, value);
|
||||
FWLog.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWirqCallback(void (*callback)())
|
||||
{
|
||||
// Register FWirq, so we can trigger an interrupt with it later.
|
||||
FWirq = callback;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWsetSettingsDir(const char* dir)
|
||||
{
|
||||
s_strIniPath = (dir==NULL) ? "inis/" : dir;
|
||||
// Find out from pcsx2 where we are supposed to put our ini file.
|
||||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) FWfreeze(int mode, freezeData *data)
|
||||
{
|
||||
// This should store or retrieve any information, for if emulation
|
||||
// gets suspended, or for savestates.
|
||||
switch(mode)
|
||||
{
|
||||
case FREEZE_LOAD:
|
||||
// Load previously saved data.
|
||||
break;
|
||||
case FREEZE_SAVE:
|
||||
// Save data.
|
||||
break;
|
||||
case FREEZE_SIZE:
|
||||
// return the size of the data.
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) FWtest()
|
||||
{
|
||||
// 0 if the plugin works, non-0 if it doesn't.
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,33 +23,10 @@
|
|||
|
||||
#define FWdefs
|
||||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#endif
|
||||
|
||||
/*#ifdef _MSC_VER
|
||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
||||
#else
|
||||
#define EXPORT_C_(type) extern "C" type
|
||||
#endif*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define EXPORT_C_(type) extern "C" type CALLBACK
|
||||
#else
|
||||
#define EXPORT_C_(type) extern "C" type
|
||||
#endif
|
||||
|
||||
#define FW_LOG __Log
|
||||
|
||||
// Our main memory storage, and defines for accessing it.
|
||||
extern s8 *fwregs;
|
||||
#define fwRs32(mem) (*(s32*)&fwregs[(mem) & 0xffff])
|
||||
#define fwRu32(mem) (*(u32*)&fwregs[(mem) & 0xffff])
|
||||
|
||||
|
@ -59,13 +36,11 @@ typedef struct
|
|||
} Config;
|
||||
|
||||
extern Config conf;
|
||||
extern FILE *fwLog;
|
||||
|
||||
extern void (*FWirq)();
|
||||
|
||||
extern void __Log(char *fmt, ...);
|
||||
extern void SysMessage(char *fmt, ...);
|
||||
extern void SaveConfig();
|
||||
extern void LoadConfig();
|
||||
extern void setLoggingState();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,168 +0,0 @@
|
|||
/* FWnull
|
||||
* Copyright (C) 2004-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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <signal.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "FW.h"
|
||||
#include "Config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget *MsgDlg, *About, *Conf;
|
||||
extern string s_strIniPath;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
gtk_widget_destroy(MsgDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
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), "FireWire 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 OnAbout_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_widget_destroy(About);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWabout()
|
||||
{
|
||||
About = create_About();
|
||||
gtk_widget_show_all(About);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void OnConf_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
conf.Log = is_checked(Conf, "check_logging");
|
||||
SaveConfig();
|
||||
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void OnConf_Cancel(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
EXPORT_C_(void) FWconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
Conf = create_Config();
|
||||
|
||||
set_checked(Conf, "check_logging", conf.Log);
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
|
||||
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;
|
||||
}
|
||||
fscanf(f, "logging = %hhx\n", &conf.Log);
|
||||
//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, "logging = %hhx\n", conf.Log);
|
||||
//fprintf(f, "options = %hhx\n", confOptions);
|
||||
fclose(f);
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="../../../bin/plugins/libFWnull.so.0.5.0" prefix_auto="0" extension_auto="0" />
|
||||
<Option output="../../../bin/plugins/libFWnull.so.0.6.0" prefix_auto="0" extension_auto="0" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
|
@ -45,16 +45,7 @@
|
|||
<Unit filename="../FW.h" />
|
||||
<Unit filename="Config.cpp" />
|
||||
<Unit filename="Config.h" />
|
||||
<Unit filename="callbacks.h" />
|
||||
<Unit filename="firewire.glade" />
|
||||
<Unit filename="interface.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="interface.h" />
|
||||
<Unit filename="support.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="support.h" />
|
||||
<Unit filename="../ReadMe.txt" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnAbout_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnAbout_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
|
@ -1,241 +0,0 @@
|
|||
<?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">FWconfig</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="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_NONE</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="check_logging">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Enable Logging</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Logging</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</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">FWabout</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">Original Author: linuzappz <linuzappz@hotmail.com>
|
||||
Revised by arcum42@gmail.com</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>
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#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)
|
||||
{
|
||||
GtkWidget *Config;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *frame3;
|
||||
GtkWidget *alignment1;
|
||||
GtkWidget *check_logging;
|
||||
GtkWidget *label15;
|
||||
GtkWidget *hbuttonbox1;
|
||||
GtkWidget *button1;
|
||||
GtkWidget *button2;
|
||||
|
||||
Config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (Config, "Config");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (Config), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (Config), _("FWconfig"));
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 5);
|
||||
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);
|
||||
|
||||
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);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE);
|
||||
|
||||
alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_widget_set_name (alignment1, "alignment1");
|
||||
gtk_widget_show (alignment1);
|
||||
gtk_container_add (GTK_CONTAINER (frame3), alignment1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
|
||||
|
||||
check_logging = gtk_check_button_new_with_mnemonic (_("Enable Logging"));
|
||||
gtk_widget_set_name (check_logging, "check_logging");
|
||||
gtk_widget_show (check_logging);
|
||||
gtk_container_add (GTK_CONTAINER (alignment1), check_logging);
|
||||
|
||||
label15 = gtk_label_new (_("<b>Logging</b>"));
|
||||
gtk_widget_set_name (label15, "label15");
|
||||
gtk_widget_show (label15);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame3), label15);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label15), TRUE);
|
||||
|
||||
hbuttonbox1 = gtk_hbutton_box_new ();
|
||||
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_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_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);
|
||||
|
||||
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, frame3, "frame3");
|
||||
GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1");
|
||||
GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging");
|
||||
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;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
create_About (void)
|
||||
{
|
||||
GtkWidget *About;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *label2;
|
||||
GtkWidget *label3;
|
||||
GtkWidget *hbuttonbox2;
|
||||
GtkWidget *button3;
|
||||
|
||||
About = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (About, "About");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (About), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (About), _("FWabout"));
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 5);
|
||||
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 (_("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 (_("Original Author: linuzappz <linuzappz@hotmail.com>\nRevised by arcum42@gmail.com"));
|
||||
gtk_widget_set_name (label3, "label3");
|
||||
gtk_widget_show (label3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0);
|
||||
|
||||
hbuttonbox2 = gtk_hbutton_box_new ();
|
||||
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_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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_Config (void);
|
||||
GtkWidget* create_About (void);
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "support.h"
|
||||
|
||||
GtkWidget*
|
||||
lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name)
|
||||
{
|
||||
GtkWidget *parent, *found_widget;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (GTK_IS_MENU (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*) g_object_get_data (G_OBJECT (widget),
|
||||
widget_name);
|
||||
if (!found_widget)
|
||||
g_warning ("Widget not found: %s", widget_name);
|
||||
return found_widget;
|
||||
}
|
||||
|
||||
static GList *pixmaps_directories = NULL;
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void
|
||||
add_pixmap_directory (const gchar *directory)
|
||||
{
|
||||
pixmaps_directories = g_list_prepend (pixmaps_directories,
|
||||
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 *pathname = NULL;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return gtk_image_new ();
|
||||
|
||||
pathname = find_pixmap_file (filename);
|
||||
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return gtk_image_new ();
|
||||
}
|
||||
|
||||
pixmap = gtk_image_new_from_file (pathname);
|
||||
g_free (pathname);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GdkPixbuf*
|
||||
create_pixbuf (const gchar *filename)
|
||||
{
|
||||
gchar *pathname = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function returns a widget in a component created by Glade.
|
||||
* Call it with the toplevel widget in the component (i.e. a window/dialog),
|
||||
* or alternatively any widget in the component, and the name of the widget
|
||||
* you want returned.
|
||||
*/
|
||||
GtkWidget* lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name);
|
||||
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void add_pixmap_directory (const gchar *directory);
|
||||
|
||||
|
||||
/*
|
||||
* Private Functions.
|
||||
*/
|
||||
|
||||
/* 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);
|
||||
|
|
@ -151,17 +151,13 @@
|
|||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Config.cpp"
|
||||
RelativePath="..\Config.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\FW.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Win32.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
@ -172,7 +168,7 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h"
|
||||
RelativePath="..\Config.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
@ -184,10 +180,6 @@
|
|||
RelativePath=".\FireWireNull.def"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FireWireNull.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/* 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
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "USB.h"
|
||||
#include "Config.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
extern PluginLog USBLog;
|
||||
PluginConf Ini;
|
||||
|
||||
void setLoggingState()
|
||||
{
|
||||
if (conf.Log)
|
||||
{
|
||||
USBLog.WriteToConsole = true;
|
||||
USBLog.WriteToFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
USBLog.WriteToConsole = false;
|
||||
USBLog.WriteToFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBabout()
|
||||
{
|
||||
SysMessage("USBnull: A simple null plugin.");
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/USBnull.ini";
|
||||
if (!Ini.Open(IniPath, READ_FILE))
|
||||
{
|
||||
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
conf.Log = Ini.ReadInt("logging");
|
||||
setLoggingState();
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
string IniPath = s_strIniPath + "/USBnull.ini";
|
||||
if (!Ini.Open(IniPath, WRITE_FILE))
|
||||
{
|
||||
USBLog.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
||||
|
|
@ -15,3 +15,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
|
@ -1,169 +0,0 @@
|
|||
/* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#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;
|
||||
|
||||
#include "USB.h"
|
||||
#include "Config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget *MsgDlg, *About, *Conf;
|
||||
extern string s_strIniPath;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
gtk_widget_destroy(MsgDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
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), "USBnull 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 OnAbout_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_widget_destroy(About);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBabout()
|
||||
{
|
||||
About = create_About();
|
||||
gtk_widget_show_all(About);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void OnConf_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
conf.Log = is_checked(Conf, "check_logging");
|
||||
SaveConfig();
|
||||
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void OnConf_Cancel(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
Conf = create_Config();
|
||||
|
||||
set_checked(Conf, "check_logging", conf.Log);
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
|
||||
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;
|
||||
}
|
||||
fscanf(f, "logging = %hhx\n", &conf.Log);
|
||||
//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, "logging = %hhx\n", conf.Log);
|
||||
//fprintf(f, "options = %hhx\n", confOptions);
|
||||
fclose(f);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/* 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
|
||||
*/
|
||||
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
|
@ -1,53 +0,0 @@
|
|||
/* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "USB.h"
|
||||
#include "Config.h"
|
||||
|
||||
/*void SysMessage(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[512];
|
||||
char cmd[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
cfgSysMessage(msg);
|
||||
}*/
|
||||
|
||||
/*void USBconfigure()
|
||||
{
|
||||
CFGconfigure();
|
||||
}
|
||||
|
||||
void USBabout()
|
||||
{
|
||||
CFGabout();
|
||||
}*/
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="../../../bin/plugins/libUSBnull.so.0.6.0" prefix_auto="0" extension_auto="0" />
|
||||
<Option output="../../../bin/plugins/libUSBnull.so.0.7.0" prefix_auto="0" extension_auto="0" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
|
@ -18,7 +18,7 @@
|
|||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="../../../bin/plugins/libUSBnull.so.0.6" prefix_auto="1" extension_auto="1" />
|
||||
<Option output="../../../bin/plugins/libUSBnull" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
|
@ -45,20 +45,8 @@
|
|||
<Add option="`pkg-config gtk+-2.0 --libs`" />
|
||||
<Add option="-shared" />
|
||||
</Linker>
|
||||
<Unit filename="Config.cpp" />
|
||||
<Unit filename="Config.h" />
|
||||
<Unit filename="Linux.cpp" />
|
||||
<Unit filename="Linux.h" />
|
||||
<Unit filename="callbacks.h" />
|
||||
<Unit filename="interface.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="interface.h" />
|
||||
<Unit filename="support.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="support.h" />
|
||||
<Unit filename="usbnull.glade" />
|
||||
<Unit filename="../Config.cpp" />
|
||||
<Unit filename="../Config.h" />
|
||||
<Unit filename="../ReadMe.txt" />
|
||||
<Unit filename="../USB.cpp" />
|
||||
<Unit filename="../USB.h" />
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnAbout_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnAbout_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
|
@ -1,172 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#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)
|
||||
{
|
||||
GtkWidget *Config;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *frame3;
|
||||
GtkWidget *alignment1;
|
||||
GtkWidget *check_logging;
|
||||
GtkWidget *label15;
|
||||
GtkWidget *hbuttonbox3;
|
||||
GtkWidget *button4;
|
||||
GtkWidget *button5;
|
||||
|
||||
Config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (Config, "Config");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (Config), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (Config), _("USBconfig"));
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 5);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_widget_set_name (alignment1, "alignment1");
|
||||
gtk_widget_show (alignment1);
|
||||
gtk_container_add (GTK_CONTAINER (frame3), alignment1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
|
||||
|
||||
check_logging = gtk_check_button_new_with_mnemonic (_("Enable Logging"));
|
||||
gtk_widget_set_name (check_logging, "check_logging");
|
||||
gtk_widget_show (check_logging);
|
||||
gtk_container_add (GTK_CONTAINER (alignment1), check_logging);
|
||||
|
||||
label15 = gtk_label_new (_("<b>Logging</b>"));
|
||||
gtk_widget_set_name (label15, "label15");
|
||||
gtk_widget_show (label15);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame3), label15);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label15), TRUE);
|
||||
|
||||
hbuttonbox3 = gtk_hbutton_box_new ();
|
||||
gtk_widget_set_name (hbuttonbox3, "hbuttonbox3");
|
||||
gtk_widget_show (hbuttonbox3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, TRUE, TRUE, 0);
|
||||
gtk_box_set_spacing (GTK_BOX (hbuttonbox3), 30);
|
||||
|
||||
button4 = gtk_button_new_with_mnemonic (_("Ok"));
|
||||
gtk_widget_set_name (button4, "button4");
|
||||
gtk_widget_show (button4);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox3), button4);
|
||||
GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT);
|
||||
|
||||
button5 = gtk_button_new_with_mnemonic (_("Cancel"));
|
||||
gtk_widget_set_name (button5, "button5");
|
||||
gtk_widget_show (button5);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox3), button5);
|
||||
GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);
|
||||
|
||||
g_signal_connect ((gpointer) button4, "clicked",
|
||||
G_CALLBACK (OnConf_Ok),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) button5, "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, frame3, "frame3");
|
||||
GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1");
|
||||
GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging");
|
||||
GLADE_HOOKUP_OBJECT (Config, label15, "label15");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbuttonbox3, "hbuttonbox3");
|
||||
GLADE_HOOKUP_OBJECT (Config, button4, "button4");
|
||||
GLADE_HOOKUP_OBJECT (Config, button5, "button5");
|
||||
|
||||
return Config;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
create_About (void)
|
||||
{
|
||||
GtkWidget *About;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *label2;
|
||||
GtkWidget *label3;
|
||||
GtkWidget *hbuttonbox2;
|
||||
GtkWidget *button3;
|
||||
|
||||
About = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (About, "About");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (About), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (About), _("DEV9about"));
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 5);
|
||||
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 (_("USB Null 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 (_("Original Author: linuzappz <linuzappz@hotmail.com>\nRevised by arcum42@gmail.com."));
|
||||
gtk_widget_set_name (label3, "label3");
|
||||
gtk_widget_show (label3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0);
|
||||
|
||||
hbuttonbox2 = gtk_hbutton_box_new ();
|
||||
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_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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_Config (void);
|
||||
GtkWidget* create_About (void);
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "support.h"
|
||||
|
||||
GtkWidget*
|
||||
lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name)
|
||||
{
|
||||
GtkWidget *parent, *found_widget;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (GTK_IS_MENU (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*) g_object_get_data (G_OBJECT (widget),
|
||||
widget_name);
|
||||
if (!found_widget)
|
||||
g_warning ("Widget not found: %s", widget_name);
|
||||
return found_widget;
|
||||
}
|
||||
|
||||
static GList *pixmaps_directories = NULL;
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void
|
||||
add_pixmap_directory (const gchar *directory)
|
||||
{
|
||||
pixmaps_directories = g_list_prepend (pixmaps_directories,
|
||||
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 *pathname = NULL;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return gtk_image_new ();
|
||||
|
||||
pathname = find_pixmap_file (filename);
|
||||
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return gtk_image_new ();
|
||||
}
|
||||
|
||||
pixmap = gtk_image_new_from_file (pathname);
|
||||
g_free (pathname);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GdkPixbuf*
|
||||
create_pixbuf (const gchar *filename)
|
||||
{
|
||||
gchar *pathname = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function returns a widget in a component created by Glade.
|
||||
* Call it with the toplevel widget in the component (i.e. a window/dialog),
|
||||
* or alternatively any widget in the component, and the name of the widget
|
||||
* you want returned.
|
||||
*/
|
||||
GtkWidget* lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name);
|
||||
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void add_pixmap_directory (const gchar *directory);
|
||||
|
||||
|
||||
/*
|
||||
* Private Functions.
|
||||
*/
|
||||
|
||||
/* 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);
|
||||
|
|
@ -1,241 +0,0 @@
|
|||
<?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">USBconfig</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="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="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="check_logging">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Enable Logging</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Logging</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</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="hbuttonbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">30</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button4">
|
||||
<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="button5">
|
||||
<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">USB Null 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">Original Author: linuzappz <linuzappz@hotmail.com>
|
||||
Revised by arcum42@gmail.com.</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>
|
|
@ -17,8 +17,6 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
@ -27,14 +25,15 @@ string s_strIniPath="inis/";
|
|||
|
||||
const unsigned char version = PS2E_USB_VERSION;
|
||||
const unsigned char revision = 0;
|
||||
const unsigned char build = 6; // increase that with each version
|
||||
const unsigned char build = 7; // increase that with each version
|
||||
|
||||
static char *libraryName = "USBnull Driver";
|
||||
|
||||
//void (*USBirq)();
|
||||
USBcallback USBirq;
|
||||
Config conf;
|
||||
FILE *usbLog;
|
||||
PluginLog USBLog;
|
||||
|
||||
s8 *usbregs, *ram;
|
||||
|
||||
EXPORT_C_(u32) PS2EgetLibType()
|
||||
{
|
||||
|
@ -51,104 +50,161 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
|||
return (version << 16) | (revision << 8) | build;
|
||||
}
|
||||
|
||||
void __Log(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (!conf.Log || usbLog == NULL) return;
|
||||
|
||||
va_start(list, fmt);
|
||||
vfprintf(usbLog, fmt, list);
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) USBinit()
|
||||
{
|
||||
LoadConfig();
|
||||
setLoggingState();
|
||||
USBLog.Open("logs/USBnull.log");
|
||||
USBLog.WriteLn("USBnull plugin version %d,%d", revision, build);
|
||||
USBLog.WriteLn("Initializing USBnull");
|
||||
|
||||
#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("USBinit\n");
|
||||
#endif
|
||||
|
||||
// Initialize memory structures here.
|
||||
usbregs = (s8*)malloc(0x10000);
|
||||
|
||||
if (usbregs == NULL)
|
||||
{
|
||||
USBLog.Message("Error allocating memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(usbregs, 0, 0x10000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBshutdown()
|
||||
{
|
||||
#ifdef USB_LOG
|
||||
if (usbLog) fclose(usbLog);
|
||||
#endif
|
||||
// Yes, we close things in the Shutdown routine, and
|
||||
// don't do anything in the close routine.
|
||||
USBLog.Close();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) USBopen(void *pDsp)
|
||||
{
|
||||
USB_LOG("USBopen\n");
|
||||
|
||||
USBLog.WriteLn("Opening USBnull.");
|
||||
|
||||
// Take care of anything else we need on opening, other then initialization.
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBclose()
|
||||
{
|
||||
USBLog.WriteLn("Closing USBnull.");
|
||||
}
|
||||
|
||||
EXPORT_C_(u8 ) USBread8(u32 addr)
|
||||
// Note: actually uncommenting the read/write functions I provided here
|
||||
// caused uLauncher.elf to hang on startup, so careful when experimenting.
|
||||
EXPORT_C_(u8) USBread8(u32 addr)
|
||||
{
|
||||
USB_LOG("*Unknown 8bit read at address %lx ", addr);
|
||||
return 0;
|
||||
u8 value = 0;
|
||||
|
||||
switch(addr)
|
||||
{
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600: USBLog.WriteLn("*Unknown 8 bit read at address %lx", addr); break;
|
||||
default:
|
||||
//value = usbRu8(addr);
|
||||
USBLog.WriteLn("*Unknown 8 bit read at address %lx", addr);
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
EXPORT_C_(u16) USBread16(u32 addr)
|
||||
{
|
||||
USB_LOG("*Unknown 16bit read at address %lx", addr);
|
||||
return 0;
|
||||
u16 value = 0;
|
||||
|
||||
switch(addr)
|
||||
{
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600: USBLog.WriteLn("*Unknown 16 bit read at address %lx", addr); break;
|
||||
default:
|
||||
//value = usbRu16(addr);
|
||||
USBLog.WriteLn("*Unknown 16 bit read at address %lx", addr);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
EXPORT_C_(u32) USBread32(u32 addr)
|
||||
{
|
||||
USB_LOG("*Unknown 32bit read at address %lx", addr);
|
||||
return 0;
|
||||
u32 value = 0;
|
||||
|
||||
switch(addr)
|
||||
{
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600: USBLog.WriteLn("*Unknown 32 bit read at address %lx", addr); break;
|
||||
default:
|
||||
//value = usbRu32(addr);
|
||||
USBLog.WriteLn("*Unknown 32 bit read at address %lx", addr);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBwrite8(u32 addr, u8 value)
|
||||
{
|
||||
USB_LOG("*Unknown 8bit write at address %lx value %x\n", addr, value);
|
||||
switch(addr)
|
||||
{
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600: USBLog.WriteLn("*Unknown 8 bit write at address %lx value %x", addr, value); break;
|
||||
default:
|
||||
//usbRu8(addr) = value;
|
||||
USBLog.WriteLn("*Unknown 8 bit write at address %lx value %x", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBwrite16(u32 addr, u16 value)
|
||||
{
|
||||
USB_LOG("*Unknown 16bit write at address %lx value %x\n", addr, value);
|
||||
switch(addr)
|
||||
{
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600: USBLog.WriteLn("*Unknown 8 bit write at address %lx value %x", addr, value); break;
|
||||
default:
|
||||
//usbRu16(addr) = value;
|
||||
USBLog.WriteLn("*Unknown 16 bit write at address %lx value %x", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBwrite32(u32 addr, u32 value)
|
||||
{
|
||||
USB_LOG("*Unknown 32bit write at address %lx value %lx\n", addr, value);
|
||||
switch(addr)
|
||||
{
|
||||
// Handle any appropriate addresses here.
|
||||
case 0x1f801600: USBLog.WriteLn("*Unknown 8 bit write at address %lx value %x", addr, value); break;
|
||||
default:
|
||||
//usbRu32(addr) = value;
|
||||
USBLog.WriteLn("*Unknown 32 bit write at address %lx value %x", addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBirqCallback(USBcallback callback)
|
||||
{
|
||||
USBirq = callback;
|
||||
// Register USBirq, so we can trigger an interrupt with it later.
|
||||
// It will be called as USBirq(cycles); where cycles is the number
|
||||
// of cycles before the irq is triggered.
|
||||
USBirq = callback;
|
||||
}
|
||||
|
||||
EXPORT_C_(int) _USBirqHandler(void)
|
||||
{
|
||||
// This is our USB irq handler, so if an interrupt gets triggered,
|
||||
// deal with it here.
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(USBhandler) USBirqHandler(void)
|
||||
{
|
||||
// Pass our handler to pcsx2.
|
||||
return (USBhandler)_USBirqHandler;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBsetRAM(void *mem)
|
||||
{
|
||||
USB_LOG("*Setting ram.\n");
|
||||
ram = (s8*)mem;
|
||||
USBLog.WriteLn("*Setting ram.");
|
||||
}
|
||||
|
||||
EXPORT_C_(void) USBsetSettingsDir(const char* dir)
|
||||
{
|
||||
// Get the path to the ini directory.
|
||||
s_strIniPath = (dir==NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
|
@ -156,12 +212,33 @@ EXPORT_C_(void) USBsetSettingsDir(const char* dir)
|
|||
|
||||
EXPORT_C_(s32) USBfreeze(int mode, freezeData *data)
|
||||
{
|
||||
// This should store or retrieve any information, for if emulation
|
||||
// gets suspended, or for savestates.
|
||||
switch(mode)
|
||||
{
|
||||
case FREEZE_LOAD:
|
||||
// Load previously saved data.
|
||||
break;
|
||||
case FREEZE_SAVE:
|
||||
// Save data.
|
||||
break;
|
||||
case FREEZE_SIZE:
|
||||
// return the size of the data.
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*EXPORT_C_(void) USBasync(u32 cycles)
|
||||
{
|
||||
// Optional function: Called in IopCounter.cpp.
|
||||
}*/
|
||||
|
||||
EXPORT_C_(s32) USBtest()
|
||||
{
|
||||
// 0 if the plugin works, non-0 if it doesn't.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For operating systems that need an entry point for a dll/library, here it is. Defined in PS2Eext.h. */
|
||||
ENTRY_POINT;
|
||||
|
|
|
@ -23,53 +23,29 @@
|
|||
|
||||
#define USBdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define usleep(x) Sleep(x / 1000)
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#define __inline inline
|
||||
|
||||
#endif
|
||||
|
||||
#define USB_LOG __Log
|
||||
#include "PS2Eext.h"
|
||||
|
||||
typedef struct {
|
||||
int Log;
|
||||
} Config;
|
||||
|
||||
//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*/
|
||||
// Previous USB plugins have needed this in ohci.
|
||||
static const s64 PSXCLK = 36864000; /* 36.864 Mhz */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define EXPORT_C_(type) extern "C" type CALLBACK
|
||||
#else
|
||||
#define EXPORT_C_(type) extern "C" type
|
||||
#endif
|
||||
extern s8 *usbregs, *ram;
|
||||
|
||||
#define PSXCLK 36864000 /* 36.864 Mhz */
|
||||
#define usbRs8(mem) usbregs[(mem) & 0xffff]
|
||||
#define usbRs16(mem) (*(s16*)&usbregs[(mem) & 0xffff])
|
||||
#define usbRs32(mem) (*(s32*)&usbregs[(mem) & 0xffff])
|
||||
#define usbRu8(mem) (*(u8*) &usbregs[(mem) & 0xffff])
|
||||
#define usbRu16(mem) (*(u16*)&usbregs[(mem) & 0xffff])
|
||||
#define usbRu32(mem) (*(u32*)&usbregs[(mem) & 0xffff])
|
||||
|
||||
|
||||
void SaveConfig();
|
||||
void LoadConfig();
|
||||
|
||||
void __Log(char *fmt, ...);
|
||||
|
||||
void SysMessage(char *fmt, ...);
|
||||
extern void SaveConfig();
|
||||
extern void LoadConfig();
|
||||
extern void setLoggingState();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -151,24 +151,20 @@
|
|||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Config.cpp"
|
||||
RelativePath="..\Config.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\USB.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Win32.cpp"
|
||||
>
|
||||
</File>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc"
|
||||
>
|
||||
<File
|
||||
RelativePath="resource.h"
|
||||
RelativePath="..\Config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -184,10 +180,6 @@
|
|||
RelativePath="USBnull.def"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="USBnull.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
|
|
@ -26,6 +26,20 @@ extern string s_strIniPath;
|
|||
extern PluginLog Dev9Log;
|
||||
PluginConf Ini;
|
||||
|
||||
void setLoggingState()
|
||||
{
|
||||
if (conf.Log)
|
||||
{
|
||||
Dev9Log.WriteToConsole = true;
|
||||
Dev9Log.WriteToFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Dev9Log.WriteToConsole = false;
|
||||
Dev9Log.WriteToFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(void) DEV9about()
|
||||
{
|
||||
SysMessage("Dev9null: A simple null plugin.");
|
||||
|
@ -43,7 +57,7 @@ void LoadConfig()
|
|||
string IniPath = s_strIniPath + "/Dev9null.ini";
|
||||
if (!Ini.Open(IniPath, READ_FILE))
|
||||
{
|
||||
Dev9Log.WriteLn("Failed to open %s\n", IniPath.c_str());
|
||||
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +71,7 @@ void SaveConfig()
|
|||
string IniPath = s_strIniPath + "/Dev9null.ini";
|
||||
if (!Ini.Open(IniPath, WRITE_FILE))
|
||||
{
|
||||
Dev9Log.WriteLn("Failed to open %s\n", IniPath.c_str());
|
||||
Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,9 +65,7 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
|||
EXPORT_C_(s32) DEV9init()
|
||||
{
|
||||
LoadConfig();
|
||||
|
||||
Dev9Log.WriteToConsole = true;
|
||||
Dev9Log.WriteToFile = true;
|
||||
setLoggingState();
|
||||
|
||||
Dev9Log.Open("logs/dev9null.log");
|
||||
Dev9Log.WriteLn("dev9null plugin version %d,%d", revision, build);
|
||||
|
|
|
@ -50,4 +50,6 @@ extern __aligned16 s8 dev9regs[0x10000];
|
|||
#define dev9Ru16(mem) (*(u16*)&dev9regs[(mem) & 0xffff])
|
||||
#define dev9Ru32(mem) (*(u32*)&dev9regs[(mem) & 0xffff])
|
||||
|
||||
extern void setLoggingState();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue