flycast icon indicating copy to clipboard operation
flycast copied to clipboard

Virtua Cop 2 (both versions) momentarily freezes when shot fired with lightgun

Open StormedBubbles opened this issue 4 years ago • 19 comments

Platform / OS / Hardware: Raspberry Pi 4B, RetroPie, RetroArch 1.9.14

Github hash: 0bb6fed (Sorry if this isn't the right info. I will change if this is wrong. RetroPie recently brought Flycast to this code base, so I am using the current version of the emulator)

Hardware: X-input wired controller, 2 Sinden lightguns, wireless keyboard/mouse combo

Description of the Issue

Standalone (Japan) and Smash Pack (USA) versions of Virtua Cop 2 both momentarily freeze whenever a shot is fired in game by a lightgun. The issue does NOT occur at all when a regular controller is used.

Debugging Steps Tested

  • Tried using only one gun (issue still occurs)
  • Tried with controller only (issue does not occur)

Logs Gathered

Verbose log from RetroPie for standalone Virtua Cop 2 (Japan) shown below. I exited the game after demonstrating the issue a few times. The remap file sets ports 1 and 2 to "light gun." The game's options file sets the region/language to Japan/Japanese for this standalone version of VC2. I am happy to provide any other info needed.


Parameters: 
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-flycast/flycast_libretro.so </dev/null --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pi/RetroPie/roms/dreamcast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].chd" --verbose --appendconfig /dev/shm/retroarch.cfg'|'"/home/pi/RetroPie/roms/dreamcast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].chd.cfg"
[INFO] [Config]: Loading config from: "/opt/retropie/configs/dreamcast/retroarch.cfg".
[INFO] [Config]: Appending config "/dev/shm/retroarch.cfg".
[INFO] [Config]: Appending config "/home/pi/RetroPie/roms/dreamcast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].chd.cfg".
[INFO] RetroArch 1.9.14 (Git 06a2367)
[INFO] === Build =======================================
[INFO] Capabilities:  NEON VFPv3 VFPv4
[INFO] Built: Dec 30 2021
[INFO] Version: 1.9.14
[INFO] Git: 06a2367
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[INFO] [Core]: Loading dynamic libretro core from: "/opt/retropie/libretrocores/lr-flycast/flycast_libretro.so"
[INFO] [Overrides]: No core-specific overrides found at "/home/pi/.config/retroarch/config/Flycast/Flycast.cfg".
[INFO] [Overrides]: No content-dir-specific overrides found at "/home/pi/.config/retroarch/config/Flycast/dreamcast.cfg".
[INFO] [Overrides]: No game-specific overrides found at "/home/pi/.config/retroarch/config/Flycast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].cfg".
[INFO] [Environ]: GET_CORE_OPTIONS_VERSION.
[INFO] [Environ]: GET_LANGUAGE: "0".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL.
[INFO] [Core Options]: Game-specific core options found at /home/pi/.config/retroarch/config/Flycast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].opt
[INFO] [Environ]: SET_CONTROLLER_INFO.
[INFO] [Remaps]: Remap directory: "/opt/retropie/configs/dreamcast/".
[INFO] [Remaps]: Game-specific remap found at "/opt/retropie/configs/dreamcast/Flycast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].rmp".
[INFO] [Overrides]: Redirecting save file to "/home/pi/RetroPie/roms/dreamcast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].srm".
[INFO] [Overrides]: Redirecting save state to "/home/pi/RetroPie/roms/dreamcast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].state".
[INFO] [Environ]: GET_LOG_INTERFACE.
[libretro INFO] shell/libretro/libretro.cpp:297 N[BOOT]: retro_init
[INFO] [Environ]: GET_PERF_INTERFACE.
[INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
[INFO] [Environ]: SET_KEYBOARD_CALLBACK.
[INFO] [Environ]: GET_DISK_CONTROL_INTERFACE_VERSION.
[INFO] [Environ]: SET_DISK_CONTROL_EXT_INTERFACE.
[INFO] [Content]: Content loading skipped. Implementation will load it on its own.
[libretro INFO] shell/libretro/libretro.cpp:1689 N[BOOT]: retro_load_game: /home/pi/RetroPie/roms/dreamcast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].chd
[INFO] [Environ]: GET_RUMBLE_INTERFACE.
[INFO] [Environ]: SYSTEM_DIRECTORY: "/home/pi/RetroPie/BIOS".
[INFO] [Environ]: GET_SAVE_DIRECTORY.
[INFO] [Environ]: SET_SAVE_STATE_IN_BACKGROUND: yes.
[libretro INFO] File extension is: .chd
[INFO] [Environ]: GET_PREFERRED_HW_RENDER, video driver name: gl.
[INFO] [Environ]: GET_PREFERRED_HW_RENDER - Context callback set to RETRO_HW_CONTEXT_OPENGL.
[INFO] [Environ]: SET_HW_RENDER, context type: gl.
[INFO] Requesting OpenGLES2 context.
[INFO] Reached end of SET_HW_RENDER.
[libretro INFO] core/hw/mem/_vmem.cpp:482 N[VMEM]: Info: nvmem is enabled, with addr space of size 512MB
[libretro INFO] core/hw/mem/_vmem.cpp:575 N[VMEM]: BASE 0x8caf0000 RAM(16 MB) 0x98af0000 VRAM64(8 MB) 0x90af0000 ARAM(2 MB) 0xacaf0000
[libretro INFO] core/hw/mem/_vmem.cpp:482 N[VMEM]: Info: nvmem is enabled, with addr space of size 512MB
[libretro INFO] core/hw/mem/_vmem.cpp:575 N[VMEM]: BASE 0x8caf0000 RAM(16 MB) 0x98af0000 VRAM64(8 MB) 0x90af0000 ARAM(2 MB) 0xacaf0000
[libretro INFO] core/emulator.cpp:56 N[BOOT]: Game ID is [HDR-0061]
[INFO] [Environ]: SET_ROTATION: 0
[INFO] [SRAM]: Skipping SRAM load.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[libretro INFO] shell/libretro/libretro.cpp:2014 N[RENDERER]: retro_get_system_av_info: Res=480
[INFO] [Audio]: Set audio input rate to: 44100.00 Hz.
[INFO] [Video]: Set video size to: 1920x1080.
[INFO] [Video]: Using HW render, OpenGL driver forced.
[INFO] [Video]: Using configured "gl" driver for GL HW render.
[INFO] [DRM]: Found 1 connectors.
[INFO] [DRM]: Connector 0 connected: yes
[INFO] [DRM]: Connector 0 has 34 modes.
[INFO] [DRM]: Connector 0 assigned to monitor index: #1.
[INFO] [DRM]: Mode 0: (1920x1080) 1920 x 1080, 60.000000 Hz
[INFO] [DRM]: Mode 1: (1920x1080) 1920 x 1080, 59.940200 Hz
[INFO] [DRM]: Mode 2: (1920x1080i) 1920 x 1080, 30.000000 Hz
[INFO] [DRM]: Mode 3: (1920x1080i) 1920 x 1080, 29.970100 Hz
[INFO] [DRM]: Mode 4: (1920x1080) 1920 x 1080, 30.000000 Hz
[INFO] [DRM]: Mode 5: (1920x1080) 1920 x 1080, 29.970100 Hz
[INFO] [DRM]: Mode 6: (1920x1080) 1920 x 1080, 24.000000 Hz
[INFO] [DRM]: Mode 7: (1920x1080) 1920 x 1080, 23.976079 Hz
[INFO] [DRM]: Mode 8: (1680x1050) 1680 x 1050, 59.883251 Hz
[INFO] [DRM]: Mode 9: (1600x900) 1600 x 900, 60.000000 Hz
[INFO] [DRM]: Mode 10: (1280x1024) 1280 x 1024, 75.024673 Hz
[INFO] [DRM]: Mode 11: (1280x1024) 1280 x 1024, 60.019737 Hz
[INFO] [DRM]: Mode 12: (1440x900) 1440 x 900, 59.901454 Hz
[INFO] [DRM]: Mode 13: (1280x800) 1280 x 800, 59.909542 Hz
[INFO] [DRM]: Mode 14: (1152x864) 1152 x 864, 75.000000 Hz
[INFO] [DRM]: Mode 15: (1280x720) 1280 x 720, 60.000000 Hz
[INFO] [DRM]: Mode 16: (1280x720) 1280 x 720, 59.940200 Hz
[INFO] [DRM]: Mode 17: (1024x768) 1024 x 768, 75.028579 Hz
[INFO] [DRM]: Mode 18: (1024x768) 1024 x 768, 70.069358 Hz
[INFO] [DRM]: Mode 19: (1024x768) 1024 x 768, 60.003837 Hz
[INFO] [DRM]: Mode 20: (832x624) 832 x 624, 74.551261 Hz
[INFO] [DRM]: Mode 21: (800x600) 800 x 600, 75.000000 Hz
[INFO] [DRM]: Mode 22: (800x600) 800 x 600, 72.187568 Hz
[INFO] [DRM]: Mode 23: (800x600) 800 x 600, 60.316539 Hz
[INFO] [DRM]: Mode 24: (720x480) 720 x 480, 60.000000 Hz
[INFO] [DRM]: Mode 25: (720x480) 720 x 480, 59.940059 Hz
[INFO] [DRM]: Mode 26: (720x480i) 720 x 480, 30.001108 Hz
[INFO] [DRM]: Mode 27: (720x480i) 720 x 480, 29.970029 Hz
[INFO] [DRM]: Mode 28: (640x480) 640 x 480, 75.000000 Hz
[INFO] [DRM]: Mode 29: (640x480) 640 x 480, 72.808799 Hz
[INFO] [DRM]: Mode 30: (640x480) 640 x 480, 66.666664 Hz
[INFO] [DRM]: Mode 31: (640x480) 640 x 480, 60.000000 Hz
[INFO] [DRM]: Mode 32: (640x480) 640 x 480, 59.940475 Hz
[INFO] [DRM]: Mode 33: (720x400) 720 x 400, 70.081657 Hz
[INFO] [GL]: Found GL context: "kms".
[INFO] [GL]: Detecting screen resolution: 1920x1080.
[INFO] [EGL] Found EGL client version >= 1.5, trying eglGetPlatformDisplay
[INFO] [EGL]: EGL version: 1.4
[INFO] [EGL]: Current context: 0x23be308.
[INFO] [KMS]: New FB: 1920x1080 (stride: 7680).
[INFO] [GL]: Vendor: Broadcom, Renderer: V3D 4.2.
[INFO] [GL]: Version: OpenGL ES 3.1 Mesa 19.3.2.
[INFO] [GL]: Using resolution 1920x1080.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 1 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Initializing HW render (1024x1024).
[INFO] [GL]: Max texture size: 4096 px, renderbuffer size: 4096 px.
[INFO] [GL]: Supports FBO (render-to-texture).
[INFO] [udev]: Keyboard #0: "SindenCameraG" (/dev/input/event7).
[INFO] [udev]: Keyboard #1: "Unknown SindenLightgun Keyboard" (/dev/input/event2).
[INFO] [udev]: Keyboard #2: "SindenCameraP" (/dev/input/event8).
[INFO] [udev]: Keyboard #3: "Unknown SindenLightgun Keyboard" (/dev/input/event5).
[INFO] [udev]: Keyboard #4: "Logitech Wireless Keyboard PID:4023" (/dev/input/event0).
[INFO] [udev]: Mouse #0: "Unknown SindenLightgun Mouse" (ABS) /dev/input/event3
[INFO] [udev]: Mouse #1: "Unknown SindenLightgun Mouse" (ABS) /dev/input/event6
[INFO] [udev]: Mouse #2: "Logitech Wireless Mouse" (REL) /dev/input/event1
[INFO] [udev]: Pad #0 (/dev/input/event4) supports force feedback.
[INFO] [udev]: Pad #0 (/dev/input/event4) supports 16 force feedback effects.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Font]: Using font rendering backend: "freetype".
[INFO] [Video]: Found display server: "null".
[libretro INFO] core/rend/gles/gles.cpp:535 N[RENDERER]: Open GLES version 3.1
[INFO] ALSA: Using floating point format.
[INFO] ALSA: Period size: 480 frames
[INFO] ALSA: Buffer size: 1536 frames
[INFO] [Display]: Found display driver: "gl".
[INFO] [Font]: Using font rendering backend: "freetype".
[INFO] [Font]: Using font rendering backend: "freetype".
[INFO] [Font]: Using font rendering backend: "freetype".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/dreamcast/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/dreamcast/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/dreamcast/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/dreamcast/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/opt/retropie/configs/dreamcast/content_favorites.lpl".
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[libretro ERROR] core/hw/maple/maple_devs.cpp:378 E[MAPLE]: Failed to create VMU save file "/home/pi/RetroPie/BIOS/dc/vmu_save_A1.bin"
[libretro ERROR] core/hw/maple/maple_devs.cpp:378 E[MAPLE]: Failed to create VMU save file "/home/pi/RetroPie/BIOS/dc/vmu_save_B1.bin"
[libretro ERROR] core/hw/maple/maple_devs.cpp:378 E[MAPLE]: Failed to create VMU save file "/home/pi/RetroPie/BIOS/dc/vmu_save_C1.bin"
[libretro ERROR] core/hw/maple/maple_devs.cpp:378 E[MAPLE]: Failed to create VMU save file "/home/pi/RetroPie/BIOS/dc/vmu_save_C2.bin"
[libretro ERROR] core/hw/maple/maple_devs.cpp:378 E[MAPLE]: Failed to create VMU save file "/home/pi/RetroPie/BIOS/dc/vmu_save_D1.bin"
[libretro ERROR] core/hw/maple/maple_devs.cpp:378 E[MAPLE]: Failed to create VMU save file "/home/pi/RetroPie/BIOS/dc/vmu_save_D2.bin"
[INFO] [KMS]: New FB: 1920x1080 (stride: 7680).
[INFO] [KMS]: New FB: 1920x1080 (stride: 7680).
[libretro INFO] core/hw/sh4/modules/mmu.cpp:510 N[SH4]: Enabling Full MMU support
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 31 seconds.
[INFO] [Core]: Unloading game..
[libretro ERROR] core/hw/flashrom/flashrom.cpp:43 E[FLASHROM]: Cannot save flash/nvmem to file '/home/pi/RetroPie/BIOS/dc/dc_nvmem.bin'
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Core]: Saved game-specific core options to "/home/pi/.config/retroarch/config/Flycast/Virtua Cop 2 v1.011 (2000)(Sega)(NTSC)(JP)(en)[!].opt".


