Commit Graph
52 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 6ed178075c sceUsbMic: Fix QueueBuf::resize losing what was buffered
It allocated the new buffer, pointed buf_ at it, then popped from buf_,
so it copied the uninitialized new buffer onto itself. That happened
whenever a game asked for a larger block than before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 18:55:13 +02:00
Henrik RydgårdandClaude Opus 5.5 6cf4872e78 Android: Hand microphone input over on the CPU thread, like the other hosts
The Oboe input callback used to call Microphone::addAudioData directly,
writing PSP memory from the audio thread. Now it only pushes samples
into a SampleRing, and pollRecording drains it on the CPU thread.
Starting and stopping still go through Java, which asks for permission.

Every host with a microphone polls now, so sceUsbMic drops what only the
push path needed: QueueBuf's recursive mutex, restarting the mic on a
device change, and the startMic parameter nobody read. Also removes the
unused System_AudioRecordingState and Microphone::isNeedInput.

The Java microphone_command branch didn't return true, so every command
logged "processCommand failed".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 18:49:21 +02:00
Henrik RydgårdandClaude Opus 5.5 3656fb46e2 Windows: Capture the microphone through WASAPI instead of Media Foundation
Windows now uses the same host interface as SDL and iOS: sceUsbMic sends
startRecording/stopRecording/deviceChanged, and drains buffered input on
the CPU thread with pollRecording. A capture thread asks WASAPI for mono
16-bit at the game's rate (it converts from the mix format, so no more
ffmpeg resampling), and copies packets into a lock-free ring buffer.
It reopens the device when the selection changes, and retries once a
second if the device is missing or gets unplugged.

The device list comes from the active capture endpoints. Their friendly
names are the ones Media Foundation reported, so existing MicDevice
settings still match. An empty setting, now selectable as Auto like on
SDL, means the default capture device.

The Media Foundation audio capture code is removed; the camera still
uses it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 18:28:33 +02:00
Henrik RydgårdandClaude Opus 5.5 b4ec29111b Microphone: Let the host say whether it wants polling, rather than checking for SDL
The CPU-thread polling added for SDL was keyed off defined(SDL), which
headless and Core are built with too, hence the extra headless check.
Ask the host instead, with SYSPROP_MICROPHONE_NEEDS_POLLING, so other
hosts can hand their input over the same way.

startMic now sends the same startRecording command for every non-Win32
host, taking the rate from curSampleRate like the SDL path did. The
Android path read it from param, which leaked, and which is null when
coming from onMicDeviceChange.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 17:20:48 +02:00
Chriopter 1670f5d1f9 SDL: Add microphone recording and device selection. 2026-10-09 00:18:31 +02:00
Chriopter 4a25d8d6cc Microphone: Fix blocking wait calculations. 2026-10-09 00:16:01 +02:00
Henrik RydgårdandClaude Opus 5.5 948062907b sceUsbMic: Complete blocking reads when the samples are due
With a host microphone present, a blocking read waited until the host had
delivered all the data. If it never did, the thread waited forever: Go!Edit's
sound thread stalled that way and its video recording never advanced. The
PSP mic streams in real time, so wake at the scheduled time and fill what
the host didn't deliver with silence.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 11:44:10 -06:00
Henrik RydgårdandClaude Opus 5.5 4504092d3d sceUsbMic: Don't crash when there's no Windows capture device object
Only the app creates winMic, so a blocking mic read crashed headless.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 11:19:18 -06:00
Henrik RydgårdandClaude Opus 5.5 cd94e414cd Savestate: Reset what older states lack instead of keeping pre-load values
Missing sections (videocodec, audiocodec, aac, mp3) and old-version
branches (impose, io, umd, gps, mic, display, font) left the session
before the load in place.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 11:32:07 -06:00
Henrik RydgårdandClaude Opus 5.5 2e5edcd298 Savestate: Don't break event callbacks when a save fails
CoreTiming::DoState replaced every event's callback with the anti-crash
one in every mode, relying on each module's restore to put it back. A save
that failed partway never got to those, and left the running game with
events that break into the debugger. The missing-section fallbacks then
also ran on the save: cheats and the mic re-registered events into the
wrong slots, and achievements reset the runtime.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 09:34:06 -06:00
Henrik Rydgård c6061aebca Debugger: don't persist log.channel.set changes to the saved config
log.channel.set is meant for temporary, session-only diagnostic
tweaks (e.g. quieting a noisy channel while investigating something
over the WebSocket debugger). It was going through the same
SetLogLevel/SetEnabled calls the UI settings use, so a normal app
exit would persist whatever channels/levels the debugger last left
set, silently overwriting the user's real saved log preferences for
future runs - discovered when a later session's default logging
looked "off" for no apparent reason.

