From e6bb0125ec84a21eb5d28b4e30c0c55dbe6990e3 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 26 Feb 2010 11:48:15 +0000 Subject: [PATCH] spu2-x: In Linux, add a Debug dialog. Add frames to the other dialogs. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2646 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/spu2-x/src/Linux/Config.cpp | 78 ++++++----- plugins/spu2-x/src/Linux/Config.h | 1 - plugins/spu2-x/src/Linux/ConfigDebug.cpp | 132 +++++++++++++++++- plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp | 22 +-- 4 files changed, 188 insertions(+), 45 deletions(-) diff --git a/plugins/spu2-x/src/Linux/Config.cpp b/plugins/spu2-x/src/Linux/Config.cpp index ba7a64ffbf..929e102e4d 100644 --- a/plugins/spu2-x/src/Linux/Config.cpp +++ b/plugins/spu2-x/src/Linux/Config.cpp @@ -95,28 +95,30 @@ void advanced_dialog() SoundtouchCfg::DisplayDialog(); } +void debug_dialog() +{ + DebugConfig::DisplayDialog(); +} + void DisplayDialog() { - GtkWidget *dialog, *main_label; int return_value; - GtkWidget *mixing_label; + GtkWidget *dialog; + GtkWidget *main_frame, *main_box; + GtkWidget *mixing_frame, *mixing_box; GtkWidget *int_label, *int_box; - GtkWidget *effects_check; - GtkWidget *reverb_label, *reverb_box; + GtkWidget *debug_check; + GtkWidget *debug_button; - GtkWidget *output_label; - + GtkWidget *output_frame, *output_box; GtkWidget *mod_label, *mod_box; - GtkWidget *latency_slide; GtkWidget *time_check; GtkWidget *advanced_button; - - GtkWidget *mixing_vbox, *output_vbox, *main_hbox; /* Create the widgets */ dialog = gtk_dialog_new_with_buttons ( @@ -128,10 +130,6 @@ void DisplayDialog() GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - - main_label = gtk_label_new ("Spu2-X Config"); - - mixing_label = gtk_label_new ("Mixing Settings:"); int_label = gtk_label_new ("Interpolation:"); int_box = gtk_combo_box_new_text (); @@ -150,8 +148,9 @@ void DisplayDialog() gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "8X - Reverb Volume x 8"); gtk_combo_box_set_active(GTK_COMBO_BOX(reverb_box), ReverbBoost); - output_label = gtk_label_new ("Output Settings:"); - + debug_check = gtk_check_button_new_with_label("Enable Debug Options"); + debug_button = gtk_button_new_with_label("Debug..."); + mod_label = gtk_label_new ("Module:"); mod_box = gtk_combo_box_new_text (); gtk_combo_box_append_text(GTK_COMBO_BOX(mod_box), "0 - No Sound (emulate SPU2 only)"); @@ -168,41 +167,50 @@ void DisplayDialog() advanced_button = gtk_button_new_with_label("Advanced..."); - mixing_vbox = gtk_vbox_new(false, 5); - output_vbox = gtk_vbox_new(false, 5); - main_hbox = gtk_hbox_new(false, 5); + main_box = gtk_hbox_new(false, 5); + main_frame = gtk_frame_new ("Spu2-X Config"); + gtk_container_add (GTK_CONTAINER(main_frame), main_box); - gtk_container_add(GTK_CONTAINER(mixing_vbox), mixing_label); - gtk_container_add(GTK_CONTAINER(mixing_vbox), int_label); - gtk_container_add(GTK_CONTAINER(mixing_vbox), int_box); - gtk_container_add(GTK_CONTAINER(mixing_vbox), effects_check); - gtk_container_add(GTK_CONTAINER(mixing_vbox), reverb_label); - gtk_container_add(GTK_CONTAINER(mixing_vbox), reverb_box); + mixing_box = gtk_vbox_new(false, 5); + mixing_frame = gtk_frame_new ("Mixing Settings:"); + gtk_container_add (GTK_CONTAINER(mixing_frame), mixing_box); + + output_box = gtk_vbox_new(false, 5); + output_frame = gtk_frame_new ("Output Settings:"); + gtk_container_add (GTK_CONTAINER(output_frame), output_box); + + gtk_container_add(GTK_CONTAINER(mixing_box), int_label); + gtk_container_add(GTK_CONTAINER(mixing_box), int_box); + gtk_container_add(GTK_CONTAINER(mixing_box), effects_check); + gtk_container_add(GTK_CONTAINER(mixing_box), reverb_label); + gtk_container_add(GTK_CONTAINER(mixing_box), reverb_box); + gtk_container_add(GTK_CONTAINER(mixing_box), debug_check); + gtk_container_add(GTK_CONTAINER(mixing_box), debug_button); - gtk_container_add(GTK_CONTAINER(output_vbox), output_label); - gtk_container_add(GTK_CONTAINER(output_vbox), mod_label); - gtk_container_add(GTK_CONTAINER(output_vbox), mod_box); - gtk_container_add(GTK_CONTAINER(output_vbox), latency_slide); - gtk_container_add(GTK_CONTAINER(output_vbox), advanced_button); - gtk_container_add(GTK_CONTAINER(output_vbox), time_check); + gtk_container_add(GTK_CONTAINER(output_box), mod_label); + gtk_container_add(GTK_CONTAINER(output_box), mod_box); + gtk_container_add(GTK_CONTAINER(output_box), latency_slide); + gtk_container_add(GTK_CONTAINER(output_box), advanced_button); + gtk_container_add(GTK_CONTAINER(output_box), time_check); - gtk_container_add(GTK_CONTAINER(main_hbox), mixing_vbox); - gtk_container_add(GTK_CONTAINER(main_hbox), output_vbox); + gtk_container_add(GTK_CONTAINER(main_box), mixing_frame); + gtk_container_add(GTK_CONTAINER(main_box), output_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effects_check), EffectsDisabled); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(debug_check), DebugEnabled); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(time_check), timeStretchDisabled); - /* Add all our widgets, and show everything we've added to the dialog. */ - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_label); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_hbox); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); gtk_widget_show_all (dialog); g_signal_connect_swapped(GTK_OBJECT (advanced_button), "clicked", G_CALLBACK(advanced_dialog), advanced_button); + g_signal_connect_swapped(GTK_OBJECT (debug_button), "clicked", G_CALLBACK(debug_dialog), debug_button); return_value = gtk_dialog_run (GTK_DIALOG (dialog)); if (return_value == GTK_RESPONSE_ACCEPT) { + DebugEnabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(debug_check)); if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) Interpolation = gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)); diff --git a/plugins/spu2-x/src/Linux/Config.h b/plugins/spu2-x/src/Linux/Config.h index 042bfada48..327eb74b36 100644 --- a/plugins/spu2-x/src/Linux/Config.h +++ b/plugins/spu2-x/src/Linux/Config.h @@ -109,6 +109,5 @@ void ReadSettings(); void WriteSettings(); void configure(); void AboutBox(); -extern void advanced_dialog(); #endif // CONFIG_H_INCLUDED diff --git a/plugins/spu2-x/src/Linux/ConfigDebug.cpp b/plugins/spu2-x/src/Linux/ConfigDebug.cpp index da82fbb17d..a880086f5f 100644 --- a/plugins/spu2-x/src/Linux/ConfigDebug.cpp +++ b/plugins/spu2-x/src/Linux/ConfigDebug.cpp @@ -17,6 +17,7 @@ #include "Global.h" #include "Dialogs.h" +#include "Config.h" bool DebugEnabled=false; bool _MsgToConsole=false; @@ -81,6 +82,7 @@ void ReadSettings() _RegDump = CfgReadBool(Section, L"Dump_Regs",0); set_default_filenames(); + /*CfgReadStr(Section,L"Access_Log_Filename",AccessLogFileName,255,L"logs/SPU2Log.txt"); CfgReadStr(Section,L"WaveLog_Filename", WaveLogFileName, 255,L"logs/SPU2log.wav"); CfgReadStr(Section,L"DMA4Log_Filename", DMA4LogFileName, 255,L"logs/SPU2dma4.dat"); @@ -126,8 +128,136 @@ void WriteSettings() void DisplayDialog() { + GtkWidget *dialog, *main_label; + int return_value; + + GtkWidget *msg_box, *log_box, *dump_box, *main_box; + GtkWidget *msg_frame, *log_frame, *dump_frame, *main_frame; + + GtkWidget *msg_console_check, *msg_key_check, *msg_voice_check, *msg_dma_check; + GtkWidget *msg_autodma_check, *msg_overrun_check, *msg_cache_check; + + GtkWidget *log_access_check, *log_dma_check, *log_wave_check; + GtkWidget *dump_core_check, *dump_mem_check, *dump_reg_check; + ReadSettings(); - WriteSettings(); + + // Create the widgets + dialog = gtk_dialog_new_with_buttons ( + "Spu2-X Config", + NULL, // parent window + (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT, + NULL); + + main_box = gtk_hbox_new(false, 5); + main_frame = gtk_frame_new ("Spu2-X Config"); + gtk_container_add (GTK_CONTAINER(main_frame), main_box); + + // Message Section + + msg_box = gtk_vbox_new(false, 5); + + msg_console_check = gtk_check_button_new_with_label("Show In Console"); + msg_key_check = gtk_check_button_new_with_label("KeyOn/Off Events"); + msg_voice_check = gtk_check_button_new_with_label("Voice Stop Events"); + msg_dma_check = gtk_check_button_new_with_label("DMA Operations"); + msg_autodma_check = gtk_check_button_new_with_label("AutoDMA Operations"); + msg_overrun_check = gtk_check_button_new_with_label("Buffer Over/Underruns"); + msg_cache_check = gtk_check_button_new_with_label("ADPCM Cache Statistics"); + + gtk_container_add(GTK_CONTAINER(msg_box), msg_console_check); + gtk_container_add(GTK_CONTAINER(msg_box), msg_key_check); + gtk_container_add(GTK_CONTAINER(msg_box), msg_voice_check); + gtk_container_add(GTK_CONTAINER(msg_box), msg_dma_check); + gtk_container_add(GTK_CONTAINER(msg_box), msg_autodma_check); + gtk_container_add(GTK_CONTAINER(msg_box), msg_overrun_check); + gtk_container_add(GTK_CONTAINER(msg_box), msg_cache_check); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_console_check), _MsgToConsole); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_key_check), _MsgKeyOnOff); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_voice_check), _MsgVoiceOff); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_dma_check), _MsgDMA); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_autodma_check), _MsgAutoDMA); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_overrun_check), _MsgOverruns); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_cache_check), _MsgCache); + + msg_frame = gtk_frame_new ("Message/Log Options"); + gtk_container_add (GTK_CONTAINER(msg_frame), msg_box); + + // Log Section + log_box = gtk_vbox_new(false, 5); + + log_access_check = gtk_check_button_new_with_label("Log Register/DMA Actions"); + log_dma_check = gtk_check_button_new_with_label("Log DMA Writes"); + log_wave_check = gtk_check_button_new_with_label("Log Audio Output"); + + gtk_container_add(GTK_CONTAINER(log_box), log_access_check); + gtk_container_add(GTK_CONTAINER(log_box), log_dma_check); + gtk_container_add(GTK_CONTAINER(log_box), log_wave_check); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_access_check), _AccessLog); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_dma_check), _DMALog); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_wave_check), _WaveLog); + + log_frame = gtk_frame_new ("Log Options"); + gtk_container_add (GTK_CONTAINER(log_frame), log_box); + + // Dump Section + dump_box = gtk_vbox_new(false, 5); + + dump_core_check = gtk_check_button_new_with_label("Dump Core and Voice State"); + dump_mem_check = gtk_check_button_new_with_label("Dump Memory Contents"); + dump_reg_check = gtk_check_button_new_with_label("Dump Register Data"); + + gtk_container_add(GTK_CONTAINER(dump_box), dump_core_check); + gtk_container_add(GTK_CONTAINER(dump_box), dump_mem_check); + gtk_container_add(GTK_CONTAINER(dump_box), dump_reg_check); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_core_check), _CoresDump); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_mem_check), _MemDump); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_reg_check), _RegDump); + + dump_frame = gtk_frame_new ("Dumps (on close)"); + gtk_container_add (GTK_CONTAINER(dump_frame), dump_box); + + // Add everything + + gtk_container_add (GTK_CONTAINER(main_box), msg_frame); + gtk_container_add (GTK_CONTAINER(main_box), log_frame); + gtk_container_add (GTK_CONTAINER(main_box), dump_frame); + + // Add all our widgets, and show everything we've added to the dialog. + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); + gtk_widget_show_all (dialog); + + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (return_value == GTK_RESPONSE_ACCEPT) + { + _MsgToConsole = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_console_check)); + _MsgKeyOnOff = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_key_check)); + _MsgVoiceOff = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_voice_check)); + _MsgDMA = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_dma_check)); + _MsgAutoDMA = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_autodma_check)); + _MsgOverruns = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_overrun_check)); + _MsgCache = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_cache_check)); + + _AccessLog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_access_check)); + _DMALog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_dma_check)); + _WaveLog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_wave_check)); + + _CoresDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_core_check)); + _MemDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_mem_check)); + _RegDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_reg_check)); + } + + gtk_widget_destroy (dialog); + + WriteSettings(); } } diff --git a/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp b/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp index 2ff35fcbff..6785710824 100644 --- a/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp +++ b/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp @@ -70,7 +70,7 @@ void restore_defaults() void DisplayDialog() { int return_value; - GtkWidget *dialog, *main_label; + GtkWidget *dialog, *main_label, *main_frame, *main_box; GtkWidget *default_button; ReadSettings(); @@ -103,14 +103,20 @@ void DisplayDialog() over_slide = gtk_hscale_new_with_range(Overlap_Min, Overlap_Max, 1); gtk_range_set_value(GTK_RANGE(over_slide), OverlapMS); + main_box = gtk_vbox_new(false, 5); + main_frame = gtk_frame_new ("Spu2-X Config"); + + gtk_container_add(GTK_CONTAINER (main_box), default_button); + gtk_container_add(GTK_CONTAINER (main_box), seq_label); + gtk_container_add(GTK_CONTAINER (main_box), seq_slide); + gtk_container_add(GTK_CONTAINER (main_box), seek_label); + gtk_container_add(GTK_CONTAINER (main_box), seek_slide); + gtk_container_add(GTK_CONTAINER (main_box), over_label); + gtk_container_add(GTK_CONTAINER (main_box), over_slide); + gtk_container_add (GTK_CONTAINER(main_frame), main_box); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_label); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), default_button); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seq_label); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seq_slide); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seek_label); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seek_slide); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), over_label); - gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), over_slide); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_frame); gtk_widget_show_all (dialog); g_signal_connect_swapped(GTK_OBJECT (default_button), "clicked", G_CALLBACK(restore_defaults), default_button);