Screenshots

None currently

StormedBubbles avatar Dec 31 '21 19:12 StormedBubbles

I tried to troubleshoot this a bit, but quickly got to a place that's out of my depth.

I tried to see if it was related to rumbling, as a few years back there was as similar issue with rumbling and lr-pcsx-rearmed. Alas, that didn't work. I tried to do some very basic profiling of the different sections of the main retro_run() loop, and the impact of the trigger event seemed to have some impact on the audio calls, and the emu.render() ones. I removed the audio calls from a test build and the stutter is still there, only slightly smaller (unsure if because the hardware I'm running it on was already struggling to keep up, or because there's a delay in the audio handling as well).

The emu.render() code paths, though, get too deep too quickly and I have no development setup to actually debug things in real-time and see what's happening - I'm developing on a Pi4.

Any thoughts or anything I could look into here? The only difference in the game between playing with the controller and the lightgun are that, with the lightgun, the screen needs to produce a quick flash of white for the (old CRT) gun to work. That doesn't happen with the controller.

Hope this helps, though I don't have more leads to follow here.

pjft avatar Feb 28 '22 14:02 pjft

Apologies, last note. This does not seem to happen on the standalone version of Flycast, at least on a Mac. I am unable to test this libretro build on my Mac, nor the standalone version on the Pi for comparison. But there's a chance that this is related to the libretro part of the code, if that helps

