Open y-haidar opened 3 weeks ago
I have started playing around with this idea, it turned ugly, and that made me think maybe stdin is more than enough. Closing
I eventually do want to make source handling more flexible, since I want to add memory mapped file support, so this isn't entirely out of the question. I'll have to think about it, but I'll reopen this until it's certain that this is an impossible/unwanted feature.
If it is helpful, this is what I did: https://github.com/y-haidar/hexerator/tree/feat_plugin_source_provider
When I run it via cargo run -- --load-plugin target/debug/libhello_world.so
I get this:
I don't fully understand the code base yet, so I doubt my work will be useful, but hopefully you can use it to gauge the difficulty of this feature.
Now that I am beginning to understand the project code, this feature isn't that difficult. Managed to get streaming to work.
Want me to make a PR? If yes, then feel free to tell me what you need.
I am thinking of splitting normal plugins and source provider plugins, in order to avoid having other plugins in a RwLock
. This means, that a plugin can only be a normal plugin(Plugin
) or a source provider plugin (PluginSP
). I had to use RwLock
due to the thread in try_read_stream
.
Want me to make a PR? If yes, then feel free to tell me what you need.
Feel free to make a PR, and I'll review it. I'm fine with experimental features in Hexerator, since I myself have a lot of weird half-baked experimental features implemented in it.
Use case
Create a plugin for outputting
mgba
's memory.Thoughts on possible implementation
The trait:
A possible solution for the lack of parameters, would be to add
PluginSettings
, where it would create a menu for configuring plugins. Provided plugins need to provide a schema containing fields with their name, description, type(string or Int only to keep it simple) and a default value.