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

CcDLL Program Extentions in ComputerCraft

Started by Creeper9207, 06 April 2015 - 09:56 PM
Creeper9207 #1
Posted 06 April 2015 - 11:56 PM
Let me introduce my little dll maker, its not much, but i like to think it is effecient.
for an example, it packaged LyqydOS in 2 seconds.

for those who dont know, a dll is a windows system file, with a filesystem in it, like a zip, but files in it are accessed directly, i wanted to make the closest thing to a cc EXE as possible

right now its just a packager, but here: have some upcoming features:
SpoilerAPI
Pull only one file out at a time
get data from certain file(api)
file archiver(Not confirmed)
Possile self-extraction

note* Doesn't package the rom folder

Syntax: #.dll not required
pack <output file>.dll [directory to pack]
unpack <file name>.dll [output directory(do not end with a "/"!)]

Packing syntax(make your own file to dll manually):
packed directory:
disk/hi : "hi :)/>"
hello : "hello\n:)"
output file: #\n is replaced with =n32
::disk/hi::hi :)/>;/;disk/hi;;
::hello::hello=n32:)::hello::

have fun!

pack: pastebin get BNHRDtTF pack
unpack: pastebin get n69PkAsD unpack
Edited on 07 April 2015 - 11:26 PM
Creeper9207 #2
Posted 07 April 2015 - 09:55 PM
do not use as of now, bugs and kinks to work out, severe ones
Creeper9207 #3
Posted 08 April 2015 - 01:17 AM
all fixed!
Lignum #4
Posted 08 April 2015 - 01:48 AM
for those who dont know, a dll is a windows system file, with a filesystem in it, like a zip, but files in it are accessed directly, i wanted to make the closest thing to a cc EXE as possible

DLL and EXE files are Win32 executables, they don't contain files. Which makes this a ZIP-like format but without compression.

Anyway, back on topic… It works quite well, however you could work on making the packaged files a little smaller. While this (seemingly) isn't supposed to be a compressor, there is a lot of clutter in the package files that simply doesn't have to be there (e.g. "!end" isn't necessary). Perhaps you could look into using binary files? They usually cut down the file size by quite a bit.
Lupus590 #5
Posted 08 April 2015 - 10:24 AM
binary files and pastebin don't always cooperate, you may not be able to upload the binary file
Creeper9207 #6
Posted 08 April 2015 - 09:44 PM
!end is used to make sure it doesnt keep readLine()ing forever, i know of other ways to stop it, but !end is just easier
also, dll and exes DO contain filesystems
Edited on 08 April 2015 - 07:46 PM
Creeper9207 #7
Posted 08 April 2015 - 09:50 PM
API info: api is almost done! How it will work: it includes two methods and you obtain it by os.loadAPI()ing a packaged file
including two methods:
getFileData(package file, subfile)
setFileData(package file, subfile, data)
Edited on 08 April 2015 - 07:52 PM
Bomb Bloke #8
Posted 08 April 2015 - 10:20 PM
!end is used to make sure it doesnt keep readLine()ing forever, i know of other ways to stop it, but !end is just easier

Might I suggest this sort of structure:

local someFile = fs.open("whatever","r")
for line in someFile.readLine do
  print(line)
end
someFile.close()

Certainly, don't forget to close your input file!
Creeper9207 #9
Posted 09 April 2015 - 12:06 AM
not good with fors

!end is still just easier for me
Bomb Bloke #10
Posted 09 April 2015 - 12:16 PM
Maybe you'd get better at them if you used them? Never too late to learn something new!

For example, I just cottoned on that io.lines() handles opening and closing the file for you:

for line in io.lines("someFile") do
  print(line)
end

How easy's that? :)/>