Giter Club home page Giter Club logo

ocemu's Introduction

OCEmu - OpenComputers Emulator

Installation

Needs lua-5.2, luafilesystem, luautf8, luaffi, and SDL2.
luasocket is optional but is required for the Internet Component and higher precision timing.
luasec is optional but is required for HTTPS.

This git repository contains submodules, please clone using git clone --recursive https://github.com/zenith391/OCEmu.git

Windows

Binaries: Windows 64bit

The binaries above have everything pre compiled and packed up for ease of use.

If you'd like to compile OCEmu yourself for Windows, the provided script msys2_setup_ocemu.sh will automated the compiling process for Windows, run it inside of the MSYS2 environment.
Ignore the Lua Libraries step as it doesn't work on Windows and the script does this for you.

Ubuntu

apt-get install lua5.2 liblua5.2-dev libsdl2-dev subversion

Lua 5.2:
Install a versioned luarocks for 5.2 as described in: http://stackoverflow.com/a/20359102

# Download and unpack the latest luarocks from: http://luarocks.org/releases
./configure --lua-version=5.2 --lua-suffix=5.2 --versioned-rocks-dir
make build
sudo make install

Lua 5.3: The same as above but with Lua 5.3:

# Download and unpack the latest luarocks from: http://luarocks.org/releases
./configure --lua-version=5.3 --lua-suffix=5.3 --versioned-rocks-dir
make build
sudo make install

Follow the luarocks step below.

Arch Linux

Here you can directly grab ocemu-zenith and its dependencies from the AUR (thanks to AtomicScience).

If you use yay, here is the command:

yay -S ocemu-zenith

Manual Build Grab the Lua 5.2, luarocks, lua52-filesystem, lua52-sec & lua52-socket from the official repos using Pacman.

pacman -S lua52 luarocks lua52-filesystem lua52-sec lua52-socket

Then install the luarocks requirements

luarocks --lua-version 5.2 install luafilesystem
luarocks --lua-version 5.2 install luautf8
luarocks --lua-version 5.2 install luasocket
luarocks --lua-version 5.2 install luasec
cd luaffifb
luarocks --lua-version 5.2 make

# OpenComputer's lua source code is not provided, if you have svn then use the provided Makefile
# If you hate svn, manually download assets/loot, assets/lua, and assets/font.hex into src/

Mac

Mac users can get up and running quickly by using brew.

Brew installs luarocks as part of the lua package.

# Run this before the luarocks install steps below
brew install lua
brew install sdl2

Follow the luarocks steps below.

Lua Libraries

luarocks-5.2 install luafilesystem
luarocks-5.2 install luautf8
luarocks-5.2 install luasocket
luarocks-5.2 install luasec
cd luaffifb
luarocks-5.2 make

# OpenComputer's lua source code is not provided, if you have svn then use the provided Makefile
# If you hate svn, manually download assets/loot, assets/lua, and assets/font.hex into src/

For Lua 5.3 support, replace 5.2 by 5.3 in the commands.

Running

Launch boot.lua with lua5.2, and provided everything is installed, you'll have a working Emulator.
OCEmu stores its files in the following locations:

OS Location
Windows %APPDATA%\\OCEmu
Linux $XDG_CONFIG_HOME/ocemu or $HOME/.config/ocemu
cd src
lua boot.lua

If you want to use a custom path (for example, for running multiple machines with unique filesystems) you can specify the machine path as an argument to boot.lua:

cd src
lua boot.lua /path/to/my/emulated/machine_a

ocemu's People

Contributors

atomicscience avatar dyonovan avatar fixator10 avatar gamax92 avatar lizzytrickster avatar mcjack123 avatar mckuhei avatar misiuji avatar ocawesome101 avatar payonel avatar zenith391 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocemu's Issues

Can't find ocemu.cfg

I use Manjaro, I did all the installation procedures, but at the time run lua boot.lua, he sends an error saying he did not find the file ocemu.cfg:

image

How fix this?

Freeze when download

Yep, another.
When I download a file with OCEmu (using wget), it freeze.
Can you regulate the internet - display flow pls

Wget.lua - Add dlls to compilator

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

Link is not working

Hey guys, the link to Windows bootable distribution is not working anymore, can you fix it?

gpu.setActiveBuffer crashes OCEmu

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

How do i add a data card?

I need a data card for my program but there's no datacard component in my emulator, how do i add one?

OCemu.cfg cant find

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

Normal component calls can cause 'too long without yielding' error

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.

Screen updates only occur on yield

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.

ocemu.cfg: No such file or directory

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

after compiling on windows sound is really noisy

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

Gpu/Screen Settings?

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.

Add an AUR package to README

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

Error finding config on win10

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

Debugger not working

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 ?

broken gpu.copy (ULOS)

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.

gpu.bitblt extremely slow

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.

OCEmu crashes during reading TCP socket

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 :(

Flatpak

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

Lua 5.3 on Windows

How do you use Lua 5.3 on the precompiled windows? i didn't see anything in the config file.

shutdown weirdness

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.

Incorrect AUR package download command

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

sanitize logs

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.

broken palette colors (ULOS)

Apparently I like breaking things. I've found palette-related bugs in both OCEmu and OCVM while testing ULOS.

On the right is OCVM, displaying the correct colors; on the left is OCEmu, demonstrating its incorrectness.
Screenshot_20210918_213407Screenshot_20210918_214151

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.