zenith391 / ocemu Goto Github PK
View Code? Open in Web Editor NEWThis project forked from blueamulet/ocemu
OpenComputers Emulator in Lua
This project forked from blueamulet/ocemu
OpenComputers Emulator in Lua
I've created a Flatpak for OCEmu. If you don't know, what a Flatpak is, think of it as Docker, but for Linux Desktop Programs. That means, any Linux User can install OCEmu without needing to deal with luarocks. It can also be uploaded to Flathub.
Here are the needed files. Put they in the same directory with the given name.
io.github.zenith391.OCEmu.yaml
id: io.github.zenith391.OCEmu
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: ocemu
finish-args:
- --socket=fallback-x11
- --socket=wayland
- --device=all
- --share=ipc
- --share=network
- --socket=pulseaudio
modules:
- shared-modules/lua5.3/lua-5.3.5.json
- name: luarocks
buildsystem: autotools
sources:
- type: git
url: https://github.com/luarocks/luarocks.git
tag: v3.9.2
commit: b5a1b7de2ab8a0d3eb2c517af1de6f73e48fbe23
cleanup:
- /bin
- /etc
- luarocks-packages.yaml
- name: ocemu
buildsystem: simple
build-commands:
- cd luaffifb && luarocks make
- mkdir .p $FLATPAK_DEST/ocemu
- cp -r ./src/* $FLATPAK_DEST/ocemu
- cp -r OpenComputers/src/main/resources/assets/opencomputers/lua $FLATPAK_DEST/ocemu
- cp -r OpenComputers/src/main/resources/assets/opencomputers/loot $FLATPAK_DEST/ocemu
- cp OpenComputers/src/main/resources/assets/opencomputers/font.hex $FLATPAK_DEST/ocemu
- cp $FLATPAK_DEST/bin/lua $FLATPAK_DEST/bin/lua5.3
- install -Dm755 ocemu.sh $FLATPAK_DEST/bin/ocemu
- install -Dm644 icon.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/$FLATPAK_ID.png
- desktop-file-edit --set-icon=$FLATPAK_ID --remove-key Path --set-comment "OpenComputers Emulator in Lua" --set-key Exec --set-value ocemu OCEmu.desktop
- install -Dm644 OCEmu.desktop $FLATPAK_DEST/share/applications/$FLATPAK_ID.desktop
sources:
- type: git
url: https://github.com/zenith391/OCEmu.git
commit: 0dd3789abd567881f25d72cb5ebc2b2a2560f4f3
- type: git
url: https://github.com/MightyPirates/OpenComputers.git
tag: 1.12.2-forge/1.8.2
commit: b4abbf991c20a2e66ee54089bf080d8e7e46f426
dest: OpenComputers
- type: script
dest-filename: ocemu.sh
commands:
- cd /app/ocemu
- exec lua5.3 ./boot.lua
luarocks-packages.yaml
build-commands: []
buildsystem: simple
modules:
- build-commands:
- luarocks build --tree $FLATPAK_DEST luafilesystem-1.8.0-1.src.rock
buildsystem: simple
name: luarocks-package-luafilesystem
sources:
- sha256: 576270a55752894254c2cba0d49d73595d37ec4ea8a75e557fdae7aff80e19cf
type: file
url: https://luarocks.org/luafilesystem-1.8.0-1.src.rock
- build-commands:
- luarocks build --tree $FLATPAK_DEST luautf8-0.1.5-2.src.rock
buildsystem: simple
name: luarocks-package-luautf8
sources:
- sha256: 68bd8e3c3e20f98fceb9e20d5a7a50168202c22eb45b87eff3247a0608f465ae
type: file
url: https://luarocks.org/luautf8-0.1.5-2.src.rock
- build-commands:
- luarocks build --tree $FLATPAK_DEST luasocket-3.1.0-1.src.rock
buildsystem: simple
name: luarocks-package-luasocket
sources:
- sha256: f4a207f50a3f99ad65def8e29c54ac9aac668b216476f7fae3fae92413398ed2
type: file
url: https://luarocks.org/luasocket-3.1.0-1.src.rock
- build-commands:
- luarocks build --tree $FLATPAK_DEST luasec-1.3.1-1.src.rock
buildsystem: simple
name: luarocks-package-luasec
sources:
- sha256: 234353b695cdec264b22e6ff5472f4f7f70cd10a9b65f6fd4ad65652c786bb20
type: file
url: https://luarocks.org/luasec-1.3.1-1.src.rock
name: luarocks-packages
You also need to clone the shared-modules repo.
Here are instructions how to build
Tell me, if you're intrested
I'd like to launch multiple instances of OCEmu, each with different UUIDs for components and separate filesystems, able to communicate via component.modem
. Is this achieveable in the current state of OCEmu?
I'm trying to download a file from github using wget (wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/BIOS.lua /tmp/bios.lua
) but wget say Connection refused
I tried to allow the emulator on my firewall, but still the same error
What can I do ?
Edit: pastebin works normally
After I have choosen a language and target disk to install, OCEmu became not responding and after ~~30 seconds of respondless then OCEmu closes.
OS: Windows 10.
OCEmu and MineOS versions: latest.
@kerbeeb
on discord brought up this issue. I can reproduce it in my Windows VM by trying to retrieve any https URL.
Can we use a custom resolution ?
If not, pls add it
after installing dependencies on windows audio is really noisy. no matter if lunched with lua or the .exe the emulator produces a high pitch noise
l'll try installing dependencies with luarocks and if that doesn't work I'll check the process of sound production and try to fix it
How do you use Lua 5.3 on the precompiled windows? i didn't see anything in the config file.
Is there an ability to change the tier of the GPU / screen in the emulator, I'm trying to run mineos but the resolution is too low on the emulated screen.
In an attempt to debug the previous three issues I opened, I turned on OCEmu's debug
option. Come to find out, it evidently doesn't sanitize its log output, meaning I can send VT100 escapes through it and they take effect, and because ULOS uses \27[8m
in a few places, log output is completely hidden after the first occurrence of this.
Not a particularly critical bug (and could actually enable some interesting functionality) but would be nice to have fixed. A simple message:gsub("[\0-\30]", function(c) return string.format("\\%d", c:byte()) end)
somewhere in the logging code would probably suffice.
I've made an AUR package for this OCEmu fork : ocemu-zenith
Seems to work just fine, installing all the dependencies automatically and adding a command to run the boot.lua
Calling a normal component function (see the docs under 'Direct Calls') should yield for a tick, yet they don't.
This means that when repeatedly calling a normal component function and not yielding via computer.pullsignal
results in the program crashing with a too long without yielding
error.
Something in ULOS's (admittedly complex) shutdown mechanisms distinctly does not like OCEmu. When I run poweroff
or reboot
, precisely nothing happens most of the time - though I do get a [ WAIT ] Stopping services
message the first time I run it. In both OCVM and OpenComputers, this works fine. I suspect it's got something to do with the fact that ULOS' shutdown routine calls coroutine.yield
/ computer.pullSignal
in muptiple places.
Hey guys, the link to Windows bootable distribution is not working anymore, can you fix it?
I need a data card for my program but there's no datacard component in my emulator, how do i add one?
I just noticed that, in OCEmu, the bitblt operation is actually very slow and CPU intensive. I had a quick look at the code, but couldn't really figure out why this is.
I made a simple test script:
local component = require("component")
local gpu = component.gpu
local event = require("event")
local buffer = gpu.allocateBuffer()
gpu.setActiveBuffer(buffer)
local i = 1
while event.pull("key_down") do
gpu.set(1, 1, tostring(i))
gpu.bitblt()
i = i + 1
end
Running this in OCEmu and typing keys will cause noticeable delay between key presses and the number counting up. In fact, it sometimes keeps going for multiple seconds after I stopped typing - depending on how much I typed.
In contrast, in-game this is almost instant with no noticeable delay whatsoever.
This is definitely related to the size of the buffer. If I do the same, but with the buffer height set to 1, it is MUCH faster.
I normally use a screen 100x as big as the normal T3 screen (800x250), but even with the 80x25 screen the emulator is much slower than the game.
If you want a less contrived example, I discovered this while working on my vim clone: https://github.com/Xandaros/yaocvim
Without setting gpu.bitblt
to none (emulating an older OC version), it is basically unusable in the emulator. In game, on the other hand, using bitblt improves performance drastically.
This is not a particularly important issue for me, since I can just turn off the bitblt functionality while developing, but I thought I'd at least make a ticket so you are aware.
I used the version from AUR in combination with Lua 5.3(I edited the /usr/bin/ocemu
for this).
$ ocemu --basedir=/home/atirut/Projects/ocemu-machine --debugger
false apis/debugger.lua:189: attempt to index a nil value (field '?')
stack traceback:
apis/debugger.lua:189: in upvalue 'drawTabs'
apis/debugger.lua:195: in upvalue 'drawUI'
apis/debugger.lua:199: in field '?'
boot.lua:315: in function <boot.lua:77>
[C]: in function 'xpcall'
boot.lua:327: in main chunk
[C]: in ?
Yep, another.
When I download a file with OCEmu (using wget), it freeze.
Can you regulate the internet - display flow pls
on the latest branch, building from given instructions (Aur package depreciated) i cant find the ocemu.cfg file, i even searched my entire disk, do i need to run a command to create it? Im on Arch Linux btw
Hello. My OCEmu (latest version) crashes every time when I'm trying to call connection.read()
.
Example code:
local internet = require("internet")
local connection = internet.open("habr.com", 80)
connection.write("GET / HTTP/1.1\r\nHost: www.habr.com\r\n\r\n")
*Little time has passed*
local response = connection.read() -- *OCEmu window close after ~~3 seconds*
Why? And how to fix it? Pls :(
While installing all of the packages luarocks 5.2 wasn't found by pacman, I am using arch Linux btw
bool.lua fails on run:
$ lua boot.lua ~/.ocemu/machines/TestMachine/
Warning: Using legacy path of '~/.ocemu'
Please move this to '~/.local/share/ocemu'
Problem opening configuration, using default: ~/.ocemu/ocemu.cfg: No such file or directory
false ./main.lua:409: attempt to index a nil value (global 'bit32')
stack traceback:
./main.lua:409: in main chunk
[C]: in function 'require'
boot.lua:277: in function <boot.lua:77>
[C]: in function 'xpcall'
boot.lua:327: in main chunk
[C]: in ?
$ lua -v
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
You better do it! Right here! Right now!
Hello, i build the emulator and run it (
cd src
lua boot.lua
)
but i getting this error: Problem opening configuration, using default: C:\Users\Robin\AppData\Roaming\OCEmu/ocemu.cfg: No such file or directory
I have win10 with mingw64 shell runing. The openos window opens. but i getting this error
Wanting to try out the new and shine VRAM buffers, I quickly discovered that trying to use them will crash OCEmu.
I tried using this script:
local component = require("component")
local gpu = component.gpu
local buffer = gpu.allocateBuffer()
gpu.setActiveBuffer(buffer)
gpu.freeBuffer()
And running it will immediately close OCEmu with this output:
false bad arguments #1 (number expected, got nil)
stack traceback:
[C]: in function 'error'
./main.lua:526: in function 'resume_thread'
./main.lua:568: in function '?'
boot.lua:310: in function <boot.lua:77>
[C]: in function 'xpcall'
boot.lua:327: in main chunk
[C]: in ?
Trying the same script in-game does exactly what I expected - nothing. :D
Hi there, is there any way i can make the character size smaller so i can use the full gpu resolution without the screen size exceeding my actual screen's size? I have some programs that require max res.
This isn't a huge issue, mostly quality-of-life, but I'd really like it for accuracy's sake if OCEmu updated the screen as soon as the gpu
call is made, rather than waiting until the next yield. Having things like installers be completely silent until they're done in OCEmu, while still being fairly responsive in-game and in OCVM is rather disconcerting.
This could be as simple as a yield(0)
on every gpu
call, though it's not an optimal solution.
pacman -S ocemu-zenith
This command of yours is wrong since pacman
only works with official repositories, and my package is on AUR, meaning that the following command should be provided instead:
yay -S ocemu-zenith
And since not everyone has a yay
, because it's a kind of an optional program, providing them with a link to the AUR package page is also a good idea
I cant download as the nightly link has expired
ULOS's terminal does not scroll when pressing [return]
on the command line, when it should. This might seem at first glance like a ULOS bug, but it works in both OCVM and bog-standard OpenComputers.
To reproduce:
Boot ULOS (https://github.com/ocawesome101/oc-ulos) in OCEmu and continually press [Return]
until you would expect the screen to begin scrolling. It does not scroll.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.