pjft avatar Feb 28 '22 17:02 pjft

Thanks for trying this out! According to @flyinghead on Discord this is indeed related to the libretro backport. Any pointers how to get this fixed are hugely appreciated, as VCop 2 is my favourite lightgun game of all time :-)

On Mon, 28 Feb 2022 at 18:04, pjft @.***> wrote:

Apologies, last note. This does not seem to happen on the standalone version of Flycast, at least on a Mac. I am unable to test this libretro build on my Mac, nor the standalone version on the Pi for comparison. But there's a chance that this is related to the libretro part of the code, if that helps

— Reply to this email directly, view it on GitHub https://github.com/flyinghead/flycast/issues/474#issuecomment-1054467878, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXLOPDACTISJUPTS6FFUU3U5OTJVANCNFSM5LBTQ5ZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

nexxyz avatar Feb 28 '22 20:02 nexxyz

This should be fixed in the next build. It also affected standalone.

flyinghead avatar Mar 07 '22 18:03 flyinghead

Awesome, thanks for the update!

pjft avatar Mar 07 '22 18:03 pjft

I confirm it works as intended on libretro - thank you for looking into this.

pjft avatar Mar 07 '22 21:03 pjft

Thank you! It's also good for me on libretro with a Raspberry Pi 4B.

StormedBubbles avatar Mar 08 '22 15:03 StormedBubbles

