27 January 2015, 14:59 | #1 |
Registered User
Join Date: Aug 2010
Location: Erlangen, Germany
Posts: 24
|
A lua shell for FS-UAE
I really like the scripting interface for FS-UAE with lua, but playing with it was quite hard as you have to edit scripts and relaunch the emulator every time to see what happens (or not)...
What I was missing is a shell where you can interactively enter commands... On my fs-uae-gles/lua branch on github I have added such a shell... Simply compile FS-UAE with --enable-lua and enable the shell with "lua_shell = 1" in your config. Then you can connect via telnet to localhost:6800 and have fun: Code:
telnet localhost 6800 FS-UAE 2.5.27dev Lua 5.2 > Use "quit" to exit the shell. Frode, if you like this feature, I can prepare you a pull request or a patch for inclusion in the main tree... The code was developed on OS X and tested on Linux. Windows may need some minor fixes, I guess. Under the hood I have cleaned up the whole scripting layer: merged states in fs and uae layer and refactored the commands into "fsemu", "fsuae", "uae" lua libraries... The nice bonus feature of the shell is that we now have a mechanism to change floppy and cd images while the emulator is running... E.g. the launcher can attach the emulator after start up and then change images by sending lua commands... Code:
fsuae.floppy_set_file(0,"/path/to/my.adf") Currently, I am playing around with the commands to see what actually works (the shell changes the emulator state while its running...) and what to avoid doing Last edited by lallafa; 05 February 2015 at 11:47. Reason: corrections applied as reported by jbl007 |
28 January 2015, 20:23 | #2 |
Registered User
Join Date: Mar 2013
Location: Leipzig/Germany
Posts: 468
|
I like the idea.
But I get connection refused from telnet. As far as I can see it does not listen on port 6800. (netstat -npl) Code:
$ amiga --log | grep -i lua lua_shell = true lua-fs: init lua-fs: registered function 'log' fs_emu_theme_init_lua fs_emu_render_init_lua lua-fs: registered function 'set_scale' lua-fs: registered function 'set_frame_position_and_size' lua-fs: registered function 'load_shader' lua-fs: registered function 'set_shader' lua-fs: not bound: postpone handler 'on_fs_emu_init_video' lua-fs: not bound: postpone handler 'on_fs_emu_render_frame' lua: init lua-fs: bound to emu lua-fs: calling postponed handler 'on_fs_emu_init_video' lua-fs: calling postponed handler 'on_fs_emu_render_frame' lua-shell: disabled lua: free lua-shell: stopping... lua-fs: unbound from emu lua-fs: not bound: postpone handler 'on_fs_emu_render_frame' |
29 January 2015, 16:42 | #3 |
Registered User
Join Date: Aug 2010
Location: Erlangen, Germany
Posts: 24
|
Ah.. my fault: The correct way to set the option is:
Code:
lua_shell = 1 |
29 January 2015, 20:32 | #4 |
Registered User
Join Date: Mar 2013
Location: Leipzig/Germany
Posts: 468
|
Ok, it works!
Before someone else runs into trouble: It's not fsuae.set_floppy_file(), it's fsuae.floppy_set_file() Which commands do work? Is it possible for example to change the volume or toggle the LED (filter). |
16 March 2015, 19:26 | #5 |
Registered User
Join Date: Aug 2010
Location: Erlangen, Germany
Posts: 24
|
Some updates here:
I moved the source of the lua shell to a new repo: https://github.com/cnvogelg/fs-uae/tree/lua This repo is a direct fork of Frode's repo and will simplify a later pull request. The branch now compiles and works on OS X, Linux, and Windows. Currently, my main focus is on making drive image handling work from external tools. I have written a small python library to access the lua shell from own tools. Also a small command line utility in tools/fs-uae-ctl was added: Code:
fs-uae-ctl df0 image.adf # insert a disk image into df0 fs-uae-ctl df1 eject # eject disk in df1 fs-uae-ctl df2 # show current image in df2 fs-uae-ctl cd0 my.iso # insert CDROM image fs-uae-ctl cd1 eject fs-uae-ctl cd2 |
19 March 2015, 21:37 | #6 |
Registered User
Join Date: Aug 2010
Location: Erlangen, Germany
Posts: 24
|
Here we go: fs-uae-ctl-ui (also located in tools)
This little UI lets you change floppy disk and CDROM images with a few mouse clicks while running FS-UAE... Have Fun! |
22 March 2015, 00:22 | #7 |
Registered User
Join Date: Mar 2013
Location: Leipzig/Germany
Posts: 468
|
Nice, thanks for this!
I didn't like a separate window for changing floppy disks, so i made something else based on you lib: https://github.com/sonnenscheinchen/...ster/fs-uae.py It is some kind of wrapper for the (linux-) fs-uae executable with the ability to change floppies from the systray. The main problem is still: If you quit the emulator without closing the connection there is (obviously) no way to disconnect and you get "connection refused" if you restart in a short period of time. |
22 March 2015, 19:04 | #8 |
Registered User
Join Date: Aug 2010
Location: Erlangen, Germany
Posts: 24
|
Nice work, too! I like the idea with the systray
I just added the socket option SO_REUSEADDR. That should allow binding the socket even if the emulator restarts quickly. |
22 March 2015, 20:19 | #9 | |
Registered User
Join Date: Mar 2013
Location: Leipzig/Germany
Posts: 468
|
New version features dynamic menus: You can change floppies in fs-uae (F12) as well and the menus will notice.
Quote:
|
|
13 August 2020, 20:57 | #10 |
Registered User
Join Date: Aug 2020
Location: Ottawa
Posts: 57
|
is there a way to build the tool for disk swapping in the current version of FS-UAE?
|
14 August 2020, 20:35 | #11 | |
Registered User
Join Date: Mar 2013
Location: Leipzig/Germany
Posts: 468
|
Quote:
Code:
telnet localhost 6800 Trying ::1... Connection failed: Verbindungsaufbau abgelehnt Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. FS-UAE 3.0.4 Lua 5.2 > =1+1 2 > ="it works" it works > |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Clear background color for Shell window- Shell-StartUp | fc.studio | support.Apps | 13 | 25 March 2022 18:52 |
Lua interpreter with arbitrary precision math. | Thorham | Coders. Releases | 19 | 06 January 2020 23:13 |
Shell help? | madman | support.Apps | 5 | 24 June 2011 22:32 |
AmigaDOS web shell | copse | Coders. General | 1 | 21 December 2009 02:04 |
Shell Replacement | amiga | request.UAE Wishlist | 6 | 22 January 2009 19:44 |
|
|