The early stages of my Computercraft emulator
#1
Posted 30 August 2016 - 01:22 AM
Currently it cannot read keys through the screen, not all APIs are implemented, and it doesn't use the CC font due to a bug (and if you think you know how to fix it, the associated code (and the place i prefer your solution) is here)
It's basically just a lua output window.
Should i put it on GitHub or is it too early yet?
#2
Posted 30 August 2016 - 02:40 AM
This error is produced from the computercraft's own bios.lua.
Making progress!
#3
Posted 30 August 2016 - 08:48 AM
If you want to help, go right there!
#4
Posted 30 August 2016 - 10:15 AM
This error happens at rom/apis/colours Line 3 and is the only error currently blocking progress. It thinks colors is a "userdata" when it's a table. Any help appriciated
EDIT: Also a error at rom/apis/term line 45, but that's due to how native is (NOT) implemented. A fix for that would be appriciated too..
Edited by Admicos, 30 August 2016 - 10:20 AM.
#5
Posted 31 August 2016 - 08:34 AM
#6
Posted 31 August 2016 - 08:36 AM
CrazedProgrammer, on 31 August 2016 - 08:34 AM, said:
I AM actually passing a custom class, why didn't i think of remaking it in Lua. (sighs)
I guess programming without sleep REALLY doesn't work.
EDIT: That actually worked!
Edited by Admicos, 31 August 2016 - 08:47 AM.
#7
Posted 31 August 2016 - 11:41 PM
#8
Posted 01 September 2016 - 05:49 AM
#9
Posted 01 September 2016 - 07:58 AM
EDIT: It might be due to a function that isn't implemented as bios.lua 178 (where the error probably happens) is os.pullEventRaw, which isn't implemented.
EDIT 2: Confirmed, as implementing it will change the error.
EDIT 3: Getting the same error again. os.pullEventRaw is implemented(-ish as the filter currently doesn't work)
EDIT 4: There are a error i couldn't see. Let's see what it is
EDIT 6: It seems like it can't iterate over "native" in the term API. I think i know why though
EDIT 7: Does someone know how to send Python classes in Lua as modifiable, because i think that's the issue (probably not, and it's probably modifiable by default.)
Edited by Admicos, 01 September 2016 - 08:30 AM.
#10
Posted 02 September 2016 - 05:19 AM
In psuedocode (you may not even be using Lua for this directly):
local myCoroutine = coroutine.create(loadfile("bios.lua")) local ok, requestedEvent = coroutine.resume(myCoroutine) while coroutine.status(myCoroutine) ~= "dead" do -- Generate an event, put its parameters into a table called eg "myEvent". -- If you have nothing to generate an event with (eg the user hasn't typed anything, no timers have expired, yadda yadda, -- ... then pause here until you do. if not requestedEvent or requestedEvent == myEvent[1] then ok, requestedEvent = coroutine.resume(myCoroutine, unpack(myEvent)) end end -- End emulation, system has stopped.
Assuming you're already familiar with coroutines, it may still be worth reading chapter four onwards of this. If it doesn't make sense, then you may instead be better off reading the whole thing.
#11
Posted 02 September 2016 - 07:38 AM
Bomb Bloke, on 02 September 2016 - 05:19 AM, said:
In psuedocode (you may not even be using Lua for this directly):
local myCoroutine = coroutine.create(loadfile("bios.lua")) local ok, requestedEvent = coroutine.resume(myCoroutine) while coroutine.status(myCoroutine) ~= "dead" do -- Generate an event, put its parameters into a table called eg "myEvent". -- If you have nothing to generate an event with (eg the user hasn't typed anything, no timers have expired, yadda yadda, -- ... then pause here until you do. if not requestedEvent or requestedEvent == myEvent[1] then ok, requestedEvent = coroutine.resume(myCoroutine, unpack(myEvent)) end end -- End emulation, system has stopped.
Assuming you're already familiar with coroutines, it may still be worth reading chapter four onwards of this. If it doesn't make sense, then you may instead be better off reading the whole thing.
Thanks for the info.
EDIT: If my memory is correct, then this just fixed a error, i think. (there is still one though, i think i have an idea)
Edited by Admicos, 02 September 2016 - 08:03 AM.
#12
Posted 02 September 2016 - 08:26 AM
Now let's tune the fs api a bit and try now.
#13
Posted 02 September 2016 - 09:46 AM
Make a filler RS api and possibly no errors!
EDIT: No errors on the shell, yay! Now let's try events.
EDIT 2: Events are now causing the c-call boundary error, i'm gonna try some more stuff.
EDIT 3: Also, the events don't register either. Let me try a different method.
EDIT 4: Events now register properly, now let't try the cc part.
EDIT 5: I made the events all in Lua, to hopefully be more compatible. But still no CC reaction.
EDIT 6: I just saw that bios.lua implements its own pullEventRaw that is just a coroutine.yield. *facepalming intensifies*
Edited by Admicos, 02 September 2016 - 03:32 PM.
#14
Posted 04 September 2016 - 03:33 PM
I think i just got a modified bios to get the events, but they are all nil, gotta figure this out.
Edited by Admicos, 04 September 2016 - 03:42 PM.
#15
Posted 05 September 2016 - 01:00 AM
You should not resume CC's coroutine if you have no relevant events to pass in, and you should furthermore discard any events which mismatch a set event filter (other than "terminate").
#16
Posted 09 October 2016 - 04:09 AM
#17
Posted 09 October 2016 - 03:20 PM
ashnwill, on 09 October 2016 - 04:09 AM, said:
#18
Posted 20 October 2016 - 11:47 AM
Admicos, on 09 October 2016 - 03:20 PM, said:
Damn, man. It must be a horrible time to live in Turkey, huh? Can you access the Tor project?
#19
Posted 20 October 2016 - 04:36 PM
EldidiStroyrr, on 20 October 2016 - 11:47 AM, said:
Admicos, on 09 October 2016 - 03:20 PM, said:
Damn, man. It must be a horrible time to live in Turkey, huh? Can you access the Tor project?
It's unblocked already and yes i can access Tor.
#20
Posted 21 October 2016 - 07:08 PM
Or does it implement CC?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users