Commit Graph

136 Commits

Author SHA1 Message Date
Flyinghead df93c069f2 sdl: add sdl_gamepad.cpp 2025-06-16 18:50:37 +02:00
Flyinghead 8801b2ae16 haptic: add sine effect. implement spring for midi FFB
Add sine effect to haptic api and stop using maple rumble for naomi FFB.
Emulate spring in midi FFB. Thanks to njz3 for his help on decoding the
protocol.
Don't use exponential scale for rumble when using haptic sine effect.

serialize Sh4OCache::writeBack/ThroughBufferCycles
2025-06-16 17:50:36 +02:00
Flyinghead 7e7f645f37 sdl: use SDL_HAPTIC_STEERING_AXIS instead of SDL_HAPTIC_CARTESIAN
tentative fix for Issue #1962
2025-06-13 11:58:19 +02:00
nexus382 64b9e51af0
button mapping multi binds (#1938)
Add button combination mappping support
- Implement tracking of pressed buttons in GamepadDevice
- Add ability to detect button combinations- Fix mapping system to preserve individual button mappings
- Ensure buttons can work both individually and as part of combinations
- Ensured trigger buttons can be the first button in a combination
- Maintained detection state when binding multiple buttons
- Added special handling to recognize both original and normalized trigger codes

---------

Co-authored-by: James Smith <jmsmith86@gmail.com>
2025-06-03 16:28:51 +02:00
James eacadf24a6
DreamPicoPort Mapping Updates (for maraca support) (#1940)
Add rightx and righty for DreamPicoPort (for maraca support)
Add secondary d-pad to dreampicoport mapping
Allow DreamLink device to dictate button/axis name; set custom button names in DreamPicoPort to known codes
2025-05-19 10:37:03 +02:00
nexus382 f62582a4bd
Screen position bug fix with multiple monitors (#1916) 2025-04-28 18:58:33 +02:00
James 2631706fe2
Enable physical VMU memory access (#1881) 2025-03-22 15:59:42 +01:00
Mike Kosek 9cdd0aab9f
Rename DreamPort to DreamPicoPort (#1850)
* Renamed DreamPort to DreamPicoPort
* Removed fallback to deprecated config keys
2025-02-22 08:11:05 +01:00
James 4e74619d9e
Harden serial comm interface (#1847)
* Harden serial interface
* Fixed build errors
* Minor tweaks
* Automatically attached A->A, B->B, etc
* Interfaces go in decending order
* Do a modulo in case I decide to move interface numbers
* Do specifically mod 4
* Call SDL_JoystickGetDeviceInstanceID which seems to help with a Windows bug
* Made MapleDevices smart pointers so they can freely be swapped out without leaking
* Fixed issues some issues reported by kosekmi
* Added missing bracket
* Fixed another compile issue
* Fixed a missing else
* If device had no serial number, fall down to checking name
* Use new DreamPort firmware dynamics
* Added missing parens
* Fixed screen blanking issue
* Added const
* Reset VMU Screen on game/emulator exit
* Added gameTermination() hook to hardware gamepad
* Send SW port on game termination
* Added checks so port is only sent if data is valid
* Fixed bug: wait for write to complete in sendCmd
* Fixed bug leading to multiple pointers to VMU and Rumble pack
---------

Co-authored-by: Mike Kosek <mike@kosek.de>
2025-02-16 17:36:57 +01:00
James a35e8214df
Serial comm update (#1820)
* Broke apart DreamConn and DreamcastControllerUsb implementations; added serial timeouts; process serial in thread; removed crc from DreamcastControllerUsb sdl definition

* Added missing include statements

* Changed INFO_LOG to NOTICE_LOG on a couple of lines

* Clear the read queue once string is pulled off of it
2025-01-28 17:27:26 +01:00
Mike Kosek ce0060126e Now adding mappings for Dreamcast Controller USB during input_sdl_init() 2025-01-25 17:02:18 +01:00
Mike Kosek 77636391fc Enabled the usage of VMUs and Rumble Packs with Original DC Controllers 2025-01-25 17:02:18 +01:00
Flyinghead b9fdd5070b dreamconn: detect dreamconn+ with VID/PID. Send maple data as text.
Create DreamConn gamepad when detected.
Send/receive maple data in ascii dump form.
Simplify maple device creation.

Issue #1305
2024-12-20 20:02:58 +01:00
Flyinghead 34a5e7f47d input: dreamconn+ support prototype
Issue #1305
2024-12-16 17:17:45 +01:00
Flyinghead 2b83df86cd boxart: don't save database when pausing (android, uwp)
Avoids ANR on android. Unnecessary since database is now saved
regularly.
2024-07-20 10:07:18 +02:00
Flyinghead adeba60ba9 input: ffb support for arcade games. rumble support (f355, 18wheeler)
SDL force feedback for racing wheels.
Support for jvs ffb (f355, 18wheeler), atomiswave (maxspeed, ftspeed)
and midi ffb (initd, clubk, kingrt66, sgdrvsim).
Simple haptic rumble for f355 and 18wheeler.
2024-06-01 11:03:14 +02:00
Flyinghead 336706e728 move most os_* funcs to oslib
add os_DestroyWindow and os_UpdateInputState
2024-04-12 17:37:45 +02:00
Flyinghead 06a6e26588 get rid of os_GetSeconds()
replace it with std::chrono-based getTimeMs()
2024-04-11 15:25:25 +02:00
Flyinghead 9e916ca1c9 minor input and lua fixes
Make macOS keyboard class with haptic code
Call SDL_JoystickSetPlayerIndex using maple port
Add Network event for LUA
Set proper controller unique id on iOS
rumblePower wasn't copied over new mappings.
2024-04-10 17:24:47 +02:00
Flyinghead 588035d9eb set currently played game name in the window title
Issue #28
2024-03-01 12:00:24 +01:00
Flyinghead 713739bbc7 sdl: support multiple mice when allowed by the platform 2024-02-24 21:33:40 +01:00
Flyinghead 90b13a40ab gladLoader: check return code and log. cheats: light refactoring 2024-02-10 12:06:48 +01:00
Flyinghead 1153238e2c sdl: (linux) fix window position at startup/recreation
Window decorations dimensions aren't taken into account on linux when
creating a window. So reposition it after it's shown.
2024-01-29 17:08:10 +01:00
Flyinghead 471e0a7786 sdl: add timeout for barcode scanner to recover from incomplete reads
Reset barcode buffer after 0.5 s. Allows to recover from a failed read
or the user pressing '*'.
2024-01-29 11:25:55 +01:00
Flyinghead b2d96d77d7 naomi: support hid barcode scanner. sdl: detect keyboard layout
sdl: Support for HID barcode scanners such as unitech MS146.
Automatically detect keyboard layout at start up.
2024-01-27 16:01:57 +01:00
Flyinghead 19bb4a6e5d switch: implement rumble with native API 2024-01-20 19:23:09 +01:00
Flyinghead cfb7ff3054 switch: use latest devkitpro. touchscreen support. cleaner abort
Use latest devkitpro image.
Call diagAbortWithResult on fatal errors instead of freezing/infinite
loop.
Add Exit button on main content screen.
Touchscreen support.
2024-01-16 11:21:32 +01:00
scribam 105ab95efa deps: update imgui and implot 2023-11-25 17:08:01 +01:00
vkedwardli b92277ac58
macOS: Register file extensions for `openFile` (Drag ROM to App Icon), update `setupWorkingDirectory`, rename `SDLMain` to `SDLApplicationDelegate` to avoid confusion with the function `SDL_main()` (#1287)
Register file extensions for openFile, and supports the following actions
    Drag ROM to Application icon to launch the app
    Drag ROM to the running app's dock icon
    Drag ROM to the running app's window (applicable to all SDL platform by SDL_DROPFILE)
Update setupWorkingDirectory
    macOS default cwd is a nonsense "/" for non-terminal application
Rename SDLMain to SDLApplicationDelegate to avoid confusion with the function SDL_main()
some code cleanup
2023-11-07 16:29:08 +01:00
Flyinghead a915f185f8 Merge remote-tracking branch 'origin/master' into dev 2023-09-25 22:17:29 +02:00
vkedwardli f75a16f40c
Ignore Mouse Capture when Left Ctrl or Left ALT is mapped to a Dreamcast Key (#1203) 2023-09-24 16:02:18 +02:00
Flyinghead c637ae8281 Merge remote-tracking branch 'origin/master' into dev 2023-07-30 18:05:38 +02:00
Lucas Azevedo 9c61006941 Fix GUI SDL mouse buttons
Clicks were swapped in GUI as SDL uses 2 for middle and 3 for right and
the GUI expects the opposite (minus 1).
2023-07-18 11:00:58 +02:00
Flyinghead 7a22318b0f sdl: don't send button up events based on mouse button state
as doing so cancels other inputs bound to the same target
2023-07-16 19:03:07 +02:00
Flyinghead d6fe46649c sdl: also use F11 to toggle fullscreen
in addtion to alt+enter
2023-06-12 16:05:34 +02:00
Flyinghead c033a81eca get rid of KeyboardDeviceTemplate 2023-03-29 16:48:46 +02:00
Flyinghead 018a852995 network: naomi net was closing stdin. Slaves don't broadcast outputs
naomi network: Initialize socket to -1. Only close if valid.
Multiboard or sgdrvsim slaves don't broadcast digital outputs
Don't save slave windows position
2023-03-10 18:01:49 +01:00
Flyinghead 885a0508c0 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/hw/aica/sgc_if.cpp
#	core/hw/naomi/naomi.cpp
#	core/hw/sh4/dyna/driver.cpp
2023-02-28 20:02:23 +01:00
namtsui a1472fb190
OpenBSD 7.2 patches (#953)
* OpenBSD: BSS is immutable so mark it as mutable so that mprotect RWX works

see: mimmutable(1)
bc009f82ea

* OpenBSD does not have mcontext_t

<signal.h> provides `typedef struct sigcontext ucontext_t;'.
take register names from <machine/signal.h>, which provides struct
sigcontext.

see:
1a13d3ae4e

* OpenBSD uses major.minor for shared libs, so properly dlopen libGL.so

* OpenBSD remove redefinition of swap16

* OpenBSD: SDL2 controller detection

Use sdl_open_joystick() to open controllers on startup instead of
SDL_JOYDEVICEADDED event, which never gets detected.

* OpenBSD does not have mcontext_t but linux does
2023-02-28 18:22:45 +01:00
Flyinghead b86df7217c sdl: don't add a joystick if its name can't be retrieved
Otherwise it crashes later on during SDL_JoystickClose

Fixes MINIDUMP-9K, MINIDUMP-B4
2023-02-27 17:59:48 +01:00
Flyinghead 30501aebb1 Race condition when stopping while emu is failing
Emulator::stop now throws if an error occurred on the emu thread.
Fixes MINIDUMP-5B
2023-02-26 22:01:32 +01:00
scribam 3f8ecfedbb sdl: use _WIN32 2023-02-18 13:25:14 +01:00
Flyinghead debe21de7b Merge remote-tracking branch 'origin/master' into dev 2023-02-05 22:20:28 +01:00
Flyinghead 0b6c09da02 sdl: don't rely on event to get window size when processing resize event
window size may be different from drawable size if high-dpi is enabled.
Fixes wayland resize with scale factor > 100%.
2023-02-05 11:30:23 +01:00
Flyinghead 90e9f70a1a vk: fix resizing on wayland. validation errors with framebuffer render
wayland doesn't return the current surface dimensions in
getSurfaceCapabilities so we defaulted to 640x480. Instead use the
current display dimension as set by SDL.
Issue #648
Issue #898 (partial fix)

Vulkan validation errors when doing direct framebuffer rendering if fb
slots are skipped, since the corresponding fence isn't waited on.
Instead use an independent index to use them in sequential order.
2023-02-03 11:19:41 +01:00
Flyinghead c461624a67 move khronos to deps. get rid of old controller mappings and pandora 2023-02-03 10:42:43 +01:00
Flyinghead 99d5266aa0 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/hw/holly/sb_mem.cpp
#	core/hw/naomi/naomi.cpp
#	core/hw/naomi/naomi_flashrom.cpp
#	core/hw/pvr/ta_ctx.h
#	core/rend/gui.cpp
2023-01-27 15:41:45 +01:00
scribam 80cf4406a7 cleanup include headers 2023-01-26 10:06:51 +01:00
Flyinghead f8372c51a7 Revert "wip headers"
This reverts commit e3e2c3a0d2.
2023-01-24 14:26:14 +01:00
scribam e3e2c3a0d2 wip headers 2023-01-23 18:29:04 +01:00