Fixed

flyinghead avatar Mar 08 '22 19:03 flyinghead

Regression due to https://github.com/flyinghead/flycast/commit/ecce9157bde124e02c72ae4f3834555530d4e99c

flyinghead avatar Aug 13 '24 12:08 flyinghead

I can't reproduce it with standalone, only with the libretro core.

flyinghead avatar Aug 13 '24 13:08 flyinghead

Using latest flycast standalone, i can reproduce it on all renderers, same with retroarch. Win10 x64 Rtx 3070ti 10900kf 32gb ram

F0xH0L3 avatar Aug 13 '24 14:08 F0xH0L3

Is this latest release or latest build? What's the full version?

flyinghead avatar Aug 13 '24 14:08 flyinghead

Sorry, i should have been more clear, it's the latest release, 2.3 build date 16-3-2024, git hash: 966ff3767

F0xH0L3 avatar Aug 13 '24 14:08 F0xH0L3

Well, scratch that, i just grabbed the latest master build, tried with openGL, Vulkan and dx11, it still happens.

F0xH0L3 avatar Aug 13 '24 15:08 F0xH0L3

Yes, it seems to happen in standalone with OpenGL. Thanks for the details.

flyinghead avatar Aug 13 '24 15:08 flyinghead

Fixed in latest master

