This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
oeed's profile picture

Emulate/Rednet Disk Drive

Started by oeed, 31 March 2013 - 09:10 PM
oeed #1
Posted 31 March 2013 - 11:10 PM
Hey,

I'm working on a wireless peripheral's API and it's basically done. Monitors work, printers work and the disc peripheral functions work (for example, I can play an audio disc and set the disk label).

However, I can't figure out how to do this with the discs content as it doesn't use the Peripherals API. I've spent some time trawling through the BIOS and APIs but I can't find anything that seems to be the part where the disks content becomes 'disk/…', so I presume it's done by Java. What is the best way to do this, I'd rather not tamper with the FS API. One way is to copy the disks content, but that could be a bad idea, especially if there are large folders or the system crashes, leaving the folder there. Anyway, enough of my rambling, thoughts?
theoriginalbit #2
Posted 31 March 2013 - 11:56 PM
hmmm this is a difficult one to think for.

I just checked it out and it is done in the Java code when fs.list is called anything that is mountable gets added to the list.

could you copy the listings of the files from the remote and just store them locally in the program, then later when they are wanted actually request the file?
oeed #3
Posted 01 April 2013 - 12:07 AM
hmmm this is a difficult one to think for.

I just checked it out and it is done in the Java code when fs.list is called anything that is mountable gets added to the list.

could you copy the listings of the files from the remote and just store them locally in the program, then later when they are wanted actually request the file?

What file is it done in? I presume I'm going to have find and download the non-compiled source, the .Class files are unreadable.

The main thing I want to do with this API is to have it seamlessly intergratable with existing code. So injecting something into the FS API might be the best way.
theoriginalbit #4
Posted 01 April 2013 - 12:17 AM
The main thing I want to do with this API is to have it seamlessly intergratable with existing code. So injecting something into the FS API might be the best way.
Yeh that will probs be the best way, unless others can think of a way…
oeed #5
Posted 01 April 2013 - 12:23 AM
Can you send the Java file/snippet (if you have it) of this function. If not, how do I find it?
Bubba #6
Posted 01 April 2013 - 02:23 AM
Can you send the Java file/snippet (if you have it) of this function. If not, how do I find it?

Java can be deobfuscated using immibis' Bearded Octo Nemesis and then decompiled with any number of decompilers (I like JD-GUI). You'll have to set up forge as well, but it's not too hard. Check out this and follow the first 5 steps. After that you can open the resulting .jar or .zip file in JD-GUI. MCP by the way is the Minecraft Coder Pack, but just by downloading the forge source you get MCP packaged with it.

Sorry if you already know how to do this stuff, but that's just what I gathered from your question.
theoriginalbit #7
Posted 01 April 2013 - 02:28 AM
-snip-
Nice way to tell the community how to decompile a closed-source product :P/>
I've found deobfuscation isn't really needed. Most of the stuff needed to be read is in plain text and isn't anything Minecraft related.
Bubba #8
Posted 01 April 2013 - 05:40 AM
-snip-
Nice way to tell the community how to decompile a closed-source product :P/>
I've found deobfuscation isn't really needed. Most of the stuff needed to be read is in plain text and isn't anything Minecraft related.

The information on decompiling Java products is pretty easy to find; I only gave him pointers in the right direction. I don't think that dan or cloudy would be against people learning from their code so long as people do not distribute/take credit for it (correct me if I'm wrong).

And yeah, deobfuscation isn't really needed for the majority of the code, but if you want to be able to tell how it interacts with minecraft itself then you do need to.