Linux: Hack microVU into the Gui.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1275 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-27 13:10:43 +00:00
parent 477f5fa674
commit e8ae911664
8 changed files with 732 additions and 343 deletions

View File

@ -55,7 +55,7 @@
# else # else
# define jBREAKPOINT() ((void) *(volatile char *) 0) # define jBREAKPOINT() ((void) *(volatile char *) 0)
# endif # endif
# define jASSUME(exp) do { if(exp) ; else jBREAKPOINT() } while(0); # define jASSUME(exp) do { if(exp) ; else jBREAKPOINT(); } while(0);
# endif # endif
#endif #endif
@ -94,6 +94,13 @@ default: \
#define __naked __declspec(naked) #define __naked __declspec(naked)
#define __unused /*unused*/ #define __unused /*unused*/
#define __noinline __declspec(noinline) #define __noinline __declspec(noinline)
// Don't know if there are Visual C++ equivalents of these.
#define __hot
#define __cold
#define likely(x) x
#define unlikely(x) x
#define CALLBACK __stdcall #define CALLBACK __stdcall
#else #else
@ -106,7 +113,7 @@ default: \
/* Test for GCC > 4.4.0; Should be adjusted when new versions come out */ /* Test for GCC > 4.4.0; Should be adjusted when new versions come out */
#if GCC_VERSION >= 40400 #if GCC_VERSION >= 40400
#define THE_UNBEARABLE_LIGHTNESS_OF_BEING_GCC_4_4_0 #define THE_UNBEARABLE_LIGHTNESS_OF_BEING_GCC_4_4_0
#define __nooptimization __attribute__((optimize("O0")) #define __nooptimization __attribute__((optimize("O0")))
#endif #endif
/* /*
@ -137,6 +144,10 @@ This theoretically unoptimizes. Not having much luck so far.
#define _inline __inline__ __attribute__((unused)) #define _inline __inline__ __attribute__((unused))
#define __forceinline __attribute__((always_inline,unused)) #define __forceinline __attribute__((always_inline,unused))
#define __noinline __attribute__((noinline)) #define __noinline __attribute__((noinline))
#define __hot __attribute__((hot))
#define __cold __attribute__((cold))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif #endif
#ifndef THE_UNBEARABLE_LIGHTNESS_OF_BEING_GCC_4_4_0 #ifndef THE_UNBEARABLE_LIGHTNESS_OF_BEING_GCC_4_4_0

View File

@ -31,6 +31,10 @@ void OnCpu_Ok(GtkButton *button, gpointer user_data)
newopts |= PCSX2_VU0REC; newopts |= PCSX2_VU0REC;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec")))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec"))))
newopts |= PCSX2_VU1REC; newopts |= PCSX2_VU1REC;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_microVU0rec"))))
newopts |= PCSX2_MICROVU0;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_microVU1rec"))))
newopts |= PCSX2_MICROVU1;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS")))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS"))))
newopts |= PCSX2_GSMULTITHREAD; newopts |= PCSX2_GSMULTITHREAD;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal")))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal"))))
@ -82,6 +86,8 @@ void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data)
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec")), !!CHECK_EEREC); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_EERec")), !!CHECK_EEREC);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec")), !!CHECK_VU0REC); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU0rec")), !!CHECK_VU0REC);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec")), !!CHECK_VU1REC); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_VU1rec")), !!CHECK_VU1REC);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_microVU0rec")), !!CHECK_MICROVU0);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_microVU1rec")), !!CHECK_MICROVU1);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS")), !!CHECK_MULTIGS); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkCheckButton_MTGS")), !!CHECK_MULTIGS);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_NORMAL); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitNormal")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_NORMAL);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_LIMIT); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(CpuDlg, "GtkRadioButton_LimitLimit")), CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_LIMIT);

View File

@ -79,6 +79,9 @@ void on_Speed_Hacks(GtkMenuItem *menuitem, gpointer user_data)
set_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack", Config.Hacks.WaitCycleExt); set_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack", Config.Hacks.WaitCycleExt);
set_checked(SpeedHacksDlg, "check_intc_sync_hack", Config.Hacks.INTCSTATSlow); set_checked(SpeedHacksDlg, "check_intc_sync_hack", Config.Hacks.INTCSTATSlow);
set_checked(SpeedHacksDlg, "check_idle_loop_fastforward", Config.Hacks.IdleLoopFF); set_checked(SpeedHacksDlg, "check_idle_loop_fastforward", Config.Hacks.IdleLoopFF);
set_checked(SpeedHacksDlg, "check_microvu_flag_hack_1", Config.Hacks.vuFlagHack1);
set_checked(SpeedHacksDlg, "check_microvu_flag_hack_2", Config.Hacks.vuFlagHack2);
set_checked(SpeedHacksDlg, "check_microvu_min_max_hack", Config.Hacks.vuMinMax);
gtk_range_set_value(vuScale, Config.Hacks.VUCycleSteal); gtk_range_set_value(vuScale, Config.Hacks.VUCycleSteal);
on_vu_slider_changed(vuScale, NULL); on_vu_slider_changed(vuScale, NULL);
@ -101,6 +104,9 @@ void on_Speed_Hack_OK(GtkButton *button, gpointer user_data)
newhacks.WaitCycleExt = is_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack"); newhacks.WaitCycleExt = is_checked(SpeedHacksDlg, "check_wait_cycles_sync_hack");
newhacks.INTCSTATSlow = is_checked(SpeedHacksDlg, "check_intc_sync_hack"); newhacks.INTCSTATSlow = is_checked(SpeedHacksDlg, "check_intc_sync_hack");
newhacks.IdleLoopFF = is_checked(SpeedHacksDlg, "check_idle_loop_fastforward"); newhacks.IdleLoopFF = is_checked(SpeedHacksDlg, "check_idle_loop_fastforward");
newhacks.vuFlagHack1 = is_checked(SpeedHacksDlg, "check_microvu_flag_hack_1");
newhacks.vuFlagHack2 = is_checked(SpeedHacksDlg, "check_microvu_flag_hack_2");
newhacks.vuMinMax = is_checked(SpeedHacksDlg, "check_microvu_min_max_hack");
newhacks.VUCycleSteal = gtk_range_get_value(GTK_RANGE(lookup_widget(SpeedHacksDlg, "VUCycleHackScale"))); newhacks.VUCycleSteal = gtk_range_get_value(GTK_RANGE(lookup_widget(SpeedHacksDlg, "VUCycleHackScale")));
newhacks.EECycleRate = gtk_range_get_value(GTK_RANGE(lookup_widget(SpeedHacksDlg, "EECycleHackScale"))); newhacks.EECycleRate = gtk_range_get_value(GTK_RANGE(lookup_widget(SpeedHacksDlg, "EECycleHackScale")));

View File

@ -644,9 +644,19 @@ create_SpeedHacksDlg (void)
GtkWidget *check_idle_loop_fastforward; GtkWidget *check_idle_loop_fastforward;
GtkWidget *label110; GtkWidget *label110;
GtkWidget *hseparator1; GtkWidget *hseparator1;
GtkWidget *frame41;
GtkWidget *alignment36;
GtkWidget *vbox75;
GtkWidget *check_microvu_flag_hack_1;
GtkWidget *check_microvu_flag_hack_2;
GtkWidget *check_microvu_min_max_hack;
GtkWidget *label113;
GtkWidget *dialog_action_area3; GtkWidget *dialog_action_area3;
GtkWidget *button99; GtkWidget *button99;
GtkWidget *button98; GtkWidget *button98;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
SpeedHacksDlg = gtk_dialog_new (); SpeedHacksDlg = gtk_dialog_new ();
gtk_widget_set_name (SpeedHacksDlg, "SpeedHacksDlg"); gtk_widget_set_name (SpeedHacksDlg, "SpeedHacksDlg");
@ -717,7 +727,7 @@ create_SpeedHacksDlg (void)
gtk_box_pack_start (GTK_BOX (vbox61), label91, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox61), label91, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (label91), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label91), TRUE);
label105 = gtk_label_new (_("<b>EmotionEngine (EE) Sync Hacks</b>")); label105 = gtk_label_new (_("EmotionEngine (EE) Sync Hacks"));
gtk_widget_set_name (label105, "label105"); gtk_widget_set_name (label105, "label105");
gtk_widget_show (label105); gtk_widget_show (label105);
gtk_frame_set_label_widget (GTK_FRAME (frame37), label105); gtk_frame_set_label_widget (GTK_FRAME (frame37), label105);
@ -752,7 +762,7 @@ create_SpeedHacksDlg (void)
gtk_box_pack_start (GTK_BOX (vbox73), vu_cycle_stealing_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox73), vu_cycle_stealing_label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (vu_cycle_stealing_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (vu_cycle_stealing_label), TRUE);
label111 = gtk_label_new (_("<b>VU Cycle Stealing (Speedup for 3d geometry)</b>")); label111 = gtk_label_new (_("VU Cycle Stealing (Speedup for 3d geometry)"));
gtk_widget_set_name (label111, "label111"); gtk_widget_set_name (label111, "label111");
gtk_widget_show (label111); gtk_widget_show (label111);
gtk_frame_set_label_widget (GTK_FRAME (frame39), label111); gtk_frame_set_label_widget (GTK_FRAME (frame39), label111);
@ -767,8 +777,9 @@ create_SpeedHacksDlg (void)
gtk_widget_set_name (check_iop_cycle_rate, "check_iop_cycle_rate"); gtk_widget_set_name (check_iop_cycle_rate, "check_iop_cycle_rate");
gtk_widget_show (check_iop_cycle_rate); gtk_widget_show (check_iop_cycle_rate);
gtk_box_pack_start (GTK_BOX (vbox60), check_iop_cycle_rate, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox60), check_iop_cycle_rate, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_iop_cycle_rate, _("Small speedup, and works well with most games."), NULL);
label96 = gtk_label_new (_("Small speedup, and works well with most games,")); label96 = gtk_label_new (_("Small speedup, and works well with most games."));
gtk_widget_set_name (label96, "label96"); gtk_widget_set_name (label96, "label96");
gtk_widget_show (label96); gtk_widget_show (label96);
gtk_box_pack_start (GTK_BOX (vbox60), label96, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox60), label96, FALSE, FALSE, 0);
@ -778,6 +789,7 @@ create_SpeedHacksDlg (void)
gtk_widget_set_name (check_wait_cycles_sync_hack, "check_wait_cycles_sync_hack"); gtk_widget_set_name (check_wait_cycles_sync_hack, "check_wait_cycles_sync_hack");
gtk_widget_show (check_wait_cycles_sync_hack); gtk_widget_show (check_wait_cycles_sync_hack);
gtk_box_pack_start (GTK_BOX (vbox60), check_wait_cycles_sync_hack, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox60), check_wait_cycles_sync_hack, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_wait_cycles_sync_hack, _("Small speedup. Works well with most games, but it may cause certain games to crash, or freeze up during bootup or stage changes."), NULL);
label97 = gtk_label_new (_("Small speedup. Works well with most games, but it may cause certain games to crash, or freeze up during bootup or stage changes.")); label97 = gtk_label_new (_("Small speedup. Works well with most games, but it may cause certain games to crash, or freeze up during bootup or stage changes."));
gtk_widget_set_name (label97, "label97"); gtk_widget_set_name (label97, "label97");
@ -789,6 +801,7 @@ create_SpeedHacksDlg (void)
gtk_widget_set_name (check_intc_sync_hack, "check_intc_sync_hack"); gtk_widget_set_name (check_intc_sync_hack, "check_intc_sync_hack");
gtk_widget_show (check_intc_sync_hack); gtk_widget_show (check_intc_sync_hack);
gtk_box_pack_start (GTK_BOX (vbox60), check_intc_sync_hack, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox60), check_intc_sync_hack, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_intc_sync_hack, _("Huge speedup in many games, and a pretty high compatibility rate (some games still work better with EE sync hacks)."), NULL);
label101 = gtk_label_new (_("Huge speedup in many games, and a pretty high compatibility rate (some games still work better with EE sync hacks).")); label101 = gtk_label_new (_("Huge speedup in many games, and a pretty high compatibility rate (some games still work better with EE sync hacks)."));
gtk_widget_set_name (label101, "label101"); gtk_widget_set_name (label101, "label101");
@ -805,8 +818,9 @@ create_SpeedHacksDlg (void)
gtk_widget_set_name (check_idle_loop_fastforward, "check_idle_loop_fastforward"); gtk_widget_set_name (check_idle_loop_fastforward, "check_idle_loop_fastforward");
gtk_widget_show (check_idle_loop_fastforward); gtk_widget_show (check_idle_loop_fastforward);
gtk_box_pack_start (GTK_BOX (vbox71), check_idle_loop_fastforward, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox71), check_idle_loop_fastforward, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_idle_loop_fastforward, _("Speedup for a few games, including FFX with no known side effects."), NULL);
label110 = gtk_label_new (_("Speedup for a few games, including FFX with no known side effects. More later.")); label110 = gtk_label_new (_("Speedup for a few games, including FFX with no known side effects."));
gtk_widget_set_name (label110, "label110"); gtk_widget_set_name (label110, "label110");
gtk_widget_show (label110); gtk_widget_show (label110);
gtk_box_pack_start (GTK_BOX (vbox71), label110, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox71), label110, FALSE, FALSE, 0);
@ -817,6 +831,46 @@ create_SpeedHacksDlg (void)
gtk_widget_show (hseparator1); gtk_widget_show (hseparator1);
gtk_box_pack_start (GTK_BOX (vbox60), hseparator1, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox60), hseparator1, FALSE, FALSE, 0);
frame41 = gtk_frame_new (NULL);
gtk_widget_set_name (frame41, "frame41");
gtk_widget_show (frame41);
gtk_box_pack_start (GTK_BOX (dialog_vbox3), frame41, TRUE, TRUE, 0);
alignment36 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment36, "alignment36");
gtk_widget_show (alignment36);
gtk_container_add (GTK_CONTAINER (frame41), alignment36);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment36), 0, 0, 12, 0);
vbox75 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox75, "vbox75");
gtk_widget_show (vbox75);
gtk_container_add (GTK_CONTAINER (alignment36), vbox75);
check_microvu_flag_hack_1 = gtk_check_button_new_with_mnemonic (_("Flag Hack 1 (microVU only)"));
gtk_widget_set_name (check_microvu_flag_hack_1, "check_microvu_flag_hack_1");
gtk_widget_show (check_microvu_flag_hack_1);
gtk_box_pack_start (GTK_BOX (vbox75), check_microvu_flag_hack_1, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_microvu_flag_hack_1, _("Big Speedup and moderately compatible. May cause SPS and Infinite loop problems."), NULL);
check_microvu_flag_hack_2 = gtk_check_button_new_with_mnemonic (_("Flag Hack 2 (microVU only)"));
gtk_widget_set_name (check_microvu_flag_hack_2, "check_microvu_flag_hack_2");
gtk_widget_show (check_microvu_flag_hack_2);
gtk_box_pack_start (GTK_BOX (vbox75), check_microvu_flag_hack_2, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_microvu_flag_hack_2, _("Big Speedup and moderately compatible. SuperVU does something similar by default."), NULL);
check_microvu_min_max_hack = gtk_check_button_new_with_mnemonic (_("Min / Max Hack (microVU only)"));
gtk_widget_set_name (check_microvu_min_max_hack, "check_microvu_min_max_hack");
gtk_widget_show (check_microvu_min_max_hack);
gtk_box_pack_start (GTK_BOX (vbox75), check_microvu_min_max_hack, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_microvu_min_max_hack, _("Small Speedup. May cause SPS, hanging, and missing geometry."), NULL);
label113 = gtk_label_new (_("Vertex Unit (VU) Hacks"));
gtk_widget_set_name (label113, "label113");
gtk_widget_show (label113);
gtk_frame_set_label_widget (GTK_FRAME (frame41), label113);
gtk_label_set_use_markup (GTK_LABEL (label113), TRUE);
dialog_action_area3 = GTK_DIALOG (SpeedHacksDlg)->action_area; dialog_action_area3 = GTK_DIALOG (SpeedHacksDlg)->action_area;
gtk_widget_set_name (dialog_action_area3, "dialog_action_area3"); gtk_widget_set_name (dialog_action_area3, "dialog_action_area3");
gtk_widget_show (dialog_action_area3); gtk_widget_show (dialog_action_area3);
@ -882,9 +936,17 @@ create_SpeedHacksDlg (void)
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, check_idle_loop_fastforward, "check_idle_loop_fastforward"); GLADE_HOOKUP_OBJECT (SpeedHacksDlg, check_idle_loop_fastforward, "check_idle_loop_fastforward");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, label110, "label110"); GLADE_HOOKUP_OBJECT (SpeedHacksDlg, label110, "label110");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, hseparator1, "hseparator1"); GLADE_HOOKUP_OBJECT (SpeedHacksDlg, hseparator1, "hseparator1");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, frame41, "frame41");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, alignment36, "alignment36");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, vbox75, "vbox75");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, check_microvu_flag_hack_1, "check_microvu_flag_hack_1");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, check_microvu_flag_hack_2, "check_microvu_flag_hack_2");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, check_microvu_min_max_hack, "check_microvu_min_max_hack");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, label113, "label113");
GLADE_HOOKUP_OBJECT_NO_REF (SpeedHacksDlg, dialog_action_area3, "dialog_action_area3"); GLADE_HOOKUP_OBJECT_NO_REF (SpeedHacksDlg, dialog_action_area3, "dialog_action_area3");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, button99, "button99"); GLADE_HOOKUP_OBJECT (SpeedHacksDlg, button99, "button99");
GLADE_HOOKUP_OBJECT (SpeedHacksDlg, button98, "button98"); GLADE_HOOKUP_OBJECT (SpeedHacksDlg, button98, "button98");
GLADE_HOOKUP_OBJECT_NO_REF (SpeedHacksDlg, tooltips, "tooltips");
return SpeedHacksDlg; return SpeedHacksDlg;
} }
@ -3859,6 +3921,12 @@ create_CpuDlg (void)
GtkWidget *GtkCheckButton_VU0rec; GtkWidget *GtkCheckButton_VU0rec;
GtkWidget *GtkCheckButton_VU1rec; GtkWidget *GtkCheckButton_VU1rec;
GtkWidget *label32; GtkWidget *label32;
GtkWidget *frame40;
GtkWidget *alignment35;
GtkWidget *vbox74;
GtkWidget *GtkCheckButton_microVU0rec;
GtkWidget *GtkCheckButton_microVU1rec;
GtkWidget *label112;
GtkWidget *GtkCheckButton_MTGS; GtkWidget *GtkCheckButton_MTGS;
GtkWidget *vbox48; GtkWidget *vbox48;
GtkWidget *frame9; GtkWidget *frame9;
@ -3984,11 +4052,44 @@ create_CpuDlg (void)
gtk_widget_show (GtkCheckButton_VU1rec); gtk_widget_show (GtkCheckButton_VU1rec);
gtk_box_pack_start (GTK_BOX (vbox26), GtkCheckButton_VU1rec, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox26), GtkCheckButton_VU1rec, FALSE, FALSE, 0);
label32 = gtk_label_new (_("VU Recompilers - All options are set by default")); label32 = gtk_label_new (_("VU Recompilers"));
gtk_widget_set_name (label32, "label32"); gtk_widget_set_name (label32, "label32");
gtk_widget_show (label32); gtk_widget_show (label32);
gtk_frame_set_label_widget (GTK_FRAME (frame6), label32); gtk_frame_set_label_widget (GTK_FRAME (frame6), label32);
frame40 = gtk_frame_new (NULL);
gtk_widget_set_name (frame40, "frame40");
gtk_widget_show (frame40);
gtk_box_pack_start (GTK_BOX (vbox47), frame40, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (frame40), 5);
alignment35 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment35, "alignment35");
gtk_widget_show (alignment35);
gtk_container_add (GTK_CONTAINER (frame40), alignment35);
gtk_container_set_border_width (GTK_CONTAINER (alignment35), 5);
vbox74 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox74, "vbox74");
gtk_widget_show (vbox74);
gtk_container_add (GTK_CONTAINER (alignment35), vbox74);
GtkCheckButton_microVU0rec = gtk_check_button_new_with_mnemonic (_("microVU0 - Use microVU rec instead of VU0rec. ! Beta !"));
gtk_widget_set_name (GtkCheckButton_microVU0rec, "GtkCheckButton_microVU0rec");
gtk_widget_show (GtkCheckButton_microVU0rec);
gtk_box_pack_start (GTK_BOX (vbox74), GtkCheckButton_microVU0rec, FALSE, FALSE, 0);
GtkCheckButton_microVU1rec = gtk_check_button_new_with_mnemonic (_("microVU1 - Use microVU rec instead of VU1rec. ! Beta !"));
gtk_widget_set_name (GtkCheckButton_microVU1rec, "GtkCheckButton_microVU1rec");
gtk_widget_show (GtkCheckButton_microVU1rec);
gtk_box_pack_start (GTK_BOX (vbox74), GtkCheckButton_microVU1rec, FALSE, FALSE, 0);
label112 = gtk_label_new (_("microVU Recompilers - ! Beta !"));
gtk_widget_set_name (label112, "label112");
gtk_widget_show (label112);
gtk_frame_set_label_widget (GTK_FRAME (frame40), label112);
gtk_label_set_use_markup (GTK_LABEL (label112), TRUE);
GtkCheckButton_MTGS = gtk_check_button_new_with_mnemonic (_("Multi threaded GS mode (MTGS)\n (faster on dual core/HT CPUs, requires pcsx2 restart)")); GtkCheckButton_MTGS = gtk_check_button_new_with_mnemonic (_("Multi threaded GS mode (MTGS)\n (faster on dual core/HT CPUs, requires pcsx2 restart)"));
gtk_widget_set_name (GtkCheckButton_MTGS, "GtkCheckButton_MTGS"); gtk_widget_set_name (GtkCheckButton_MTGS, "GtkCheckButton_MTGS");
gtk_widget_show (GtkCheckButton_MTGS); gtk_widget_show (GtkCheckButton_MTGS);
@ -4194,6 +4295,12 @@ create_CpuDlg (void)
GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_VU0rec, "GtkCheckButton_VU0rec"); GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_VU0rec, "GtkCheckButton_VU0rec");
GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_VU1rec, "GtkCheckButton_VU1rec"); GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_VU1rec, "GtkCheckButton_VU1rec");
GLADE_HOOKUP_OBJECT (CpuDlg, label32, "label32"); GLADE_HOOKUP_OBJECT (CpuDlg, label32, "label32");
GLADE_HOOKUP_OBJECT (CpuDlg, frame40, "frame40");
GLADE_HOOKUP_OBJECT (CpuDlg, alignment35, "alignment35");
GLADE_HOOKUP_OBJECT (CpuDlg, vbox74, "vbox74");
GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_microVU0rec, "GtkCheckButton_microVU0rec");
GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_microVU1rec, "GtkCheckButton_microVU1rec");
GLADE_HOOKUP_OBJECT (CpuDlg, label112, "label112");
GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_MTGS, "GtkCheckButton_MTGS"); GLADE_HOOKUP_OBJECT (CpuDlg, GtkCheckButton_MTGS, "GtkCheckButton_MTGS");
GLADE_HOOKUP_OBJECT (CpuDlg, vbox48, "vbox48"); GLADE_HOOKUP_OBJECT (CpuDlg, vbox48, "vbox48");
GLADE_HOOKUP_OBJECT (CpuDlg, frame9, "frame9"); GLADE_HOOKUP_OBJECT (CpuDlg, frame9, "frame9");

View File

@ -1394,7 +1394,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkLabel" id="label105"> <widget class="GtkLabel" id="label105">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;EmotionEngine (EE) Sync Hacks&lt;/b&gt;</property> <property name="label" translatable="yes">EmotionEngine (EE) Sync Hacks</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -1497,7 +1497,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkLabel" id="label111"> <widget class="GtkLabel" id="label111">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;VU Cycle Stealing (Speedup for 3d geometry)&lt;/b&gt;</property> <property name="label" translatable="yes">VU Cycle Stealing (Speedup for 3d geometry)</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -1540,6 +1540,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkCheckButton" id="check_iop_cycle_rate"> <widget class="GtkCheckButton" id="check_iop_cycle_rate">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Small speedup, and works well with most games.</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Enable IOP x2 Cycle Rate</property> <property name="label" translatable="yes">Enable IOP x2 Cycle Rate</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
@ -1559,7 +1560,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkLabel" id="label96"> <widget class="GtkLabel" id="label96">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Small speedup, and works well with most games,</property> <property name="label" translatable="yes">Small speedup, and works well with most games.</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -1585,6 +1586,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkCheckButton" id="check_wait_cycles_sync_hack"> <widget class="GtkCheckButton" id="check_wait_cycles_sync_hack">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Small speedup. Works well with most games, but it may cause certain games to crash, or freeze up during bootup or stage changes.</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">WaitCycles Sync Hack</property> <property name="label" translatable="yes">WaitCycles Sync Hack</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
@ -1630,6 +1632,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkCheckButton" id="check_intc_sync_hack"> <widget class="GtkCheckButton" id="check_intc_sync_hack">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Huge speedup in many games, and a pretty high compatibility rate (some games still work better with EE sync hacks).</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">INTC Sync Hack</property> <property name="label" translatable="yes">INTC Sync Hack</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
@ -1680,6 +1683,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkCheckButton" id="check_idle_loop_fastforward"> <widget class="GtkCheckButton" id="check_idle_loop_fastforward">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Speedup for a few games, including FFX with no known side effects.</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Idle Loop Fast-Forward (experimental)</property> <property name="label" translatable="yes">Idle Loop Fast-Forward (experimental)</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
@ -1699,7 +1703,7 @@ If you have problems, Disable all of these and try again.</property>
<child> <child>
<widget class="GtkLabel" id="label110"> <widget class="GtkLabel" id="label110">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Speedup for a few games, including FFX with no known side effects. More later.</property> <property name="label" translatable="yes">Speedup for a few games, including FFX with no known side effects.</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -1759,6 +1763,125 @@ If you have problems, Disable all of these and try again.</property>
<property name="fill">False</property> <property name="fill">False</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkFrame" id="frame41">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment36">
<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="GtkVBox" id="vbox75">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="check_microvu_flag_hack_1">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Big Speedup and moderately compatible. May cause SPS and Infinite loop problems.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Flag Hack 1 (microVU only)</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_microvu_flag_hack_2">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Big Speedup and moderately compatible. SuperVU does something similar by default.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Flag Hack 2 (microVU only)</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_microvu_min_max_hack">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Small Speedup. May cause SPS, hanging, and missing geometry.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Min / Max Hack (microVU only)</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label113">
<property name="visible">True</property>
<property name="label" translatable="yes">Vertex Unit (VU) Hacks</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>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -6718,7 +6841,7 @@ Version x.x</property>
<child> <child>
<widget class="GtkLabel" id="label32"> <widget class="GtkLabel" id="label32">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">VU Recompilers - All options are set by default</property> <property name="label" translatable="yes">VU Recompilers</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -6745,6 +6868,105 @@ Version x.x</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkFrame" id="frame40">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment35">
<property name="border_width">5</property>
<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">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox74">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="GtkCheckButton_microVU0rec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">microVU0 - Use microVU rec instead of VU0rec. ! Beta !</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="GtkCheckButton_microVU1rec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">microVU1 - Use microVU rec instead of VU1rec. ! Beta !</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>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label112">
<property name="visible">True</property>
<property name="label" translatable="yes">microVU Recompilers - ! Beta !</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">False</property>
<property name="fill">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkCheckButton" id="GtkCheckButton_MTGS"> <widget class="GtkCheckButton" id="GtkCheckButton_MTGS">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -343,7 +343,12 @@ void SuperVUAlloc(int vuindex)
{ {
// upper 4 bits must be zero! // upper 4 bits must be zero!
// Changed "first try base" to 0xb800000, since 0x0c000000 liked to fail a lot. (air) // Changed "first try base" to 0xb800000, since 0x0c000000 liked to fail a lot. (air)
// With microVU as optional now, Linux fails with 0x0e000000, and prefers 0x0c000000. --arcum42
#ifdef __LINUX__
s_recVUMem = SysMmapEx(0x0c000000, VU_EXESIZE, 0x10000000, "SuperVUAlloc");
#else
s_recVUMem = SysMmapEx(0x0e000000, VU_EXESIZE, 0x10000000, "SuperVUAlloc"); s_recVUMem = SysMmapEx(0x0e000000, VU_EXESIZE, 0x10000000, "SuperVUAlloc");
#endif
if (s_recVUMem == NULL) if (s_recVUMem == NULL)
{ {

View File

@ -37,8 +37,6 @@ PCSX2_ALIGNED16( u8 g_RealGSMem[0x2000] );
static void RegHandlerSIGNAL(const u32* data) static void RegHandlerSIGNAL(const u32* data)
{ {
//MTGS_LOG("MTGS SIGNAL data %x_%x CSRw %x\n",data[0], data[1], CSRw);
GSSIGLBLID->SIGID = (GSSIGLBLID->SIGID&~data[1])|(data[0]&data[1]); GSSIGLBLID->SIGID = (GSSIGLBLID->SIGID&~data[1])|(data[0]&data[1]);
if ((CSRw & 0x1)) GSCSRr |= 1; // signal if ((CSRw & 0x1)) GSCSRr |= 1; // signal
@ -48,8 +46,6 @@ static void RegHandlerSIGNAL(const u32* data)
static void RegHandlerFINISH(const u32* data) static void RegHandlerFINISH(const u32* data)
{ {
//MTGS_LOG("MTGS FINISH data %x_%x CSRw %x\n",data[0], data[1], CSRw);
if ((CSRw & 0x2)) GSCSRr |= 2; // finish if ((CSRw & 0x2)) GSCSRr |= 2; // finish
if (!(GSIMR & 0x200) ) GSirq(); if (!(GSIMR & 0x200) ) GSirq();

View File

@ -29,142 +29,150 @@
using namespace std; using namespace std;
HINSTANCE hInst=NULL; HINSTANCE hInst = NULL;
static pthread_spinlock_t s_mutexStatus; static pthread_spinlock_t s_mutexStatus;
static u32 s_keyPress[2], s_keyRelease[2]; static u32 s_keyPress[2], s_keyRelease[2];
extern u16 status[2]; extern u16 status[2];
extern string s_strIniPath; extern string s_strIniPath;
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
WNDPROC GSwndProc=NULL; WNDPROC GSwndProc = NULL;
HWND GShwnd=NULL; HWND GShwnd = NULL;
extern keyEvent event; extern keyEvent event;
void SaveConfig() void SaveConfig()
{ {
char *szTemp; char *szTemp;
char szIniFile[256], szValue[256], szProf[256]; char szIniFile[256], szValue[256], szProf[256];
int i, j; int i, j;
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
szTemp = strrchr(szIniFile, '\\'); szTemp = strrchr(szIniFile, '\\');
if(!szTemp) return; if (!szTemp) return;
strcpy(szTemp, "\\inis\\zeropad.ini"); strcpy(szTemp, "\\inis\\zeropad.ini");
for (j=0; j<2; j++) { for (j = 0; j < 2; j++)
for (i=0; i<PADKEYS; i++) { {
sprintf(szProf, "%d_%d", j, i); for (i = 0; i < PADKEYS; i++)
sprintf(szValue, "%d", conf.keys[j][i]); {
WritePrivateProfileString("Interface", szProf,szValue,szIniFile); sprintf(szProf, "%d_%d", j, i);
} sprintf(szValue, "%d", conf.keys[j][i]);
} WritePrivateProfileString("Interface", szProf, szValue, szIniFile);
}
}
sprintf(szValue,"%u",conf.log); sprintf(szValue, "%u", conf.log);
WritePrivateProfileString("Interface", "Logging",szValue,szIniFile); WritePrivateProfileString("Interface", "Logging", szValue, szIniFile);
} }
void LoadConfig() void LoadConfig()
{ {
FILE *fp; FILE *fp;
char *szTemp; char *szTemp;
char szIniFile[256], szValue[256], szProf[256]; char szIniFile[256], szValue[256], szProf[256];
int i, j; int i, j;
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
#ifdef _WIN32 #ifdef _WIN32
conf.keys[0][0] = 'W'; // L2 conf.keys[0][0] = 'W'; // L2
conf.keys[0][1] = 'O'; // R2 conf.keys[0][1] = 'O'; // R2
conf.keys[0][2] = 'A'; // L1 conf.keys[0][2] = 'A'; // L1
conf.keys[0][3] = ';'; // R1 conf.keys[0][3] = ';'; // R1
conf.keys[0][4] = 'I'; // TRIANGLE conf.keys[0][4] = 'I'; // TRIANGLE
conf.keys[0][5] = 'L'; // CIRCLE conf.keys[0][5] = 'L'; // CIRCLE
conf.keys[0][6] = 'K'; // CROSS conf.keys[0][6] = 'K'; // CROSS
conf.keys[0][7] = 'J'; // SQUARE conf.keys[0][7] = 'J'; // SQUARE
conf.keys[0][8] = 'V'; // SELECT conf.keys[0][8] = 'V'; // SELECT
conf.keys[0][11] = 'N'; // START conf.keys[0][11] = 'N'; // START
conf.keys[0][12] = 'E'; // UP conf.keys[0][12] = 'E'; // UP
conf.keys[0][13] = 'F'; // RIGHT conf.keys[0][13] = 'F'; // RIGHT
conf.keys[0][14] = 'D'; // DOWN conf.keys[0][14] = 'D'; // DOWN
conf.keys[0][15] = 'S'; // LEFT conf.keys[0][15] = 'S'; // LEFT
#endif #endif
conf.log = 0; conf.log = 0;
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256); GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
szTemp = strrchr(szIniFile, '\\'); szTemp = strrchr(szIniFile, '\\');
if(!szTemp) return ; if (!szTemp) return ;
strcpy(szTemp, "\\inis\\zeropad.ini"); strcpy(szTemp, "\\inis\\zeropad.ini");
fp=fopen("inis\\zeropad.ini","rt");//check if usbnull.ini really exists fp = fopen("inis\\zeropad.ini", "rt");//check if usbnull.ini really exists
if (!fp) { if (!fp)
CreateDirectory("inis",NULL); {
SaveConfig();//save and return CreateDirectory("inis", NULL);
return ; SaveConfig();//save and return
} return ;
fclose(fp); }
fclose(fp);
for (j=0; j<2; j++) { for (j = 0; j < 2; j++)
for (i=0; i<PADKEYS; i++) { {
sprintf(szProf, "%d_%d", j, i); for (i = 0; i < PADKEYS; i++)
GetPrivateProfileString("Interface", szProf, NULL, szValue, 20, szIniFile); {
conf.keys[j][i] = strtoul(szValue, NULL, 10); sprintf(szProf, "%d_%d", j, i);
} GetPrivateProfileString("Interface", szProf, NULL, szValue, 20, szIniFile);
} conf.keys[j][i] = strtoul(szValue, NULL, 10);
}
}
GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile); GetPrivateProfileString("Interface", "Logging", NULL, szValue, 20, szIniFile);
conf.log = strtoul(szValue, NULL, 10); conf.log = strtoul(szValue, NULL, 10);
} }
void SysMessage(char *fmt, ...) { void SysMessage(char *fmt, ...)
va_list list; {
char tmp[512]; va_list list;
char tmp[512];
va_start(list,fmt); va_start(list, fmt);
vsprintf(tmp,fmt,list); vsprintf(tmp, fmt, list);
va_end(list); va_end(list);
MessageBox(0, tmp, "PADwinKeyb Msg", 0); MessageBox(0, tmp, "PADwinKeyb Msg", 0);
} }
s32 _PADopen(void *pDsp) s32 _PADopen(void *pDsp)
{ {
memset(&event, 0, sizeof(event)); memset(&event, 0, sizeof(event));
LoadConfig(); LoadConfig();
pthread_spin_init(&s_mutexStatus, PTHREAD_PROCESS_PRIVATE); pthread_spin_init(&s_mutexStatus, PTHREAD_PROCESS_PRIVATE);
s_keyPress[0] = s_keyPress[1] = 0; s_keyPress[0] = s_keyPress[1] = 0;
s_keyRelease[0] = s_keyRelease[1] = 0; s_keyRelease[0] = s_keyRelease[1] = 0;
if( GShwnd != NULL && GSwndProc != NULL ) { if (GShwnd != NULL && GSwndProc != NULL)
// revert {
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc)); // revert
} SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
}
GShwnd = (HWND)*(long*)pDsp; GShwnd = (HWND) * (long*)pDsp;
GSwndProc = (WNDPROC)GetWindowLongPtr(GShwnd, GWLP_WNDPROC); GSwndProc = (WNDPROC)GetWindowLongPtr(GShwnd, GWLP_WNDPROC);
GSwndProc = ((WNDPROC)SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(PADwndProc))); GSwndProc = ((WNDPROC)SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(PADwndProc)));
return 0; return 0;
} }
void _PADclose() void _PADclose()
{ {
if( GShwnd != NULL && GSwndProc != NULL ) { if (GShwnd != NULL && GSwndProc != NULL)
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc)); {
GSwndProc = NULL; SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
GShwnd = NULL; GSwndProc = NULL;
} GShwnd = NULL;
pthread_spin_destroy(&s_mutexStatus); }
pthread_spin_destroy(&s_mutexStatus);
} }
void _PADupdate(int pad) void _PADupdate(int pad)
{ {
pthread_spin_lock(&s_mutexStatus); pthread_spin_lock(&s_mutexStatus);
status[pad] |= s_keyRelease[pad]; status[pad] |= s_keyRelease[pad];
status[pad] &= ~s_keyPress[pad]; status[pad] &= ~s_keyPress[pad];
s_keyRelease[pad] = 0; s_keyRelease[pad] = 0;
s_keyPress[pad] = 0; s_keyPress[pad] = 0;
pthread_spin_unlock(&s_mutexStatus); pthread_spin_unlock(&s_mutexStatus);
} }
void CALLBACK PADupdate(int pad) void CALLBACK PADupdate(int pad)
@ -173,287 +181,315 @@ void CALLBACK PADupdate(int pad)
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
int i,pad,keyPress[2]={0},keyRelease[2]={0}; int i, pad, keyPress[2] = {0}, keyRelease[2] = {0};
static bool lbutton=false,rbutton=false; static bool lbutton = false, rbutton = false;
switch (msg) { switch (msg)
case WM_KEYDOWN: {
if (lParam & 0x40000000) case WM_KEYDOWN:
return TRUE; if (lParam & 0x40000000)
return TRUE;
for(pad = 0; pad < 2; ++pad ) { for (pad = 0; pad < 2; ++pad)
for (i=0; i<PADKEYS; i++) { {
if (wParam == conf.keys[pad][i]) { for (i = 0; i < PADKEYS; i++)
keyPress[pad] |=(1<<i); {
keyRelease[pad] &=~(1<<i); if (wParam == conf.keys[pad][i])
break; {
} keyPress[pad] |= (1 << i);
} keyRelease[pad] &= ~(1 << i);
} break;
}
}
}
event.evt = KEYPRESS; event.evt = KEYPRESS;
event.key = wParam; event.key = wParam;
break; break;
case WM_KEYUP: case WM_KEYUP:
for(pad = 0; pad < 2; ++pad ) { for (pad = 0; pad < 2; ++pad)
for (i=0; i<PADKEYS; i++) { {
if (wParam == conf.keys[pad][i]) { for (i = 0; i < PADKEYS; i++)
keyPress[pad] &=~(1<<i); {
keyRelease[pad] |= (1<<i); if (wParam == conf.keys[pad][i])
break; {
} keyPress[pad] &= ~(1 << i);
} keyRelease[pad] |= (1 << i);
} break;
}
}
}
event.evt = KEYRELEASE; event.evt = KEYRELEASE;
event.key = wParam; event.key = wParam;
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
lbutton = true; lbutton = true;
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
g_lanalog[0].x = 0x80; g_lanalog[0].x = 0x80;
g_lanalog[0].y = 0x80; g_lanalog[0].y = 0x80;
g_lanalog[1].x = 0x80; g_lanalog[1].x = 0x80;
g_lanalog[1].y = 0x80; g_lanalog[1].y = 0x80;
lbutton = false; lbutton = false;
break; break;
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
rbutton = true; rbutton = true;
break; break;
case WM_RBUTTONUP: case WM_RBUTTONUP:
g_ranalog[0].x = 0x80; g_ranalog[0].x = 0x80;
g_ranalog[0].y = 0x80; g_ranalog[0].y = 0x80;
g_ranalog[1].x = 0x80; g_ranalog[1].x = 0x80;
g_ranalog[1].y = 0x80; g_ranalog[1].y = 0x80;
rbutton = false; rbutton = false;
break; break;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if(lbutton) if (lbutton)
{ {
g_lanalog[0].x = LOWORD(lParam) & 254; g_lanalog[0].x = LOWORD(lParam) & 254;
g_lanalog[0].y = HIWORD(lParam) & 254; g_lanalog[0].y = HIWORD(lParam) & 254;
g_lanalog[1].x = LOWORD(lParam) & 254; g_lanalog[1].x = LOWORD(lParam) & 254;
g_lanalog[1].y = HIWORD(lParam) & 254; g_lanalog[1].y = HIWORD(lParam) & 254;
} }
if(rbutton) if (rbutton)
{ {
g_ranalog[0].x = LOWORD(lParam) & 254; g_ranalog[0].x = LOWORD(lParam) & 254;
g_ranalog[0].y = HIWORD(lParam) & 254; g_ranalog[0].y = HIWORD(lParam) & 254;
g_ranalog[1].x = LOWORD(lParam) & 254; g_ranalog[1].x = LOWORD(lParam) & 254;
g_ranalog[1].y = HIWORD(lParam) & 254; g_ranalog[1].y = HIWORD(lParam) & 254;
} }
break; break;
case WM_DESTROY: case WM_DESTROY:
case WM_QUIT: case WM_QUIT:
event.evt = KEYPRESS; event.evt = KEYPRESS;
event.key = VK_ESCAPE; event.key = VK_ESCAPE;
return GSwndProc(hWnd, msg, wParam, lParam); return GSwndProc(hWnd, msg, wParam, lParam);
default: default:
return GSwndProc(hWnd, msg, wParam, lParam); return GSwndProc(hWnd, msg, wParam, lParam);
} }
pthread_spin_lock(&s_mutexStatus); pthread_spin_lock(&s_mutexStatus);
for(pad = 0; pad < 2; ++pad ) { for (pad = 0; pad < 2; ++pad)
s_keyPress[pad] |= keyPress[pad]; {
s_keyPress[pad] &= ~keyRelease[pad]; s_keyPress[pad] |= keyPress[pad];
s_keyRelease[pad] |= keyRelease[pad]; s_keyPress[pad] &= ~keyRelease[pad];
s_keyRelease[pad] &= ~keyPress[pad]; s_keyRelease[pad] |= keyRelease[pad];
} s_keyRelease[pad] &= ~keyPress[pad];
pthread_spin_unlock(&s_mutexStatus); }
pthread_spin_unlock(&s_mutexStatus);
return TRUE; return TRUE;
} }
string GetKeyLabel(const int pad, const int index) string GetKeyLabel(const int pad, const int index)
{ {
const int key = conf.keys[pad][index]; const int key = conf.keys[pad][index];
char buff[16]="NONE)"; char buff[16] = "NONE)";
if (key < 0x100) if (key < 0x100)
{ {
if (key == 0) if (key == 0)
strcpy (buff, "NONE"); strcpy(buff, "NONE");
else { else
if(key>=0x60 && key<=0x69) { {
sprintf(buff, "NumPad %c", '0' + key - 0x60); if (key >= 0x60 && key <= 0x69)
} {
else sprintf(buff, "%c", key); sprintf(buff, "NumPad %c", '0' + key - 0x60);
} }
} else sprintf(buff, "%c", key);
else if (key >= 0x1000 && key < 0x2000) }
{ }
sprintf (buff, "J%d_%d", (key & 0xfff) / 0x100, (key & 0xff) + 1); else if (key >= 0x1000 && key < 0x2000)
} {
else if (key >= 0x2000 && key < 0x3000) sprintf(buff, "J%d_%d", (key & 0xfff) / 0x100, (key & 0xff) + 1);
{ }
static const char name[][4] = { "MIN", "MAX" }; else if (key >= 0x2000 && key < 0x3000)
const int axis = (key & 0xff); {
sprintf (buff, "J%d_AXIS%d_%s", (key & 0xfff) / 0x100, axis / 2, name[axis % 2]); static const char name[][4] = { "MIN", "MAX" };
if (index >= 17 && index <= 20) const int axis = (key & 0xff);
buff[strlen (buff) -4] = '\0'; sprintf(buff, "J%d_AXIS%d_%s", (key & 0xfff) / 0x100, axis / 2, name[axis % 2]);
} if (index >= 17 && index <= 20)
else if (key >= 0x3000 && key < 0x4000) buff[strlen(buff) -4] = '\0';
{ }
static const char name[][7] = { "FOWARD", "RIGHT", "BACK", "LEFT" }; else if (key >= 0x3000 && key < 0x4000)
const int pov = (key & 0xff); {
sprintf (buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov /4, name[pov % 4]); static const char name[][7] = { "FOWARD", "RIGHT", "BACK", "LEFT" };
} const int pov = (key & 0xff);
sprintf(buff, "J%d_POV%d_%s", (key & 0xfff) / 0x100, pov / 4, name[pov % 4]);
}
return buff; return buff;
} }
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND hWC; {
TCITEM tcI; HWND hWC;
int i,key, numkeys; TCITEM tcI;
u8* pkeyboard; int i, key, numkeys;
static int disabled=0; u8* pkeyboard;
static int padn=0; static int disabled = 0;
static int padn = 0;
switch(uMsg) { switch (uMsg)
case WM_INITDIALOG: {
LoadConfig(); case WM_INITDIALOG:
padn = 0; LoadConfig();
if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE); padn = 0;
if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE);
for (i=0; i<PADKEYS; i++) { for (i = 0; i < PADKEYS; i++)
hWC = GetDlgItem(hW, IDC_L2 + i*2); {
Button_SetText(hWC, GetKeyLabel(padn, i).c_str()); hWC = GetDlgItem(hW, IDC_L2 + i * 2);
} Button_SetText(hWC, GetKeyLabel(padn, i).c_str());
}
hWC = GetDlgItem(hW, IDC_TABC); hWC = GetDlgItem(hW, IDC_TABC);
tcI.mask = TCIF_TEXT; tcI.mask = TCIF_TEXT;
tcI.pszText = "PAD 1"; tcI.pszText = "PAD 1";
TabCtrl_InsertItem(hWC, 0, &tcI); TabCtrl_InsertItem(hWC, 0, &tcI);
tcI.mask = TCIF_TEXT; tcI.mask = TCIF_TEXT;
tcI.pszText = "PAD 2"; tcI.pszText = "PAD 2";
TabCtrl_InsertItem(hWC, 1, &tcI); TabCtrl_InsertItem(hWC, 1, &tcI);
return TRUE; return TRUE;
case WM_TIMER: case WM_TIMER:
if (disabled){ if (disabled)
key = 0; {
//pkeyboard = SDL_GetKeyState(&numkeys); key = 0;
for (int i = 0; i < numkeys; ++i) { //pkeyboard = SDL_GetKeyState(&numkeys);
if( pkeyboard[i] ) { for (int i = 0; i < numkeys; ++i)
key = i; {
break; if (pkeyboard[i])
} {
} key = i;
break;
}
}
if( key == 0 ) { if (key == 0)
// check joystick {
} // check joystick
}
if (key != 0){ if (key != 0)
KillTimer(hW, 0x80); {
hWC = GetDlgItem(hW, disabled); KillTimer(hW, 0x80);
conf.keys[padn][disabled-IDC_L2] = key; hWC = GetDlgItem(hW, disabled);
Button_SetText(hWC, GetKeyLabel(padn, disabled-IDC_L2).c_str()); conf.keys[padn][disabled-IDC_L2] = key;
EnableWindow(hWC, TRUE); Button_SetText(hWC, GetKeyLabel(padn, disabled - IDC_L2).c_str());
disabled=0; EnableWindow(hWC, TRUE);
return TRUE; disabled = 0;
} return TRUE;
} }
return TRUE; }
return TRUE;
case WM_COMMAND: case WM_COMMAND:
for(i = IDC_L2; i <= IDC_LEFT; i+=2) for (i = IDC_L2; i <= IDC_LEFT; i += 2)
{ {
if(LOWORD(wParam) == i) if (LOWORD(wParam) == i)
{ {
if (disabled)//change selection if (disabled)//change selection
EnableWindow(GetDlgItem(hW, disabled), TRUE); EnableWindow(GetDlgItem(hW, disabled), TRUE);
EnableWindow(GetDlgItem(hW, disabled=wParam), FALSE); EnableWindow(GetDlgItem(hW, disabled = wParam), FALSE);
SetTimer(hW, 0x80, 250, NULL); SetTimer(hW, 0x80, 250, NULL);
return TRUE; return TRUE;
} }
} }
switch(LOWORD(wParam)) { switch (LOWORD(wParam))
case IDCANCEL: {
KillTimer(hW, 0x80); case IDCANCEL:
EndDialog(hW, TRUE); KillTimer(hW, 0x80);
return TRUE; EndDialog(hW, TRUE);
case IDOK: return TRUE;
KillTimer(hW, 0x80); case IDOK:
if (IsDlgButtonChecked(hW, IDC_LOG)) KillTimer(hW, 0x80);
conf.log = 1; if (IsDlgButtonChecked(hW, IDC_LOG))
else conf.log = 0; conf.log = 1;
SaveConfig(); else conf.log = 0;
EndDialog(hW, FALSE); SaveConfig();
return TRUE; EndDialog(hW, FALSE);
} return TRUE;
break; }
break;
case WM_NOTIFY: case WM_NOTIFY:
switch (wParam) { switch (wParam)
case IDC_TABC: {
hWC = GetDlgItem(hW, IDC_TABC); case IDC_TABC:
padn = TabCtrl_GetCurSel(hWC); hWC = GetDlgItem(hW, IDC_TABC);
padn = TabCtrl_GetCurSel(hWC);
for (i=0; i<PADKEYS; i++) { for (i = 0; i < PADKEYS; i++)
hWC = GetDlgItem(hW, IDC_EL3 + i); {
Button_SetText(hWC, GetKeyLabel(padn, i).c_str()); hWC = GetDlgItem(hW, IDC_EL3 + i);
} Button_SetText(hWC, GetKeyLabel(padn, i).c_str());
}
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
return FALSE; return FALSE;
} }
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch(uMsg) { {
case WM_INITDIALOG: switch (uMsg)
return TRUE; {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND: case WM_COMMAND:
switch(LOWORD(wParam)) { switch (LOWORD(wParam))
case IDOK: {
EndDialog(hW, FALSE); case IDOK:
return TRUE; EndDialog(hW, FALSE);
} return TRUE;
} }
return FALSE; }
return FALSE;
} }
void CALLBACK PADconfigure() { void CALLBACK PADconfigure()
DialogBox(hInst, {
MAKEINTRESOURCE(IDD_DIALOG1), DialogBox(hInst,
GetActiveWindow(), MAKEINTRESOURCE(IDD_DIALOG1),
(DLGPROC)ConfigureDlgProc); GetActiveWindow(),
(DLGPROC)ConfigureDlgProc);
} }
void CALLBACK PADabout() { void CALLBACK PADabout()
SysMessage("Author: zerofrog\nThanks to SSSPSXPad, TwinPAD, and PADwin plugins"); {
SysMessage("Author: zerofrog\nThanks to SSSPSXPad, TwinPAD, and PADwin plugins");
} }
s32 CALLBACK PADtest() { s32 CALLBACK PADtest()
return 0; {
return 0;
} }
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
DWORD dwReason, DWORD dwReason,
LPVOID lpReserved) { LPVOID lpReserved)
hInst = (HINSTANCE)hModule; {
return TRUE; // very quick :) hInst = (HINSTANCE)hModule;
return TRUE; // very quick :)
} }