flyinghead avatar Aug 17 '24 16:08 flyinghead

Thanks. Just chiming in to say that it's working for me in the Libretro version on Raspberry Pi 5 with Vulkan after updating a few minutes ago.

StormedBubbles avatar Aug 18 '24 17:08 StormedBubbles

Thanks for your feedback

flyinghead avatar Aug 18 '24 18:08 flyinghead

hello, i find a bug for Virtua Cop 2 (Japan). i use flycast version v2.3.2-191-g7174ef119 to play Virtua Cop 2 (Japan) By PC. when i set controls Port A to Sega Controller, i can play with keyboard to shoot and reload. but when i set controls Port A to Light Gun and set Mouse Left Button map to Dreamcast Controls Button A, set Mouse Right Button map to Dreamcast Controls Button B and set Mouse Middle Button map to Dreamcast Controls Button Start, i can use mouse to control the gun cursor position and use Mouse Left Button to shoot the gun, i can't use Mouse Right Button to reload the gun.

by the way, in this game menu, i can use Mouse Middle Button to control Dreamcast Controls Button Start, use Mouse Left Button to control Dreamcast Controls Button A and use Mouse Right Button to control Dreamcast Controls Button B, but play game Mouse Right Button can't control Dreamcast Controls Button B.

this time i wanna to use keyboard to control Dreamcast Controls Button B to reload is broken too.

dreamaster1658 avatar Sep 06 '24 06:09 dreamaster1658