Search
lxdream.org :: lxdream/src/gui/callbacks.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui/callbacks.c
changeset 1:eea311cfd33e
next2:42349f6ea216
author nkeynes
date Sat Mar 13 00:03:32 2004 +0000 (16 years ago)
permissions -rw-r--r--
last change This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/gui/callbacks.c Sat Mar 13 00:03:32 2004 +0000
1.3 @@ -0,0 +1,275 @@
1.4 +#ifdef HAVE_CONFIG_H
1.5 +# include <config.h>
1.6 +#endif
1.7 +
1.8 +#include <gnome.h>
1.9 +
1.10 +#include "callbacks.h"
1.11 +#include "interface.h"
1.12 +#include "gui.h"
1.13 +#include "sh4core.h"
1.14 +#include "asic.h"
1.15 +
1.16 +extern int disasm_from;
1.17 +int selected_pc = -1;
1.18 +
1.19 +void
1.20 +on_new_file1_activate (GtkMenuItem *menuitem,
1.21 + gpointer user_data)
1.22 +{
1.23 +
1.24 +}
1.25 +
1.26 +
1.27 +void
1.28 +on_open1_activate (GtkMenuItem *menuitem,
1.29 + gpointer user_data)
1.30 +{
1.31 + open_file_dialog();
1.32 +}
1.33 +
1.34 +
1.35 +void
1.36 +on_save1_activate (GtkMenuItem *menuitem,
1.37 + gpointer user_data)
1.38 +{
1.39 +
1.40 +}
1.41 +
1.42 +
1.43 +void
1.44 +on_save_as1_activate (GtkMenuItem *menuitem,
1.45 + gpointer user_data)
1.46 +{
1.47 +
1.48 +}
1.49 +
1.50 +
1.51 +void
1.52 +on_exit1_activate (GtkMenuItem *menuitem,
1.53 + gpointer user_data)
1.54 +{
1.55 + gtk_main_quit();
1.56 +}
1.57 +
1.58 +
1.59 +void
1.60 +on_preferences1_activate (GtkMenuItem *menuitem,
1.61 + gpointer user_data)
1.62 +{
1.63 +
1.64 +}
1.65 +
1.66 +
1.67 +void
1.68 +on_about1_activate (GtkMenuItem *menuitem,
1.69 + gpointer user_data)
1.70 +{
1.71 + GtkWidget *about = create_about_win();
1.72 + gtk_widget_show(about);
1.73 +}
1.74 +
1.75 +
1.76 +void
1.77 +on_load_btn_clicked (GtkButton *button,
1.78 + gpointer user_data)
1.79 +{
1.80 + open_file_dialog();
1.81 +}
1.82 +
1.83 +
1.84 +void
1.85 +on_reset_btn_clicked (GtkButton *button,
1.86 + gpointer user_data)
1.87 +{
1.88 + sh4_reset();
1.89 + mem_reset();
1.90 + update_registers();
1.91 +}
1.92 +
1.93 +
1.94 +void
1.95 +on_stop_btn_clicked (GtkButton *button,
1.96 + gpointer user_data)
1.97 +{
1.98 + if( sh4_isrunning() ) {
1.99 + sh4_stop();
1.100 + }
1.101 +}
1.102 +
1.103 +
1.104 +void
1.105 +on_step_btn_clicked (GtkButton *button,
1.106 + gpointer user_data)
1.107 +{
1.108 + sh4_execute_instruction();
1.109 + update_registers();
1.110 +}
1.111 +
1.112 +
1.113 +void run( uint32_t target ) {
1.114 + if( ! sh4_isrunning() ) {
1.115 + do {
1.116 + if( target == -1 )
1.117 + sh4_runfor(1000000);
1.118 + else
1.119 + sh4_runto(target, 1000000);
1.120 + update_icount();
1.121 + run_timers(1000000);
1.122 + while( gtk_events_pending() )
1.123 + gtk_main_iteration();
1.124 + pvr2_next_frame();
1.125 + } while( sh4_isrunning() );
1.126 + update_registers();
1.127 + }
1.128 +}
1.129 +void
1.130 +on_run_btn_clicked (GtkButton *button,
1.131 + gpointer user_data)
1.132 +{
1.133 + run(-1);
1.134 +}
1.135 +
1.136 +
1.137 +void
1.138 +on_runto_btn_clicked (GtkButton *button,
1.139 + gpointer user_data)
1.140 +{
1.141 + if( selected_pc == -1 )
1.142 + WARN( "No address selected, so can't run to it", NULL );
1.143 + else {
1.144 + INFO( "Running until %08X...", selected_pc );
1.145 + run( selected_pc );
1.146 + }
1.147 +}
1.148 +
1.149 +
1.150 +void
1.151 +on_break_btn_clicked (GtkButton *button,
1.152 + gpointer user_data)
1.153 +{
1.154 +
1.155 +}
1.156 +
1.157 +
1.158 +gboolean
1.159 +on_debug_win_delete_event (GtkWidget *widget,
1.160 + GdkEvent *event,
1.161 + gpointer user_data)
1.162 +{
1.163 + gtk_main_quit();
1.164 + return FALSE;
1.165 +}
1.166 +
1.167 +
1.168 +void
1.169 +on_disasm_list_select_row (GtkCList *clist,
1.170 + gint row,
1.171 + gint column,
1.172 + GdkEvent *event,
1.173 + gpointer user_data)
1.174 +{
1.175 + selected_pc = disasm_from + (row<<1);
1.176 +}
1.177 +
1.178 +
1.179 +void
1.180 +on_disasm_list_unselect_row (GtkCList *clist,
1.181 + gint row,
1.182 + gint column,
1.183 + GdkEvent *event,
1.184 + gpointer user_data)
1.185 +{
1.186 + int pc = disasm_from + (row<<1);
1.187 + if( selected_pc == pc ) selected_pc = -1;
1.188 +}
1.189 +
1.190 +
1.191 +void
1.192 +on_mem_mapped_regs1_activate (GtkMenuItem *menuitem,
1.193 + gpointer user_data)
1.194 +{
1.195 + mmr_open_win();
1.196 +}
1.197 +
1.198 +
1.199 +gboolean
1.200 +on_mmr_win_delete_event (GtkWidget *widget,
1.201 + GdkEvent *event,
1.202 + gpointer user_data)
1.203 +{
1.204 + mmr_close_win();
1.205 + return TRUE;
1.206 +}
1.207 +
1.208 +
1.209 +void
1.210 +on_mmr_close_clicked (GtkButton *button,
1.211 + gpointer user_data)
1.212 +{
1.213 + mmr_close_win();
1.214 +}
1.215 +
1.216 +
1.217 +void
1.218 +on_mode_field_changed (GtkEditable *editable,
1.219 + gpointer user_data)
1.220 +{
1.221 +
1.222 +}
1.223 +
1.224 +
1.225 +void
1.226 +on_page_locked_btn_toggled (GtkToggleButton *togglebutton,
1.227 + gpointer user_data)
1.228 +{
1.229 +
1.230 +}
1.231 +
1.232 +
1.233 +gboolean
1.234 +on_page_field_key_press_event (GtkWidget *widget,
1.235 + GdkEventKey *event,
1.236 + gpointer user_data)
1.237 +{
1.238 + if( event->keyval == GDK_Return || event->keyval == GDK_Linefeed ) {
1.239 + gchar *text = gtk_entry_get_text( GTK_ENTRY(widget) );
1.240 + gchar *endptr;
1.241 + unsigned int val = strtoul( text, &endptr, 16 );
1.242 + if( text == endptr ) { /* invalid input */
1.243 + char buf[10];
1.244 + sprintf( buf, "%08X", disasm_from );
1.245 + gtk_entry_set_text( GTK_ENTRY(widget), buf );
1.246 + } else {
1.247 + set_disassembly_region(val);
1.248 + }
1.249 + }
1.250 + return FALSE;
1.251 +}
1.252 +
1.253 +
1.254 +void
1.255 +on_output_list_select_row (GtkCList *clist,
1.256 + gint row,
1.257 + gint column,
1.258 + GdkEvent *event,
1.259 + gpointer user_data)
1.260 +{
1.261 + if( event->type == GDK_2BUTTON_PRESS && event->button.button == 1 ) {
1.262 + char *val;
1.263 + gtk_clist_get_text( clist, row, 1, &val );
1.264 + if( val[0] != '\0' ) {
1.265 + int addr = strtoul( val, NULL, 16 );
1.266 + jump_to_disassembly( addr, TRUE );
1.267 + }
1.268 + }
1.269 +}
1.270 +
1.271 +
1.272 +void
1.273 +on_jump_pc_btn_clicked (GtkButton *button,
1.274 + gpointer user_data)
1.275 +{
1.276 + jump_to_disassembly( sh4r.pc, TRUE );
1.277 +}
1.278 +
.