-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathccpost.bbcode
182 lines (155 loc) · 5.3 KB
/
ccpost.bbcode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
[center]
[size=6][b]Termu[/b][/size]
[b]A ComputerCraft Emulator for the Terminal[/b]
[img]https://s19.postimg.org/9ozmwm2bn/2016_08_01_23_12_52.png[/img]
This is a simple emulator written in Lua.
It definitely doesn't have perfect emulation (e.g. LuaJ string bug, error checking).
But it's pretty lightweight, supports very old versions of CC and with a couple small tweaks to the ROM can be automated (just in case you want to do that).
It's only been tested on Linux, but it should work on OS X and you might be able to get it to work on Windows (using MinGW or Cygwin or something).
[b]Github[/b]: [url=https://github.com/CoderPuppy/cc-emu]CoderPuppy/cc-emu[/url]
[b]License[/b]: MIT
[size=5][b]Recomended Installation[/b][/size]
[spoiler]
First install the dependencies:
Arch Linux:
[code]
pacman -S lua unibilium nanomsg
# install termcap from the AUR
[/code]
Ubuntu (and most other Debian-based distros):
[code]
apt-get install lua5.2 libncurses5-dev libunibilium0 libnanomsg0 libnanomsg-dev
[/code]
Install [url=https://luarocks.org]LuaRocks[/url]:
[url=https://github.com/keplerproject/luarocks/wiki/Download]Instructions[/url]
Either clone the repository or download and unpack the [url=https://github.com/CoderPuppy/cc-emu/archive/master.zip]zip[/url]
Either clone [url=https://github.com/alekso56/ComputercraftLua]alekso56/ComputercraftLua[/url] or download and unpack the [url=https://github.com/alekso56/ComputercraftLua/archive/master.zip]zip[/url] so that you have a directory structure that looks like:
[code]
.
├── cc
│ ├── bios.lua
│ ├── README.md
│ ├── rom
│ └── treasure
├── ccpost.bbcode
├── cli.lua
├── emu.lua
├── keyboard-test.lua
├── LICENSE.txt
└── README.md
[/code]
In a terminal run:
[code]
luarocks install penlight
luarocks install luv
luarocks install terminfo
luarocks install luaposix
luarocks install nn
luarocks install utf8
[/code]
To start the emulator, run in a terminal in the directory the contains [i]cli.lua[/i]:
[code]
lua cli.lua . # replace with where you want the computer's root directory to be
[/code]
In the emulator Ctrl-Shift-tilde is mapped to left control (since that can't be captured on it's own).
[/spoiler]
[center][size=5][b]Configuration[/b][/size]
[spoiler]
[b]Peripherals[/b]
[spoiler]
Create a tree like this (replacing [id] with the id or side that the peripheral should be on):
[code]
.
└── .termu/
└── peripherals/
└── [id]/
└── type
[/code]
[b]Currently supported types:[/b]
[spoiler]
[b]Nanomsg Modem[/b]
[spoiler]
Put "nanomsg-modem" in the type file.
You'll need to run a server (for the addresses look at these: [url=http://nanomsg.org/v0.8/nn_ipc.7.html]ipc[/url], [url=http://nanomsg.org/v0.8/nn_tcp.7.html]tcp[/url]):
[code]
lua nanomsg-server.lua [publish address] [input address]
[/code]
Create a tree like this:
[code]
.
└── .termu/
└── peripherals/
└── [id]/
├── send_addr
├── sub_addr
└── type
[/code]
In the sub_addr and send_addr files put addresses to connect to the server (sub_addr to publish address and send_addr to input address).
Also you can run multiple server and have multiple modems connected to the same computer.
And this whole section probably needs to be rewritten (if I suddenly get better at writing or someone else wants to help).
[/spoiler]
[b]CUPS Printer[/b]
[spoiler]
Put "cups-printer" in the type file.
You'll need [url=https://www.gnu.org/software/a2ps/]a2ps[/url] installed and [url=https://www.cups.org/]CUPS[/url] installed and setup (with a printer)
It should work straight away.
It's possible to customize it with the following files:
[list]
[*] cmd (default: "a2ps --columns=1 -l $$width$$ -L $$height$$ --center-title=$$title$$ 2>/dev/null | lpr >/dev/null 2>/dev/null")
[*] width (default: 25)
[*] height (default: 21)
[/list]
[/spoiler]
[/spoiler]
[/spoiler]
[b]Colors[/b]
[spoiler]
Create a tree like this:
[code]
.
└── .termu/
└── term-colors/
└── [fg/bg]/
└── [color]
[/code]
in each of the files put the escape sequence you want Termu to output to switch to the color
for example if you want CC's light blue color (in a terminal that supports truecolor):
[code]
echo -e '\e[38;2;153;178;242m' > .termu/term-colors/fg/lightBlue
echo -e '\e[48;2;153;178;242m' > .termu/term-colors/bg/lightBlue
[/code]
[/spoiler]
[b]Font[/b]
[spoiler]
You need:
[list]
[*] [url=https://fontforge.github.io/]Fontforge[/url] (fontforge on Arch Linux)
[*] [url=https://www.python.org/]Python 3[/url]
[*] Python Imaging Library (I used Pillow and pil-compat)
[*] svgwrite
[*] [url=http://www.imagemagick.org/]Imagemagick[/url] (imagemagick on Arch Linux)
[/list]
Grab assets/computercraft/textures/gui/termFont.png from a CC jar and put it in fonts
Then in fonts run:
[code]
./build.sh
[/code]
That should generate a termu.otf file in fonts.
To use create a tree like this:
[code]
.
└── .termu/
└── term-munging
[/code]
[/spoiler]
[/spoiler]
[/center]
[center][size=5][b]Plans / To Do[/b][/size][/center]
[spoiler]
[list]
[*] Better filesystem (support for more mounts, etc..)
[*] Better compatibility (error checking, etc..)
[*] Disks
[/list]
[/spoiler]
[/center]