Linux: Fix focus problems with various dialogs when hitting escape, and hook in dev9's dialog box.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1190 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-15 07:02:51 +00:00
parent 5615929ce3
commit 667581e4be
13 changed files with 301 additions and 27 deletions

View File

@ -216,6 +216,11 @@ void On_Dialog_Cancelled(GtkButton* button, gpointer user_data)
gtk_main_quit();
}
void On_Dialog_Close(GtkDialog* dialog, gpointer user_data)
{
gtk_widget_set_sensitive(MainWindow, TRUE);
}
void RefreshMenuSlots()
{
GtkWidget *Item;

View File

@ -257,3 +257,7 @@ OnLogging_Ok (GtkButton *button,
void
OnMemcards_Ok (GtkButton *button,
gpointer user_data);
void
On_Dialog_Close (GtkDialog *dialog,
gpointer user_data);

View File

@ -523,6 +523,9 @@ create_AdvDlg (void)
gtk_dialog_add_action_widget (GTK_DIALOG (AdvDlg), button80, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (button80, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) AdvDlg, "close",
G_CALLBACK (On_Dialog_Close),
NULL);
g_signal_connect ((gpointer) AdvDefaultBtn, "clicked",
G_CALLBACK (on_Advanced_Defaults),
NULL);
@ -831,6 +834,9 @@ create_SpeedHacksDlg (void)
gtk_dialog_add_action_widget (GTK_DIALOG (SpeedHacksDlg), button98, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (button98, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) SpeedHacksDlg, "close",
G_CALLBACK (On_Dialog_Close),
NULL);
g_signal_connect ((gpointer) EECycleHackScale, "value_changed",
G_CALLBACK (on_ee_slider_changed),
NULL);
@ -969,6 +975,9 @@ create_GameFixDlg (void)
gtk_dialog_add_action_widget (GTK_DIALOG (GameFixDlg), button83, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (button83, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) GameFixDlg, "close",
G_CALLBACK (On_Dialog_Close),
NULL);
g_signal_connect ((gpointer) cancelbutton1, "clicked",
G_CALLBACK (on_Game_Fix_OK),
NULL);
@ -4156,6 +4165,9 @@ create_CpuDlg (void)
gtk_dialog_add_action_widget (GTK_DIALOG (CpuDlg), button97, 0);
GTK_WIDGET_SET_FLAGS (button97, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) CpuDlg, "close",
G_CALLBACK (On_Dialog_Close),
NULL);
g_signal_connect ((gpointer) button96, "clicked",
G_CALLBACK (OnCpu_Ok),
NULL);
@ -4521,6 +4533,9 @@ create_Logging (void)
gtk_dialog_add_action_widget (GTK_DIALOG (Logging), Logging2Cancel, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (Logging2Cancel, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) Logging, "close",
G_CALLBACK (On_Dialog_Close),
NULL);
g_signal_connect ((gpointer) Logging_Ok, "clicked",
G_CALLBACK (OnLogging_Ok),
NULL);
@ -4747,6 +4762,9 @@ create_MemDlg (void)
gtk_dialog_add_action_widget (GTK_DIALOG (MemDlg), okbutton1, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) MemDlg, "close",
G_CALLBACK (On_Dialog_Close),
NULL);
g_signal_connect ((gpointer) memcardcancelbutton, "clicked",
G_CALLBACK (OnMemcards_Ok),
NULL);

View File

@ -19,6 +19,7 @@
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="On_Dialog_Close" last_modification_time="Fri, 15 May 2009 06:51:15 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
@ -1188,6 +1189,7 @@ Denormals are Zero - Your CPU makes Floating Point Denormals become Zero, so it
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="On_Dialog_Close" last_modification_time="Fri, 15 May 2009 06:51:23 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
@ -1777,6 +1779,7 @@ If you have problems, Disable all of these and try again.</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="On_Dialog_Close" last_modification_time="Fri, 15 May 2009 06:51:36 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@ -6418,6 +6421,7 @@ Version x.x</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="On_Dialog_Close" last_modification_time="Fri, 15 May 2009 06:51:47 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox5">
@ -7295,6 +7299,7 @@ Version x.x</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="On_Dialog_Close" last_modification_time="Fri, 15 May 2009 06:51:55 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox6">
@ -8102,6 +8107,7 @@ Version x.x</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<signal name="close" handler="On_Dialog_Close" last_modification_time="Fri, 15 May 2009 06:52:03 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox7">

View File

@ -29,6 +29,5 @@ libUSBnull_a_SOURCES += \
Linux/interface.h Linux/support.c \
Linux/interface.c Linux/support.h \
Linux/callbacks.h
#Linux/callbacks.c
#SUBDIRS = Linux

