diff --git a/desmume/src/gtk-glade/dTools/callbacks_2_memview.c b/desmume/src/gtk-glade/dTools/callbacks_2_memview.c
index 0c82662bc..6ff7ef653 100755
--- a/desmume/src/gtk-glade/dTools/callbacks_2_memview.c
+++ b/desmume/src/gtk-glade/dTools/callbacks_2_memview.c
@@ -1,4 +1,4 @@
-/* callbacks_1_memview.c - this file is part of DeSmuME
+/* callbacks_2_memview.c - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
@@ -33,12 +33,19 @@ enum SHOW {
static BOOL init=FALSE;
static enum SHOW packmode=Bit8;
static u32 address=0, tmpaddr=0, bpl=0; int cpu=0;
-static PangoAttrList *attr_Address, *attr_Pattern1, *attr_Pattern2, *attr_Text;
+static PangoAttrList *attr_Text8,*attr_Text16,*attr_Text32;
+static char patt[512];
static GtkEntry *wAddress;
static GtkDrawingArea *wPaint;
-void refresh();
+static GtkRange *wRange;
+void refresh();
+void initialise();
+
+
+
+/* which cpu we look into */
void on_wtools_2_cpu_changed (GtkComboBox *widget, gpointer user_data) {
/* c == 0 means ARM9 */
@@ -54,44 +61,104 @@ void on_wtools_2_r16_toggled (GtkToggleButton *togglebutton, gpointer
void on_wtools_2_r32_toggled (GtkToggleButton *togglebutton, gpointer user_data) { packmode=Bit32; refresh(); }
/* which address */
+#define RANGE_MIN 0
+#define RANGE_MAX 0x100000000
+#define ADDR_MASK 0xFFFFFFF0
+#define STEP_ONE_LINE 0x10
+#define STEP_ONE_PAGE 0x100
+#define STEP_x10_PAGE 0x1000
+
+void scroll_address(u32 addr) {
+ address = addr & ADDR_MASK;
+ refresh();
+}
+void change_address(u32 addr) {
+ gtk_range_set_value(wRange, addr);
+}
+void add_to_address(u32 inc) {
+ change_address(address+inc);
+}
void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data) {
- address=strtol(gtk_entry_get_text(entry),NULL,0);
- refresh();
+ change_address(strtol(gtk_entry_get_text(entry),NULL,0));
}
void on_wtools_2_GotoAddress_changed (GtkEntry *entry, gpointer user_data) {
tmpaddr=strtol(gtk_entry_get_text(entry),NULL,0);
}
void on_wtools_2_GotoButton_clicked (GtkButton *button, gpointer user_data) {
- address=tmpaddr;
- refresh();
+ change_address(tmpaddr);
}
-
void on_wtools_2_MemView_show (GtkWidget *widget, gpointer user_data) {
- GtkWidget * combo = glade_xml_get_widget(xml_tools, "wtools_2_cpu");
- wAddress = (GtkEntry*)glade_xml_get_widget(xml_tools, "wtools_2_GotoAddress");
- wPaint = (GtkDrawingArea*)glade_xml_get_widget(xml_tools, "wtools_2_draw");
- gtk_combo_box_set_active((GtkComboBox*)combo, 0);
- refresh();
+ initialize();
+ change_address(RANGE_MIN);
}
-void on_wtools_2_scroll_scroll_child (GtkScrolledWindow *scrolledwindow, GtkScrollType scroll, gboolean horizontal, gpointer user_data) {
- // scroll
- refresh();
+
+
+/* scroll functions :D */
+
+void on_wtools_2_scroll_value_changed (GtkRange *range, gpointer user_data) {
+ u32 addr=(u32)gtk_range_get_value(range);
+ scroll_address(addr);
}
+gboolean on_wtools_2_draw_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) {
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ add_to_address(-STEP_ONE_PAGE); break;
+ case GDK_SCROLL_DOWN:
+ add_to_address(+STEP_ONE_PAGE); break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+gboolean on_wtools_2_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { refresh(); return TRUE; }
-gboolean on_wtools_2_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { refresh(); }
+
+
+/* initialise what we have to */
+
void initialize() {
+ GtkWidget * combo;
+ GtkAdjustment *adj;
+ int i,j;
+
if (init) return;
- pango_parse_markup(" ", -1, 0, &attr_Address, NULL, NULL, NULL);
- pango_parse_markup(" ", -1, 0, &attr_Pattern1, NULL, NULL, NULL);
- pango_parse_markup(" ", -1, 0, &attr_Pattern2, NULL, NULL, NULL);
- pango_parse_markup(" ", -1, 0, &attr_Text, NULL, NULL, NULL);
+ combo = glade_xml_get_widget(xml_tools, "wtools_2_cpu");
+ adj = (GtkAdjustment *)gtk_adjustment_new (RANGE_MIN, RANGE_MIN, RANGE_MAX,
+ STEP_ONE_LINE, STEP_x10_PAGE, STEP_ONE_PAGE);
+
+ // get widget reference
+ wAddress = (GtkEntry*)glade_xml_get_widget(xml_tools, "wtools_2_GotoAddress");
+ wPaint = (GtkDrawingArea*)glade_xml_get_widget(xml_tools, "wtools_2_draw");
+ wRange = (GtkRange*)glade_xml_get_widget(xml_tools, "wtools_2_scroll");
+
+ gtk_combo_box_set_active((GtkComboBox*)combo, 0);
+ gtk_range_set_adjustment(wRange, adj);
+
+#define PATT(x) x"" x ""
+#define DUP(x) x x
+ strcpy(patt, "0000:0000 | ");
+ strcat(patt, DUP(DUP(DUP(PATT("00_")))) );
+ strcat(patt, "| 0123456789ABCDEF");
+ pango_parse_markup(patt,-1,0,&attr_Text8,NULL,NULL,NULL);
+
+ strcpy(patt, "0000:0000 | ");
+ strcat(patt, DUP(DUP(PATT("_0000_"))) );
+ strcat(patt, "| 0123456789ABCDEF");
+ pango_parse_markup(patt,-1,0,&attr_Text16,NULL,NULL,NULL);
+
+ strcpy(patt, "0000:0000 | ");
+ strcat(patt, DUP(PATT("__00000000__")) );
+ strcat(patt, "| 0123456789ABCDEF");
+ pango_parse_markup(patt,-1,0,&attr_Text32,NULL,NULL,NULL);
+#undef DUP
+#undef PATT
init = TRUE;
}
@@ -101,23 +168,29 @@ void refresh() {
PangoLayout* playout = gtk_widget_create_pango_layout(area, NULL);
GdkGC * GC = area->style->fg_gc[area->state];
int i,j,addr, w,h,x,y; u8 c;
- char txt[80],*ptxt;
- char words[4][13];
+ char *ptxt, txt[]="0000:0000 | 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF | 0123456789ABCDEF\0";
+ PangoAttrList *attr;
+
+ switch(packmode){
+ default:
+ case Bit8: attr=attr_Text8; break;
+ case Bit16: attr=attr_Text16; break;
+ case Bit32: attr=attr_Text32; break;
+ }
- initialize();
gdk_draw_rectangle(area->window, area->style->white_gc, TRUE, 0, 0,
area->allocation.width, area->allocation.height);
- char * def_patt = "0000:0000 | 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF | 0123456789ABCDEF";
- pango_layout_set_markup(playout, def_patt , -1);
+ pango_layout_set_text(playout, txt, -1);
+ pango_layout_set_attributes(playout, attr);
pango_layout_get_pixel_size(playout, &w, &h);
- gtk_widget_set_usize(area,w+20, (10*h)+10);
+ gtk_widget_set_usize(area,w+20, (0x10*h)+10);
// draw memory content here
addr=address;
- for (i=0,x=10,y=5; i<10; i++,y+=h) {
+ for (i=0,x=10,y=5; i<0x10; i++,y+=h) {
ptxt = txt;
- sprintf(ptxt, "%04X:%04X | ", (addr>>16), (addr&0xFFFF)); ptxt+=12;
+ sprintf(ptxt, "%04X:%04X | ", (addr>>16)&0xFFFF, addr&0xFFFF); ptxt+=12;
switch(packmode) {
case Bit8:
for (j=0; j<16; j++,ptxt+=3)
@@ -134,12 +207,12 @@ void refresh() {
}
sprintf(ptxt, "| "); ptxt +=2;
for (j=0; j<16; j++,ptxt++)
- sprintf(ptxt, "%c", ((c=MMU_readByte(cpu, addr+j))<32)?'.':((c&0x80)?',':c));
+ sprintf(ptxt, "%c", ((c=MMU_readByte(cpu, addr+j))<0x20)?'.':((c>=0x7F)?'.':c)); // only ASCII printable
addr += 16;
*(ptxt)=0;
pango_layout_set_text(playout, txt, -1);
- pango_layout_set_attributes(playout,attr_Text);
+ pango_layout_set_attributes(playout, attr);
gdk_draw_layout(area->window, GC, x, y, playout);
}
diff --git a/desmume/src/gtk-glade/dTools/callbacks_dtools.h b/desmume/src/gtk-glade/dTools/callbacks_dtools.h
index 1fc9ea588..8dcbf02fa 100755
--- a/desmume/src/gtk-glade/dTools/callbacks_dtools.h
+++ b/desmume/src/gtk-glade/dTools/callbacks_dtools.h
@@ -54,5 +54,6 @@ void on_wtools_2_r32_toggled (GtkToggleButton *togglebutton, gpointer
void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data);
void on_wtools_2_GotoAddress_changed (GtkEntry *entry, gpointer user_data);
void on_wtools_2_GotoButton_clicked (GtkButton *button, gpointer user_data);
-void on_wtools_2_scroll_scroll_child (GtkScrolledWindow *scrolledwindow, GtkScrollType scroll, gboolean horizontal, gpointer user_data);
+void on_wtools_2_scroll_value_changed (GtkRange *range, gpointer user_data);
gboolean on_wtools_2_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
+gboolean on_wtools_2_draw_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data);
diff --git a/desmume/src/gtk-glade/glade/DeSmuMe.glade b/desmume/src/gtk-glade/glade/DeSmuMe.glade
index a3dd450dd..24068b79b 100755
--- a/desmume/src/gtk-glade/glade/DeSmuMe.glade
+++ b/desmume/src/gtk-glade/glade/DeSmuMe.glade
@@ -117,7 +117,7 @@
-
+
True
gtk-refresh
1
@@ -328,7 +328,7 @@
-
+
True
gtk-preferences
1
@@ -349,7 +349,7 @@
-
+
True
gtk-preferences
1
@@ -423,7 +423,7 @@
-
+
True
gtk-properties
1
@@ -437,11 +437,23 @@
-
diff --git a/desmume/src/gtk-glade/glade/DeSmuMe_Dtools.glade b/desmume/src/gtk-glade/glade/DeSmuMe_Dtools.glade
index dba8e9de3..f015d5bbc 100755
--- a/desmume/src/gtk-glade/glade/DeSmuMe_Dtools.glade
+++ b/desmume/src/gtk-glade/glade/DeSmuMe_Dtools.glade
@@ -600,7 +600,7 @@ cpu : ARM9
True
False
True
-
+
@@ -640,23 +640,157 @@ cpu : ARM9
True
2
- 7
+ 2
False
0
0
-
+
True
- True
- 8 bit
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
+ False
+ 0
+
+
+
+ True
+ True
+ 8 bit
+ True
+ GTK_RELIEF_NORMAL
+ True
+ True
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ 16 bit
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+ wtools_2_r8
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ 32 bit
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+ wtools_2_r8
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ ARM9 cpu
+ARM7 cpu
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ GoTo:
+ False
+ False
+ GTK_JUSTIFY_RIGHT
+ False
+ False
+ 0
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ True
+ False
+
+
+
+
+
+ True
+ True
+ True
+ True
+ 10
+ 0x00000000
+ True
+ ●
+ False
+
+
+
+
+ 0
+ False
+ True
+
+
+
+
+
+ True
+ True
+ Go!
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ 0
+ False
+ False
+
+
0
@@ -664,178 +798,39 @@ cpu : ARM9
0
1
fill
-
-
+
True
- True
- 16 bit
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
- wtools_2_r8
-
+ GTK_UPDATE_CONTINUOUS
+ False
+ 0 0 0 0 0 0
+
1
2
- 0
- 1
- fill
-
-
-
-
-
-
- True
- True
- 32 bit
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
- wtools_2_r8
-
-
-
- 2
- 3
- 0
- 1
- fill
-
-
-
-
-
-
- True
- GoTo:
- False
- False
- GTK_JUSTIFY_RIGHT
- False
- False
- 0
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 3
- 4
- 0
- 1
- fill
-
-
-
-
-
-
- True
- True
- True
- True
- 10
- 0x0000000
- True
- ●
- False
-
-
-
-
- 4
- 5
- 0
- 1
-
-
-
-
-
-
- True
- True
- Go!
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
- 5
- 6
- 0
- 1
- fill
-
-
-
-
-
-
- True
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_ALWAYS
- GTK_SHADOW_NONE
- GTK_CORNER_TOP_LEFT
-
-
-
-
- True
- GTK_SHADOW_IN
-
-
-
- True
-
-
-
-
-
-
-
- 0
- 7
1
2
fill
+ fill
-
+
True
- ARM9 cpu
-ARM7 cpu
- False
- True
-
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+
+
- 6
- 7
- 0
- 1
- fill
- fill
+ 0
+ 1
+ 1
+ 2