mirror of https://github.com/LIJI32/SameBoy.git
Updated GB_set_input_callback (markdown)
parent
82c3d3bb8f
commit
5d6101ab48
|
@ -4,16 +4,24 @@
|
|||
typedef char *(*GB_input_callback_t)(GB_gameboy_t *gb);
|
||||
```
|
||||
|
||||
<tt>void GB_set_async_input_callback([[GB_gameboy_t]] *gb, [[GB_input_callback_t]] callback);</tt>
|
||||
<tt>void GB_set_async_input_callback([[GB_gameboy_t]] *gb, GB_input_callback_t callback);</tt>
|
||||
|
||||
<tt>void GB_set_input_callback([[GB_gameboy_t]] *gb, [[GB_input_callback_t]] callback);</tt>
|
||||
<tt>void GB_set_input_callback([[GB_gameboy_t]] *gb, GB_input_callback_t callback);</tt>
|
||||
|
||||
In `gb.h`
|
||||
|
||||
## Description
|
||||
|
||||
TBD
|
||||
`GB_set_input_callback` and `GB_set_async_input_callback` sets callback that will be called when an emulator instance's debugger requests input synchronously and asynchronously, respectively. The callbacks must return a UTF-8 string allocated by `malloc` (which will be automatically freed by the caller), or `NULL`.
|
||||
|
||||
Returning `NULL` from the synchronous callback tells the debugger the input source is not available, and ROM execution will resume until it's explicitly stopped or reaches a stopping condition again. Returning `NULL` from the asynchronous callback means the user has no pending asynchronous commands to execute, and will not prevent the debugger from calling the callback again.
|
||||
|
||||
If these functions are not called, the default callbacks will return lines read from `stdin`.
|
||||
|
||||
## Thread Safety
|
||||
|
||||
If `callback` is not NULL, `GB_set_input_callback` and `GB_set_async_input_callback` are thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback).
|
||||
|
||||
## Notes
|
||||
|
||||
The default asynchronous input callback is not supported on Windows; provide a custom callback if you wish to support asynchronous debugger commands on Windows.
|
Loading…
Reference in New Issue