- //FCEUI_SetSoundVolume(soundvol);
- // draw on screen :D
- gp2x_sound_volume(soundvolume, soundvolume);
- int meterval=soundvolume/5;
- for (soundvolIndex=0; soundvolIndex < 20; soundvolIndex++)
- {
- if (soundvolIndex < meterval)
- {
- soundvolmeter[soundvolIndex]='*';
- }
- else
- {
- soundvolmeter[soundvolIndex]='_';
- }
- }
- soundvolmeter[20]=0;
- FCEU_DispMessage("|%s|", soundvolmeter);
+ int soundvolIndex;
+ static char soundvolmeter[24];
+ static int prev_snd_on = 0;
+
+ if ((!!soundvolume) ^ prev_snd_on)
+ {
+ FCEUI_Sound(Settings.sound_rate);
+ prev_snd_on = !!soundvolume;
+ }
+
+ // draw on screen :D
+ gp2x_sound_volume(soundvolume, soundvolume);
+ int meterval=soundvolume/5;
+ for (soundvolIndex = 0; soundvolIndex < 20; soundvolIndex++)
+ {
+ if (soundvolIndex < meterval)
+ {
+ soundvolmeter[soundvolIndex]='*';
+ }
+ else
+ {
+ soundvolmeter[soundvolIndex]='_';
+ }
+ }
+ soundvolmeter[20]=0;
+ FCEU_DispMessage("|%s|", soundvolmeter);
+}
+
+
+static void do_emu_acts(uint32 acts)
+{
+ uint32 actsc = acts;
+ acts &= acts ^ prev_emu_acts;
+ prev_emu_acts = actsc;
+
+ if (acts & (3 << 30))
+ {
+ unsigned long keys;
+ int do_it = 1;
+ if (acts & (1 << 30))
+ {
+ if (Settings.sstate_confirm & 2)
+ {
+ FCEU_DispMessage("LOAD STATE? (Y=yes, X=no)");
+ FCEU_PutImage();
+ FCEUD_Update(XBuf+8,NULL,0);
+ while( !((keys = gp2x_joystick_read(1)) & (GP2X_X|GP2X_Y)) ) usleep(50*1024);
+ if (keys & GP2X_X) do_it = 0;
+ FCEU_CancelDispMessage();
+ }
+ if (do_it) FCEUI_LoadState();
+ }
+ else
+ {
+ if (Settings.sstate_confirm & 1)
+ {
+ char *fname = FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0);
+ FILE *st=fopen(fname,"rb");
+ free(fname);
+ if (st)
+ {
+ fclose(st);
+ FCEU_DispMessage("OVERWRITE SAVE? (Y=yes, X=no)");
+ FCEU_PutImage();
+ FCEUD_Update(XBuf+8,NULL,0);
+ while( !((keys = gp2x_joystick_read(1)) & (GP2X_X|GP2X_Y)) ) usleep(50*1024);
+ if (keys & GP2X_X) do_it = 0;
+ FCEU_CancelDispMessage();
+ }
+ }
+ if (do_it) FCEUI_SaveState();
+ }
+ RefreshThrottleFPS();
+ }
+ else if (acts & (3 << 28)) // state slot next/prev
+ {
+ FILE *st;
+ char *fname;
+
+ CurrentState += (acts & (1 << 29)) ? 1 : -1;
+ if (CurrentState > 9) CurrentState = 0;
+ if (CurrentState < 0) CurrentState = 9;
+
+ fname = FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0);
+ st=fopen(fname,"rb");
+ free(fname);
+ FCEU_DispMessage("[%s] State Slot %i", st ? "USED" : "FREE", CurrentState);
+ if (st) fclose(st);
+ }
+ else if (acts & (1 << 27)) // FDS insert/eject
+ {
+ if(FCEUGameInfo.type == GIT_FDS)
+ FCEU_DoSimpleCommand(FCEUNPCMD_FDSINSERT);
+ }
+ else if (acts & (1 << 26)) // FDS select
+ {
+ if(FCEUGameInfo.type == GIT_FDS)
+ FCEU_DoSimpleCommand(FCEUNPCMD_FDSSELECT);
+ }
+ else if (acts & (1 << 25)) // VS Unisystem insert coin
+ {
+ if(FCEUGameInfo.type == GIT_VSUNI)
+ FCEU_DoSimpleCommand(FCEUNPCMD_VSUNICOIN);
+ }