Commit graph

364 commits

Author SHA1 Message Date
giongto35
a01dd68d90 Add Model Context Protocol input 2025-06-13 01:17:25 -07:00
sergystepanov
02210f1f8d Remove unnecessary C bridge functions 2025-05-18 12:46:32 +03:00
sergystepanov
36da07f277 Use the actual state size when loading ROMs 2025-05-03 16:35:21 +03:00
sergystepanov
37a4a80996 Use the save state size before each save/load call 2025-05-03 15:55:26 +03:00
sergystepanov
9d4256306e Add missing C function header for Go debugger 2025-05-02 10:34:22 +03:00
sergystepanov
ddfc9249ec Fix some user slot race conditions
In cases where HasSlot() and Reserve() operations are delayed, multiple users may incorrectly be granted a slot due to race conditions.
2025-05-02 10:06:23 +03:00
sergystepanov
3ac7a559df Skip YUV test
It is broken on Windows
2025-04-17 09:11:26 +03:00
Sergey Stepanov
0c768bb3d6
Add some notes on recording in regards to ffconcat 2024-12-21 01:37:42 +03:00
Sergey Stepanov
f78bcf3e4b
Allow config for the remote Libretro core repos 2024-12-20 01:32:20 +03:00
Sergey Stepanov
535e725618
Panic when dlib functions are missing 2024-12-19 21:40:14 +03:00
Sergey Stepanov
4aaeda3fbb
Move some RETRO_ENVIRONMENT vars into C 2024-12-16 23:28:14 +03:00
Sergey Stepanov
89ae98b035 Why do we need samples
In an ideal scenario, the emulator generates a video frame and an audio chunk with its internal frame rate. For example, if the emulator runs a game at 60 FPS, it will produce 16 ms worth of audio and a video frame with each tick (or call of the run function). Then we need to send all this data to the user's browser, which becomes tricky with WebRTC audio.

The WebRTC standard supports only Opus-encoded audio for high-quality sound. The encoder and decoder (the audio player in the browser) have a limitation: they can only operate on fixed audio frames or predefined chunks of audio, which are 5, 10, 20, 40, or 60 ms in length.

Due to this limitation, we have to wait at least two ticks until the first whole audio chunk can be packed into predefined frames. If we have 16 ms of audio and one fixed buffer, we send 10 ms right away and have to wait for 4 ms to add to the remaining 6 ms. This will lead to a constant 6 ms delay between audio and video.

To mitigate this issue, we can set the smallest frame size as a buffer, i.e., 5 ms. This will decrease the latency to 1 ms, but we will send 3 packets of data in this manner for 16 ms.

A slightly better way is to create several buffers and dynamically select the next buffer so that the audio fits optimally, minimizing the number of network packets sent to users.

This frames thing essentially accomplishes that. In the options, we can select multiple (or one) Opus buffers to store audio and choose from. They should be defined from the largest to the smallest. And that's it.
2024-12-13 18:57:25 +03:00
sergystepanov
ed3b195b26
Dynamic audio buf
* Ugly audio buf

* Use dynamic Opus frames with config
2024-12-12 21:13:43 +03:00
Sergey Stepanov
f54089e072
Stretch samples a bit better with the GBA's 32768Hz 2024-12-07 00:47:27 +03:00
Sergey Stepanov
6bb82b2204 Allow 2.5ms Opus frame 2024-12-06 15:27:18 +03:00
Sergey Stepanov
d77d69a331 Remove pool from the audio stretcher 2024-12-05 13:50:39 +03:00
Sergey Stepanov
5649d4410a
Remove pools from YUV conv 2024-12-05 01:11:02 +03:00
Sergey Stepanov
db32479c4e
Destroy rooms when the coordinator was lost 2024-12-05 01:10:16 +03:00
Sergey Stepanov
a7acebc5d0
Try YUV without the mem pool 2024-12-04 22:09:51 +03:00
Sergey Stepanov
954bb23bb8
Add Reset with 0 key 2024-12-03 00:38:15 +03:00
Sergey Stepanov
7134782245
Enable frame duplication for Mupen64 2024-12-03 00:34:43 +03:00
Sergey Stepanov
5a42dc9857
Fail x2 on no coordinator connection 2024-12-01 20:26:29 +03:00
Sergey Stepanov
9caf45af78
Reset fail timer on success 2024-12-01 18:20:54 +03:00
Sergey Stepanov
b2e275a6cd
Don't crash the app on http2 garbage 2024-11-28 23:24:35 +03:00
Sergey Stepanov
45dba68b15
Faster CopyFile 2024-11-28 21:16:31 +03:00
Sergey Stepanov
1831e44eef Add new saveStateFs config param
Used when you need a copy of FS for new game sessions (i.e. DOSBox uniqueSaveDir=true).
2024-11-26 19:35:31 +03:00
Sergey Stepanov
88a0911f93
Avoid segfault with nil error handlers in ws 2024-11-17 22:27:34 +03:00
Sergey Stepanov
8686c4a6e5
Return workers by wids right away ;_; 2024-11-17 22:13:39 +03:00
Sergey Stepanov
2c50ae2290
Allow one game per a direct worker 2024-11-17 20:29:45 +03:00
Sergey Stepanov
f09500f289
Check slots for direct workers 2024-11-17 19:55:14 +03:00
Sergey Stepanov
1147aeda14 Track all worker saves to resume old games
Move library config to the top level
2024-11-17 12:59:43 +03:00
Sergey Stepanov
7b57f73b26 Send worker lib 2024-11-17 12:59:43 +03:00
Sergey Stepanov
45cc9e8245 Move library config to the top level 2024-11-17 12:59:43 +03:00
Sergey Stepanov
795771e3d6 Add custom file lock 2024-11-17 12:59:43 +03:00
Sergey Stepanov
6ccbea8bd9
Fix test 2024-10-18 22:20:34 +03:00
Sergey Stepanov
003eb5b995
Add CBR mode and max-rate, buf-size config options to x264 2024-10-18 21:59:41 +03:00
Sergey Stepanov
f1ece58c7b
Add new aliasFile option
The option allows changing the alias file name.
2024-09-14 20:38:16 +03:00
Sergey Stepanov
bdf3598367 Add game aliases
Allows different game names to be set in the alias.txt file [as name=alias] located in the games directory.
2024-08-31 22:29:31 +03:00
Sergey Stepanov
b9d35fa626
Fix save dir string freeing order 2024-08-27 14:30:49 +03:00
Sergey Stepanov
7da993a4c7 Add the uniqueSaveDir option
This option allows for the safe use of distinct filesystem snapshots of games with some cores (e.g., DosBox). Keep in mind that with this option enabled, game changes won't be saved (the unique save folder will be deleted on exit) until you explicitly call the save (or share) function. Thus, you will need files like dosbox.conf along with the games to use some default behaviors with each new game session.
2024-08-21 18:52:26 +03:00
Sergey Stepanov
ddb16f899f
Update dependencies 2024-08-17 18:13:46 +03:00
Sergey Stepanov
8f859cd600
Reinit encoders with the mutexes 2024-08-11 12:18:41 +03:00
Sergey Stepanov
0232384fe2 Use mutex when switching media encoders 2024-08-11 11:50:54 +03:00
Sergey Stepanov
7873631613
Add skip_same_thread_save hack 2024-08-09 00:54:08 +03:00
Sergey Stepanov
466257d3be
Add NonBlockingSave option for background saving
This feature introduces a new configuration option, `NonBlockingSave`, which allows background saving for large files. With this param the saving process will not block the main thread with all network sockets.
By default, it's enabled for the DosBox core.
2024-08-07 20:31:14 +03:00
Sergey Stepanov
34a947ac6d
Update libretro.h 2024-08-06 19:57:45 +03:00
Sergey Stepanov
d855e56a2f Add a DOS game (Rogue) 2024-08-02 11:04:44 +03:00
Sergey Stepanov
7ee98c1b03 Add keyboard and mouse support
Keyboard and mouse controls will now work if you use the kbMouseSupport parameter in the config for Libretro cores. Be aware that capturing mouse and keyboard controls properly is only possible in fullscreen mode.

Note: In the case of DOSBox, a virtual filesystem handler is not yet implemented, thus each game state will be shared between all rooms (DOS game instances) of CloudRetro.
2024-08-02 11:04:44 +03:00
sergystepanov
d6199c9598
Use ROM folders
Libretro cores are selected based on the file extensions of the ROMs. However, ROM file extensions are not unique across cores (e.g., .zip is used in both DosBox and MAME). To load a specific core correctly, it's necessary to place the corresponding ROMs in designated folders specified in the configuration. By default, you can use the keys from cores.list as the folder names, or you can specify your own custom folder names using the 'folder' parameter for each core.
2024-07-24 20:31:12 +03:00
Sergey Stepanov
ba7db72093
Increase buffers that use max dimensions from the Libretro geometry
Some cores may render frames bigger that reported max dimensions. This may help a bit.
2024-07-15 12:10:18 +03:00