Gtk gui (in progress)
This commit is contained in:
parent
0bf5ac3a9c
commit
255315d93a
|
@ -0,0 +1,26 @@
|
||||||
|
CC=gcc
|
||||||
|
LD=$(CC)
|
||||||
|
|
||||||
|
CFLAGS=-Wall -g `pkg-config --cflags hidapi-hidraw gtk+-3.0 gmodule-2.0`
|
||||||
|
LDFLAGS=`pkg-config --libs hidapi-hidraw gtk+-3.0 gmodule-2.0`
|
||||||
|
|
||||||
|
PREFIX=/usr/local
|
||||||
|
|
||||||
|
PROG=gcn64ctl_gui
|
||||||
|
|
||||||
|
OBJS=main.o ../gcn64.o ../mempak.o ../gcn64lib.o
|
||||||
|
|
||||||
|
.PHONY : clean install
|
||||||
|
|
||||||
|
all: $(OBJS)
|
||||||
|
$(LD) $(LDFLAGS) $(OBJS) -o $(PROG)
|
||||||
|
|
||||||
|
%.o: %.c %.h
|
||||||
|
$(CC) $(CFLAGS) -c $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o $(PROG)
|
||||||
|
|
||||||
|
install:
|
||||||
|
@echo "Install not done yet. Sorry"
|
||||||
|
|
|
@ -0,0 +1,745 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.18.3 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.12"/>
|
||||||
|
<!-- interface-license-type gplv3 -->
|
||||||
|
<!-- interface-name gcn64 to USB -->
|
||||||
|
<!-- interface-copyright Rapha\303\253l Ass\303\251nat -->
|
||||||
|
<!-- interface-authors Rapha\303\253l Ass\303\251nat -->
|
||||||
|
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<property name="program_name">GC/N64 to USB configurator</property>
|
||||||
|
<property name="copyright" translatable="yes">Copyright (C) 2015 Raphaël Assénat <raph@raphnet.net></property>
|
||||||
|
<property name="website">http://www.raphnet.net</property>
|
||||||
|
<property name="website_label" translatable="yes">http://www.raphnet.net</property>
|
||||||
|
<property name="authors">Raphaël Assénat</property>
|
||||||
|
<property name="logo_icon_name">image-x-generic</property>
|
||||||
|
<property name="license_type">gpl-3-0</property>
|
||||||
|
<signal name="response" handler="gtk_widget_hide" swapped="no"/>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="aboutdialog-vbox1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="aboutdialog-action_area1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GtkListStore" id="adaptersList">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name Serial -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
<!-- column-name Name -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
<!-- column-name Version -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
<!-- column-name libhandle -->
|
||||||
|
<column type="gpointer"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkFileFilter" id="hexfilter">
|
||||||
|
<patterns>
|
||||||
|
<pattern>*.hex</pattern>
|
||||||
|
</patterns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="pollrate_adjustment">
|
||||||
|
<property name="lower">1</property>
|
||||||
|
<property name="upper">255</property>
|
||||||
|
<property name="step_increment">1</property>
|
||||||
|
<property name="page_increment">5</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkWindow" id="mainWindow">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">GCN64CFG</property>
|
||||||
|
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
|
||||||
|
<signal name="show" handler="onMainWindowShow" swapped="no"/>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">2</property>
|
||||||
|
<property name="margin_right">2</property>
|
||||||
|
<property name="margin_top">2</property>
|
||||||
|
<property name="margin_bottom">2</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuBar" id="menubar1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuItem" id="menuitem1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">_File</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<child type="submenu">
|
||||||
|
<object class="GtkMenu" id="menu1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="imagemenuitem1">
|
||||||
|
<property name="label">gtk-new</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="imagemenuitem2">
|
||||||
|
<property name="label">gtk-open</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="imagemenuitem3">
|
||||||
|
<property name="label">gtk-save</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="imagemenuitem4">
|
||||||
|
<property name="label">gtk-save-as</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="imagemenuitem5">
|
||||||
|
<property name="label">gtk-quit</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<signal name="activate" handler="gtk_main_quit" object="window1" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuItem" id="menuitem_help">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">_Help</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<child type="submenu">
|
||||||
|
<object class="GtkMenu" id="menu3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImageMenuItem" id="imagemenuitem10">
|
||||||
|
<property name="label">gtk-about</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<signal name="activate" handler="gtk_widget_show" object="aboutdialog1" swapped="yes"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Selected adapter: </property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox" id="combobox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="model">adaptersList</property>
|
||||||
|
<property name="row_span_column">6</property>
|
||||||
|
<property name="button_sensitivity">on</property>
|
||||||
|
<property name="id_column">2</property>
|
||||||
|
<signal name="changed" handler="adapterSelected" swapped="no"/>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">1</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="adapterDetails">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="frame3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">Product name:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">USB ID:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">Firmware version:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_product_name">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_firmware_version">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_usb_id">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="label5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Information and status:</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="frame1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="checkbutton1">
|
||||||
|
<property name="label" translatable="yes">N64 Square joystick</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="config_checkbox_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="checkbutton2">
|
||||||
|
<property name="label" translatable="yes">GC Square main stick</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="config_checkbox_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="checkbutton3">
|
||||||
|
<property name="label" translatable="yes">GC Square C-stick</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="config_checkbox_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="checkbutton4">
|
||||||
|
<property name="label" translatable="yes">GC Full range sliders
|
||||||
|
(non-centered)</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="config_checkbox_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="checkbutton5">
|
||||||
|
<property name="label" translatable="yes">GC Inverted triggers</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.40999999642372131</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="config_checkbox_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xpad">5</property>
|
||||||
|
<property name="label" translatable="yes">Poll interval (ms):</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="pollInterval0">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="max_length">3</property>
|
||||||
|
<property name="caps_lock_warning">False</property>
|
||||||
|
<property name="progress_fraction">0.10000000000000001</property>
|
||||||
|
<property name="input_purpose">number</property>
|
||||||
|
<property name="adjustment">pollrate_adjustment</property>
|
||||||
|
<property name="climb_rate">1</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
|
<signal name="changed" handler="pollIntervalChanged" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">6</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="label2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Configuration</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">4</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="frame2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkAlignment" id="alignment2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="left_padding">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButtonBox" id="buttonbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="layout_style">start</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button1">
|
||||||
|
<property name="label" translatable="yes">Suspend polling</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="xalign">0.46000000834465027</property>
|
||||||
|
<signal name="clicked" handler="suspend_polling" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button2">
|
||||||
|
<property name="label" translatable="yes">Resume polling</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<signal name="clicked" handler="resume_polling" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button3">
|
||||||
|
<property name="label" translatable="yes">Update firmware...</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<signal name="clicked" handler="gtk_widget_show" object="hexfile_chooser" swapped="yes"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button4">
|
||||||
|
<property name="label" translatable="yes">Read N64 mempak</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel" id="label3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Operations:</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">3</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkStatusbar" id="statusbar1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">10</property>
|
||||||
|
<property name="margin_right">10</property>
|
||||||
|
<property name="margin_start">10</property>
|
||||||
|
<property name="margin_end">10</property>
|
||||||
|
<property name="margin_top">6</property>
|
||||||
|
<property name="margin_bottom">6</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GtkFileChooserDialog" id="hexfile_chooser">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Select firmware file...</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<property name="attached_to">mainWindow</property>
|
||||||
|
<property name="filter">hexfilter</property>
|
||||||
|
<property name="local_only">False</property>
|
||||||
|
<property name="preview_widget_active">False</property>
|
||||||
|
<property name="use_preview_label">False</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="filechooserdialog-vbox1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="filechooserdialog-action_area1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button5">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="relief">none</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<signal name="clicked" handler="gtk_widget_hide" object="hexfile_chooser" swapped="yes"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button6">
|
||||||
|
<property name="label">gtk-open</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="yalign">0.46000000834465027</property>
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GtkMessageDialog" id="internalError">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Error</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="icon_name">dialog-error</property>
|
||||||
|
<property name="type_hint">normal</property>
|
||||||
|
<property name="transient_for">mainWindow</property>
|
||||||
|
<property name="message_type">question</property>
|
||||||
|
<property name="text" translatable="yes">Internal error</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="messagedialog-vbox">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="messagedialog-action_area">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="homogeneous">True</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="internalErrorDialog">
|
||||||
|
<property name="label">gtk-close</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="yalign">0.47999998927116394</property>
|
||||||
|
<signal name="clicked" handler="gtk_main_quit" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
Binary file not shown.
|
@ -0,0 +1,175 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include "../gcn64.h"
|
||||||
|
#include "../gcn64lib.h"
|
||||||
|
#include "../../requests.h"
|
||||||
|
|
||||||
|
#define GET_UI_ELEMENT(TYPE, ELEMENT) TYPE *ELEMENT = (TYPE *) \
|
||||||
|
gtk_builder_get_object(app->builder, #ELEMENT);
|
||||||
|
|
||||||
|
struct application {
|
||||||
|
GtkBuilder *builder;
|
||||||
|
gcn64_hdl_t current_adapter_handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void updateGuiFromAdapter(struct application *app)
|
||||||
|
{
|
||||||
|
unsigned char buf[32];
|
||||||
|
int n;
|
||||||
|
|
||||||
|
GtkSpinButton *pollInterval0 = GTK_SPIN_BUTTON( gtk_builder_get_object(app->builder, "pollInterval0") );
|
||||||
|
|
||||||
|
n = gcn64lib_getConfig(app->current_adapter_handle, CFG_PARAM_POLL_INTERVAL0, buf, sizeof(buf));
|
||||||
|
if (n == 1) {
|
||||||
|
printf("poll interval: %d\n", buf[0]);
|
||||||
|
gtk_spin_button_set_value(pollInterval0, (gdouble)buf[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void pollIntervalChanged(GtkWidget *win, gpointer data)
|
||||||
|
{
|
||||||
|
struct application *app = data;
|
||||||
|
GET_UI_ELEMENT(GtkSpinButton, pollInterval0);
|
||||||
|
gdouble value;
|
||||||
|
int n;
|
||||||
|
unsigned char buf;
|
||||||
|
|
||||||
|
value = gtk_spin_button_get_value(pollInterval0);
|
||||||
|
printf("Value: %d\n", (int)value);
|
||||||
|
buf = (int)value;
|
||||||
|
|
||||||
|
n = gcn64lib_setConfig(app->current_adapter_handle, CFG_PARAM_POLL_INTERVAL0, &buf, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void onMainWindowShow(GtkWidget *win, gpointer data)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
struct gcn64_list_ctx *listctx;
|
||||||
|
struct gcn64_info info;
|
||||||
|
struct application *app = data;
|
||||||
|
GtkListStore *list_store;
|
||||||
|
|
||||||
|
res = gcn64_init(1);
|
||||||
|
if (res) {
|
||||||
|
GtkWidget *d = GTK_WIDGET( gtk_builder_get_object(app->builder, "internalError") );
|
||||||
|
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(d), "gcn64_init failed (returned %d)", res);
|
||||||
|
gtk_widget_show(d);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_store = GTK_LIST_STORE( gtk_builder_get_object(app->builder, "adaptersList") );
|
||||||
|
|
||||||
|
printf("Listing device...\n");
|
||||||
|
listctx = gcn64_allocListCtx();
|
||||||
|
|
||||||
|
while (gcn64_listDevices(&info, listctx)) {
|
||||||
|
GtkTreeIter iter;
|
||||||
|
printf("Device '%ls'\n", info.str_prodname);
|
||||||
|
gtk_list_store_append(list_store, &iter);
|
||||||
|
if (sizeof(wchar_t)==4) {
|
||||||
|
gtk_list_store_set(list_store, &iter,
|
||||||
|
0, g_ucs4_to_utf8((void*)info.str_serial, -1, NULL, NULL, NULL),
|
||||||
|
1, g_ucs4_to_utf8((void*)info.str_prodname, -1, NULL, NULL, NULL),
|
||||||
|
3, g_memdup(&info, sizeof(struct gcn64_info)),
|
||||||
|
-1);
|
||||||
|
} else {
|
||||||
|
gtk_list_store_set(list_store, &iter,
|
||||||
|
0, g_utf16_to_utf8((void*)info.str_serial, -1, NULL, NULL, NULL),
|
||||||
|
1, g_utf16_to_utf8((void*)info.str_prodname, -1, NULL, NULL, NULL),
|
||||||
|
3, g_memdup(&info, sizeof(struct gcn64_info)),
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
// gtk_list_store_set(list_store, &iter, 1, "asfasdfasdfasf", -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
gcn64_freeListCtx(listctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void adapterSelected(GtkComboBox *cb, gpointer data)
|
||||||
|
{
|
||||||
|
struct application *app = data;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkListStore *list_store = GTK_LIST_STORE( gtk_builder_get_object(app->builder, "adaptersList") );
|
||||||
|
GtkWidget *adapter_details = GTK_WIDGET( gtk_builder_get_object(app->builder, "adapterDetails") );
|
||||||
|
struct gcn64_info *info;
|
||||||
|
|
||||||
|
if (!app->current_adapter_handle) {
|
||||||
|
gcn64_closeDevice(app->current_adapter_handle);
|
||||||
|
app->current_adapter_handle = NULL;
|
||||||
|
gtk_widget_set_sensitive(adapter_details, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gtk_combo_box_get_active_iter(cb, &iter)) {
|
||||||
|
gtk_tree_model_get(GTK_TREE_MODEL(list_store), &iter, 3, &info, -1);
|
||||||
|
printf("%s\n", info->str_path);
|
||||||
|
|
||||||
|
app->current_adapter_handle = gcn64_openDevice(info);
|
||||||
|
if (!app->current_adapter_handle) {
|
||||||
|
printf("Access error!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateGuiFromAdapter(app);
|
||||||
|
gtk_widget_set_sensitive(adapter_details, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void onMainWindowHide(GtkWidget *win, gpointer data)
|
||||||
|
{
|
||||||
|
gcn64_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void suspend_polling(GtkButton *button, gpointer data)
|
||||||
|
{
|
||||||
|
struct application *app = data;
|
||||||
|
|
||||||
|
gcn64lib_suspendPolling(app->current_adapter_handle, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_MODULE_EXPORT void resume_polling(GtkButton *button, gpointer data)
|
||||||
|
{
|
||||||
|
struct application *app = data;
|
||||||
|
|
||||||
|
gcn64lib_suspendPolling(app->current_adapter_handle, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main( int argc,
|
||||||
|
char **argv )
|
||||||
|
{
|
||||||
|
GtkWidget *window;
|
||||||
|
GError *error = NULL;
|
||||||
|
struct application app = { };
|
||||||
|
|
||||||
|
/* Init GTK+ */
|
||||||
|
gtk_init( &argc, &argv );
|
||||||
|
|
||||||
|
/* Create new GtkBuilder object */
|
||||||
|
app.builder = gtk_builder_new();
|
||||||
|
/* Load UI from file. If error occurs, report it and quit application.
|
||||||
|
* Replace "tut.glade" with your saved project. */
|
||||||
|
if( ! gtk_builder_add_from_file( app.builder, "gcn64cfg.glade", &error ) )
|
||||||
|
{
|
||||||
|
g_warning( "%s", error->message );
|
||||||
|
g_free( error );
|
||||||
|
return( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get main window pointer from UI */
|
||||||
|
window = GTK_WIDGET( gtk_builder_get_object( app.builder, "mainWindow" ) );
|
||||||
|
|
||||||
|
/* Connect signals */
|
||||||
|
gtk_builder_connect_signals( app.builder, &app );
|
||||||
|
|
||||||
|
/* Destroy builder, since we don't need it anymore */
|
||||||
|
// g_object_unref( G_OBJECT( builder ) );
|
||||||
|
|
||||||
|
/* Show window. All other widgets are automatically shown by GtkBuilder */
|
||||||
|
gtk_widget_show( window );
|
||||||
|
|
||||||
|
/* Start main loop */
|
||||||
|
gtk_main();
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue