--- ../snes9x-1.43-orig/snes9x/unix/svga.cpp 2005-01-02 12:45:00 +0900 +++ snes9x/unix/svga.cpp 2005-01-02 12:46:01 +0900 @@ -95,6 +95,7 @@ #include #include #include +#include #include #include @@ -130,6 +131,8 @@ extern uint32 joypads [5]; +extern int sound_copy_fd; + #define ATTRCON_ADDR 0x3c0 #define MISC_ADDR 0x3c2 #define VGAENABLE_ADDR 0x3c3 @@ -629,6 +632,24 @@ Settings.SkipFrames++; } } + + if (KEY_PRESS(SCANCODE_R) + && (KEY_DOWN(SCANCODE_CONTROL) | KEY_DOWN(SCANCODE_LEFTCONTROL)) + ) { + if (sound_copy_fd >= 0) { + close(sound_copy_fd); + } + sound_copy_fd = open("audio.raw", O_WRONLY | O_CREAT | O_TRUNC, 0666); + } + + if (KEY_PRESS(SCANCODE_T) + && (KEY_DOWN(SCANCODE_CONTROL) | KEY_DOWN(SCANCODE_LEFTCONTROL)) + ) { + if (sound_copy_fd >= 0) { + close(sound_copy_fd); + sound_copy_fd = -1; + } + } memcpy (prev_keystate, keystate, sizeof (prev_keystate)); } --- ../snes9x-1.43-orig/snes9x/unix/unix.cpp 2004-12-31 07:15:47 +0900 +++ snes9x/unix/unix.cpp 2005-01-02 12:56:16 +0900 @@ -222,6 +222,8 @@ void InitTimer (); void *S9xProcessSound (void *); +int sound_copy_fd = -1; + char *rom_filename = NULL; char *snapshot_filename = NULL; char *SDD1_pack = NULL; @@ -1439,6 +1441,9 @@ if (ALsetchannels(al_config, channels)) { perror("ERROR with ALsetchannels"); } + if (sound_copy_fd >= 0) { + write(sound_copy_fd, audio_buf, buf_size); + } channels = ALgetchannels(al_config); # if 0 @@ -2022,6 +2027,9 @@ I = write (so.sound_fd, (char *) Buf + byte_offset, I); if (I > 0) { + if (sound_copy_fd >= 0) { + write(sound_copy_fd, (char *) Buf + byte_offset, I); + } bytes_to_write -= I; byte_offset += I; byte_offset &= SOUND_BUFFER_SIZE_MASK; /* wrap */ --- ../snes9x-1.43-orig/snes9x/unix/x11.cpp 2004-12-31 07:15:47 +0900 +++ snes9x/unix/x11.cpp 2005-01-02 12:50:18 +0900 @@ -191,6 +191,8 @@ GUIData GUI; extern uint32 joypads [5]; +extern int sound_copy_fd; + #if 0 QApplication *app; Snes9xGUI *gui; @@ -1335,6 +1337,22 @@ { int key = XKeycodeToKeysym (GUI.display, event.xkey.keycode, 0); + if (event.type == KeyPress && (event.xkey.state & ControlMask)) { + if (key == XK_r) { + if (sound_copy_fd >= 0) { + close(sound_copy_fd); + } + sound_copy_fd = open("audio.raw", + O_WRONLY | O_CREAT | O_TRUNC, 0666); + break; + } else if (key == XK_t) { + if (sound_copy_fd >= 0) { + close(sound_copy_fd); + sound_copy_fd = -1; + } + } + break; + } const KeyboardSetup::Keyfunction& func = KBSetup.GetKeyFunction(key, event.xkey.state); switch(func.func)