Posted 01 May 2012 - 10:47 AM
I was working on designing an OS, one that would not be multithreaded, but would allow paralell processes by using a central event dispatch to decide what proccess to continue running. The idea is to enable, say, someone to be typing on the terminal, communication about stuff over the rednet, and to be moving as a turtle at the exact same time, all from the same proccess. Why? It's fun. :)/>/>
So, I noticed that the computercraft api has a number of undocumented events. In addition to the standard "key", "rednet_message", "terminate", "timer", and "alarm", there are a number of undocumented events used in the built in apis. Also, there are just a number of plain undocumented apis whose existance is simply mentioned.
One is the "turtle_response" event. It seems like the native turtles libraries are wrapped away. The original libraries do not wait for a turtle to arrive, they just contine proccessing. The wrapper then just waits for a "turtle_response" and returns if it managed to move, but this could be bypassed in theory if the native apis could be accessed somehow, and the turtle could do stuff while it moves and mines and such, and then move again once it gets a "turtle_response". Unfortunately, my Lua-fu is too limited to know how to extract a wrapped function via introspection or something.
The rednet api is completely filled with this sort of thing, to the point where it is hard to understand. Apparently, periphrials send events "periphrial" and "periphrial_detach", and the whole of rednet is just a hacked-on implementation on top of the rs library, using "redstone", "close", and "send" events, and the whole "rednet_message" is implemented on top.
… and of course, I have no idea how much else exists that is like this in other areas that we don't have access too, or that I didn't see.
I am just wondering how much of this "hidden API" stuff can be used. Off the top of my head, it might be possible to reimplement a "cracked" rednet api that reads all messages, even ones not sent to it. Any ideas?
So, I noticed that the computercraft api has a number of undocumented events. In addition to the standard "key", "rednet_message", "terminate", "timer", and "alarm", there are a number of undocumented events used in the built in apis. Also, there are just a number of plain undocumented apis whose existance is simply mentioned.
One is the "turtle_response" event. It seems like the native turtles libraries are wrapped away. The original libraries do not wait for a turtle to arrive, they just contine proccessing. The wrapper then just waits for a "turtle_response" and returns if it managed to move, but this could be bypassed in theory if the native apis could be accessed somehow, and the turtle could do stuff while it moves and mines and such, and then move again once it gets a "turtle_response". Unfortunately, my Lua-fu is too limited to know how to extract a wrapped function via introspection or something.
The rednet api is completely filled with this sort of thing, to the point where it is hard to understand. Apparently, periphrials send events "periphrial" and "periphrial_detach", and the whole of rednet is just a hacked-on implementation on top of the rs library, using "redstone", "close", and "send" events, and the whole "rednet_message" is implemented on top.
… and of course, I have no idea how much else exists that is like this in other areas that we don't have access too, or that I didn't see.
I am just wondering how much of this "hidden API" stuff can be used. Off the top of my head, it might be possible to reimplement a "cracked" rednet api that reads all messages, even ones not sent to it. Any ideas?