Jump to content




The early stages of my Computercraft emulator


28 replies to this topic

#21 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 21 October 2016 - 08:28 PM

View PostPiorjade, on 21 October 2016 - 07:08 PM, said:

Will we be able to use custom CC versions with this?
Or does it implement CC?
It "implements" cc, so nothing to do with the original jar other than the bios files, but it's still incomplete (just the events missing, but i'll try to fix it later)

#22 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 22 March 2017 - 12:14 PM



So, i got events working to the point where you can type into the shell, but they are still buggy and most events do not exist.
And due to LWJGL and Pygame having different key codes, most non-letter keys do not work. If they worked, the cc shell would probably run without problems though.

EDIT: So, i made the events work faster by making the event queue return the last item instead of the first item. But i still need to implement proper key mapping and the rest of the events

Edited by Admicos, 22 March 2017 - 07:32 PM.


#23 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 23 March 2017 - 06:57 PM

The current state of the emulator:


Considering the emulator couldn't even handle keypresses yesterday, this is some good progress right here!

Edited by Admicos, 23 March 2017 - 06:58 PM.


#24 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 18 May 2017 - 07:33 AM

Pretty late update: I changed the renderer from using TTF fonts to using CC's term_font.png file. So the current rendering is pretty accurate i'd say.

Posted Image

Now I need to do key combinations, but I think that will need seperate files for each keyboard layout unless I can find a way to do it easier.

#25 MineRobber___T

  • Members
  • 50 posts
  • LocationStop being nosy

Posted 26 May 2017 - 01:13 AM

View PostAdmicos, on 18 May 2017 - 07:33 AM, said:

Pretty late update: I changed the renderer from using TTF fonts to using CC's term_font.png file. So the current rendering is pretty accurate i'd say.

Posted Image

Now I need to do key combinations, but I think that will need seperate files for each keyboard layout unless I can find a way to do it easier.

If I'm not mistaken, you just need to keep track of keydown and keyup events. on a keydown event where a status key (shift,ctrl,alt,etc.) is pressed, set a corresponding bool and when they are released, set the bool to false. If I knew where input was being handled, I could probably submit a PR to do this myself.

EDIT: using a test program, I found the key events for modifier keys:

Control key = 29
Alt key = 56
Shift key = 42

if you queue said events, programs should run without a hitch.

Edited by MineRobber___T, 26 May 2017 - 01:23 AM.


#26 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 08 June 2018 - 05:17 AM

So, after almost a year of not doing anything with this, I decided to rewrite it. I managed to get this up to about the same level of functionality in about 4 days using some copy-paste and generally knowing how to handle stuff properly. Now the code is MUCH cleaner and it also has some tests too. (No idea how to test anything internal, so I just tested the APIs exposed to CC, except FS because I know that's broken. Gotta fix that someday)

Also, HTTP support:
Posted Image

The new code is over at https://gitlab.com/admicos/ccpy if anyone's interested.

#27 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 09 June 2018 - 08:40 PM

I managed to split the emulator's display and event handling to different "Drivers". This makes cleaner code and has the possibility to allow fun stuff like running the emulator totally headless, displaying on a CLI or simply using a different renderer if pygame doesn't work for some reason.

#28 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 13 June 2018 - 03:43 AM

I re-wrote the path sanitizer, so most fs bugs should (I hope) be fixed. I also added tests to the fs API so the emulator's at 90% coverage now. (Doesn't mean much but I like seeing nice numbers)

The emulator should be pretty usable (assuming there aren't any other bugs or other stuff I might've missed) when I fix the key handling.

#29 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 14 June 2018 - 07:03 PM

Finally! Key events are fixed and should work pretty well!

Now that that's out of the way, I might actually consider using this for anything other than testing if it works or not.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users