+static void update_volume(int has_changed, int is_up)\r
+{\r
+ static int prev_frame = 0, wait_frames = 0;\r
+ int vol = currentConfig.volume;\r
+\r
+ if (has_changed)\r
+ {\r
+ if (vol < 5 && (PicoOpt&8) && prev_frame == Pico.m.frame_count - 1 && wait_frames < 12)\r
+ wait_frames++;\r
+ else {\r
+ if (is_up) {\r
+ if (vol < 99) vol++;\r
+ } else {\r
+ if (vol > 0) vol--;\r
+ }\r
+ wait_frames = 0;\r
+ gp2x_sound_volume(vol, vol);\r
+ currentConfig.volume = vol;\r
+ }\r
+ sprintf(noticeMsg, "VOL: %02i", vol);\r
+ gettimeofday(¬iceMsgTime, 0);\r
+ prev_frame = Pico.m.frame_count;\r
+ }\r
+\r
+ // set the right mixer func\r
+ if (!(PicoOpt&8)) return; // just use defaults for mono\r
+ if (vol >= 5)\r
+ PsndMix_32_to_16l = mix_32_to_16l_stereo;\r
+ else {\r
+ mix_32_to_16l_level = 5 - vol;\r
+ PsndMix_32_to_16l = mix_32_to_16l_stereo_lvl;\r
+ }\r
+}\r
+\r
+static void change_fast_forward(int set_on)\r
+{\r
+ static void *set_PsndOut = NULL;\r
+ static int set_Frameskip, set_EmuOpt, is_on = 0;\r
+\r
+ if (set_on && !is_on) {\r
+ set_PsndOut = PsndOut;\r
+ set_Frameskip = currentConfig.Frameskip;\r
+ set_EmuOpt = currentConfig.EmuOpt;\r
+ PsndOut = NULL;\r
+ currentConfig.Frameskip = 8;\r
+ currentConfig.EmuOpt &= ~4;\r
+ is_on = 1;\r
+ }\r
+ else if (!set_on && is_on) {\r
+ PsndOut = set_PsndOut;\r
+ currentConfig.Frameskip = set_Frameskip;\r
+ currentConfig.EmuOpt = set_EmuOpt;\r
+ PsndRerate(1);\r
+ update_volume(0, 0);\r
+ reset_timing = 1;\r
+ is_on = 0;\r
+ }\r
+}\r
+\r