View File

@ -95,35 +95,35 @@ EXPORT_C_(void) USBclose()
EXPORT_C_(u8 ) USBread8(u32 addr)
{
USB_LOG("*UnKnown 8bit read at address %lx ", addr);
USB_LOG("*Unknown 8bit read at address %lx ", addr);
return 0;
}
EXPORT_C_(u16) USBread16(u32 addr)
{
USB_LOG("*UnKnown 16bit read at address %lx", addr);
USB_LOG("*Unknown 16bit read at address %lx", addr);
return 0;
}
EXPORT_C_(u32) USBread32(u32 addr)
{
USB_LOG("*UnKnown 32bit read at address %lx", addr);
USB_LOG("*Unknown 32bit read at address %lx", addr);
return 0;
}
EXPORT_C_(void) USBwrite8(u32 addr, u8 value)
{
USB_LOG("*UnKnown 8bit write at address %lx value %x\n", addr, value);
USB_LOG("*Unknown 8bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void) USBwrite16(u32 addr, u16 value)
{
USB_LOG("*UnKnown 16bit write at address %lx value %x\n", addr, value);
USB_LOG("*Unknown 16bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void) USBwrite32(u32 addr, u32 value)
{
USB_LOG("*UnKnown 32bit write at address %lx value %lx\n", addr, value);
USB_LOG("*Unknown 32bit write at address %lx value %lx\n", addr, value);
}
EXPORT_C_(void) USBirqCallback(USBcallback callback)
@ -143,6 +143,7 @@ EXPORT_C_(USBhandler) USBirqHandler(void)
EXPORT_C_(void) USBsetRAM(void *mem)
{
USB_LOG("*Setting ram.\n");
}
// extended funcs

View File

@ -1,5 +1,5 @@
/* USBlinuz
* Copyright (C) 2002-2004 USBlinuz Team
/* USBnull
* Copyright (C) 2002-2009 pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __USB_H__
#define __USB_H__

View File

@ -16,11 +16,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include "PS2Etypes.h"
#include <errno.h>
#include <string>
using namespace std;
#include "DEV9.h"
const unsigned char version = PS2E_DEV9_VERSION;
@ -28,9 +29,11 @@ const unsigned char revision = 0;
const unsigned char build = 4; // increase that with each version
const char *libraryName = "DEV9null Driver";
string s_strIniPath="inis/DEV9null.ini";
void (*DEV9irq)();
void (*DEV9irq)(int);
FILE *dev9Log;
Config conf;
EXPORT_C_(u32) PS2EgetLibType()
{
@ -47,10 +50,12 @@ 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 || dev9Log == NULL) return;
va_start(list, fmt);
vfprintf(dev9Log, fmt, list);
va_end(list);
@ -58,11 +63,23 @@ void __Log(char *fmt, ...)
EXPORT_C_(s32) DEV9init()
{
LoadConfig();
#ifdef DEV9_LOG
dev9Log = fopen("logs/dev9Log.txt", "w");
if (dev9Log) setvbuf(dev9Log, NULL, _IONBF, 0);
DEV9_LOG("dev9null plugin version %d,%d\n", revision, build);
DEV9_LOG("DEV9init\n");
#endif
return 0;
}
EXPORT_C_(void) DEV9shutdown()
{
#ifdef DEV9_LOG
if (dev9Log) fclose(dev9Log);
#endif
}
EXPORT_C_(s32) DEV9open(void *pDsp)
@ -77,42 +94,50 @@ EXPORT_C_(void) DEV9close()
EXPORT_C_(u8) DEV9read8(u32 addr)
{
DEV9_LOG("*Unknown 8bit read at address %lx ", addr);
return 0;
}
EXPORT_C_(u16 ) DEV9read16(u32 addr)
{
DEV9_LOG("*Unknown 16bit read at address %lx ", addr);
return 0;
}
EXPORT_C_(u32 ) DEV9read32(u32 addr)
{
DEV9_LOG("*Unknown 32bit read at address %lx ", addr);
return 0;
}
EXPORT_C_(void) DEV9write8(u32 addr, u8 value)
{
DEV9_LOG("*Unknown 8bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void) DEV9write16(u32 addr, u16 value)
{
DEV9_LOG("*Unknown 16bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void) DEV9write32(u32 addr, u32 value)
{
DEV9_LOG("*Unknown 32bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void) DEV9readDMA8Mem(u32 *pMem, int size)
{
DEV9_LOG("Reading DMA8 Mem.");
}
EXPORT_C_(void) DEV9writeDMA8Mem(u32* pMem, int size)
{
DEV9_LOG("Writing DMA8 Mem.");
}
EXPORT_C_(void) DEV9irqCallback(DEV9callback callback)
{
DEV9irq = callback;
}
EXPORT_C_(DEV9handler) DEV9irqHandler(void)
@ -127,6 +152,7 @@ EXPORT_C_(s32) DEV9test()
return 0;
}
#ifdef _WIN32
EXPORT_C_(void) DEV9configure()
{
SysMessage("Nothing to Configure");
@ -136,8 +162,6 @@ EXPORT_C_(void) DEV9about()
{
}
#ifdef _WIN32
HINSTANCE hInst;
void SysMessage(const char *fmt, ...)

View File

@ -1,3 +1,21 @@
/* dev9null
* Copyright (C) 2002-2009 pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __DEV9_H__
#define __DEV9_H__
@ -17,6 +35,13 @@ extern "C"
#include "PS2Edefs.h"
}
typedef struct {
int Log;
} Config;
extern Config conf;
#define DEV9_LOG __Log
/*#ifdef _MSC_VER
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
#else
@ -35,7 +60,10 @@ extern const unsigned char build;
extern const unsigned int minor;
extern const char *libraryName;
extern void (*DEV9irq)();
void SaveConfig();
void LoadConfig();
extern void (*DEV9irq)(int);
extern void SysMessage(const char *fmt, ...);
extern FILE *dev9Log;

View File

@ -16,15 +16,35 @@
* 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 "Config.h"
#include "DEV9.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "support.h"
#include "callbacks.h"
#include "interface.h"
GtkWidget *MsgDlg;
#ifdef __cplusplus
}
#endif
GtkWidget *MsgDlg, *About, *Conf;
extern string s_strIniPath;
void OnMsg_Ok()
{
@ -74,6 +94,76 @@ void SysMessage(const char *fmt, ...)
gtk_main();
}
void LoadConfig()
void OnAbout_Ok(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(About);
gtk_main_quit();
}
EXPORT_C_(void) DEV9about()
{
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) DEV9configure()
{
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);
}

View File

@ -295,6 +295,71 @@
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame4">
<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="label16">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Logging&lt;/b&gt;</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>

View File

@ -45,6 +45,10 @@ create_Config (void)
GList *GtkCombo_Hdd_items = NULL;
GtkWidget *entry1;
GtkWidget *label15;
GtkWidget *frame4;
GtkWidget *alignment1;
GtkWidget *check_logging;
GtkWidget *label16;
GtkWidget *hbuttonbox1;
GtkWidget *button1;
GtkWidget *button2;
@ -132,6 +136,29 @@ create_Config (void)
gtk_widget_show (label15);
gtk_frame_set_label_widget (GTK_FRAME (frame3), label15);
frame4 = gtk_frame_new (NULL);
gtk_widget_set_name (frame4, "frame4");
gtk_widget_show (frame4);
gtk_box_pack_start (GTK_BOX (vbox1), frame4, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame4), 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 (frame4), 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);
label16 = gtk_label_new (_("<b>Logging</b>"));
gtk_widget_set_name (label16, "label16");
gtk_widget_show (label16);
gtk_frame_set_label_widget (GTK_FRAME (frame4), label16);
gtk_label_set_use_markup (GTK_LABEL (label16), TRUE);
hbuttonbox1 = gtk_hbutton_box_new ();
gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
gtk_widget_show (hbuttonbox1);
@ -172,6 +199,10 @@ create_Config (void)
GLADE_HOOKUP_OBJECT (Config, GtkCombo_Hdd, "GtkCombo_Hdd");
GLADE_HOOKUP_OBJECT (Config, entry1, "entry1");
GLADE_HOOKUP_OBJECT (Config, label15, "label15");
GLADE_HOOKUP_OBJECT (Config, frame4, "frame4");
GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1");
GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging");
GLADE_HOOKUP_OBJECT (Config, label16, "label16");
GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1");
GLADE_HOOKUP_OBJECT (Config, button1, "button1");
GLADE_HOOKUP_OBJECT (Config, button2, "button2");

View File

@ -22,6 +22,10 @@ libDEV9null_LDFLAGS= @SHARED_LDFLAGS@
libDEV9null_LDFLAGS+=-Wl,-soname,@libDEV9null_SONAME@
libDEV9null_LDADD=$(libDEV9null_a_OBJECTS)
libDEV9null_a_SOURCES = DEV9.cpp DEV9.h Linux/Config.cpp
libDEV9null_a_SOURCES = DEV9.cpp DEV9.h Linux/Config.cpp Linux/Config.h
libDEV9null_a_SOURCES += \
Linux/interface.h Linux/support.c \
Linux/interface.c Linux/support.h \
Linux/callbacks.h
#SUBDIRS = Linux