LogManager now tracks whether the debugger has touched channel
config this run and skips SaveConfig() entirely if so, leaving
whatever's already on disk untouched.
2026-08-21 10:32:21 +02:00
Henrik Rydgård 3bd41376da More memory cleanup 2026-08-11 20:12:10 +02:00
Henrik Rydgård d2c2ee337e Remove the mfplat.dll hard dependency (now dynamic). 2026-05-11 16:09:22 +02:00
Henrik Rydgård 4e25f44eef Rename some module-related functions to include HLE where appropriate 2025-03-31 11:17:50 +02:00
Henrik Rydgård a18eb97be3 Consolidate more error codes into the big enum 2025-02-04 12:11:22 -06:00
Henrik Rydgård 350882d592 Fix misuse of erase-iter idiom in __MicBlockingResume (N5) 2025-02-04 10:19:29 -06:00
Henrik Rydgård 1280fcc581 Beaterator: Prevent hanging when trying to record audio by switching thread in sceUsbMicWaitInputEnd 2024-10-15 15:30:37 +02:00
Henrik Rydgård 65a088537f Microphone queuebuf: Switch to int instead of u32 to simplify length checks. No more crashes, but it hangs
see issue #19528
2024-10-15 15:30:37 +02:00
Henrik Rydgård e51c58716b Fix minor code issues flagged by PVS-Studio and reported by alphrixus. 2024-10-10 14:10:30 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård 87d0c21f14 Make proper requests for the external hardware commands (gps, microphone, camera) 2023-03-22 23:52:25 +01:00
Henrik Rydgård d3955b42bb Rename some system functions, merge the Launch* ones.
android launchurl buildfix
2023-03-21 12:22:59 +01:00
Unknown W. Brackets ff3e70be2f UsbMic: Fix copy on resize shrink. 2022-12-30 21:31:33 -08:00
Unknown W. Brackets 1a85370c0a UsbMic: Avoid some temp buffers, check range. 2022-12-30 21:29:26 -08:00
Unknown W. Brackets 13ec384dbe Build: Explicitly include ppsspp_config.h.
This adds it to all files that use it.  Not all our builds include the
file.
2021-03-02 21:04:03 -08:00
Henrik Rydgård 93fd62f54b Merge pull request #13832 from unknownbrackets/events
SaveState: Make event restoring more obvious
2021-02-15 23:39:42 +01:00
Unknown W. Brackets 9d22297a90 Windows: Use CommonWindows more consistently.
Also, make sure WinSock2.h is included beforehand where it's needed.
2021-02-14 10:30:10 -08:00
Unknown W. Brackets 06f8ab5a49 SaveState: Make event restoring more obvious.
We still must restore all events, but everything can be taken care of
during the save state load.
2020-12-28 13:29:19 -08:00
shenweip 6afeed877c Build fixes 2020-11-24 21:36:17 +08:00
shenweip be0449d16d Fixes state. 2020-11-24 17:28:31 +08:00
shenweip 9a85ab2c43 Writes target buffer address in multiple times.
Would be better to calculate read data length.
2020-11-24 17:15:26 +08:00
shenweip 235919f905 Try to implement some related funcs.
Marked as UNTEST.
2020-11-23 17:13:55 +08:00
shenweip 730d9f8fd9 Clean up. 2020-11-23 15:49:14 +08:00
shenweip f2bd0b9f6f Implements sceUsbCamGetMicDataLength. 2020-11-23 14:07:11 +08:00
shenweip c70c8cad6e Makes a distinction between blocking and non blocking modes. 2020-11-22 02:06:15 +08:00
shenweip aac4cbb1dc Changes the way of reading microphone data.
Feeds the microphone buffer continuously(Windows) and overwrites old data with new data when the buffer has no remaining space.
2020-11-22 01:17:25 +08:00
sum2012 c223c18afe Fix crash in sceusbmic on load old staus then save again
Fix #1358 again
2020-11-15 13:16:29 +08:00
Henrik Rydgård f3c05cb81a Merge pull request #13575 from Florin9doi/android_audio_record2
[Android] Audio record using OpenSL
2020-10-31 10:25:14 +01:00
shenweip eb5c22bbae SaveState:Don't register the event during Dostate. 2020-10-27 19:50:27 +08:00
Florin9doi 6531c7f4f8 [Android] Retrieve isMicStarted from AndroidAudio state 2020-10-24 20:16:22 +03:00
Florin9doi 9379fe1399 [Android] Audio record using OpenSL 2020-10-24 19:51:30 +03:00
shenweip e7147fdb09 Fixes savesate for usbmic.
Prevents audiobuf from being null pointer.
2020-10-24 21:06:36 +08:00
Henrik Rydgård ff8148dd92 Move native/util, native/data and native/i18 to Common/Data.
Also move colorutil.cpp/h

linking build fix experiment

Delete a bunch of unused CMakeLists.txt files

CMakeLists.txt linking fix

Don't include NativeApp.h from any headers.

Android.mk buildfix

Half of the UWP fix

Buildfix

Minor project file cleanup

Buildfixes

Guess what? More buildfixes!
2020-10-04 07:28:29 +02:00
Unknown W. Brackets b8342fb8ec SaveState: Rename ChunkFile files to Serialize.
Makes more sense and less weird than ChunkFileDoMap, etc.
2020-08-10 08:04:05 +00:00
Unknown W. Brackets 4b4e3432cd SaveState: Split Do() into a separate header. 2020-08-10 08:03:41 +00:00
Henrik Rydgård a47c33ac57 Fix error in sceUsbMic savestate handling (need to accept old savestates without the section)
Hopefully helps #13236.
2020-08-02 15:08:51 +02:00
shenweip e349eb803d Init parameters in __UsbMicInit to avoid incorrect initial state when you exit to menu from ingame.
Also use memcpy instead of a loop.
2020-08-02 00:22:22 +08:00
shenweip fd619c9fc5 BuildFix 2020-07-31 19:19:51 +08:00
shenweip d195cba837 Flush audio buffer when a transmission is completed. 2020-07-31 17:10:00 +08:00
shenweip 6d26bd6539 Do state. 2020-07-31 15:52:03 +08:00