|
| 1 | +# FujiNet-PC scripts |
| 2 | + |
| 3 | +The scripts package contains Launcher GUI and NetSIO hub Python modules and NetSIO custom device for Altirra. It does not contain any binaries. To run scripts Python 3 with necessary libraries must be installed on the system and FujiNet-PC binaries ([downloaded](https://github.com/FujiNetWIFI/fujinet-pc/releases) or [built](https://github.com/FujiNetWIFI/fujinet-pc#build-instructions)) have to be placed into `fujinet-pc` directory. |
| 4 | + |
| 5 | +## Linux, macOS, Window |
| 6 | + |
| 7 | +### Download and extract the files |
| 8 | + |
| 9 | +[Download](https://github.com/a8jan/fujinet-pc-launcher/releases/latest) the **scripts** package and extract the files. |
| 10 | + |
| 11 | +There are four subdirectories inside: |
| 12 | + |
| 13 | +* `emulator` contains custom device for Altirra |
| 14 | +* `fujinet-pc` is placeholder for FujiNet-PC binary |
| 15 | +* `launcher` is Python module containing FujiNet-PC Launcher |
| 16 | +* `netsiohub` is Python module containing NetSIO hub |
| 17 | + |
| 18 | +### Python |
| 19 | + |
| 20 | +Python 3 is required to run Launcher and NetSIO hub. |
| 21 | + |
| 22 | +Check if Python version 3.x is installed: |
| 23 | + |
| 24 | +```sh |
| 25 | +$ python -V |
| 26 | +Python 3.10.4 |
| 27 | +``` |
| 28 | + |
| 29 | +if command is not found or version 2.x.y is reported by `python` command try to use `python3` command instead: |
| 30 | + |
| 31 | +```sh |
| 32 | +$ python3 -V |
| 33 | +Python 3.10.4 |
| 34 | +``` |
| 35 | + |
| 36 | +On Ubuntu it is possible to enable Python 3 via `python` command by installing `python-is-python3` package: |
| 37 | +```sh |
| 38 | +$ sudo apt install python-is-python3 |
| 39 | +``` |
| 40 | + |
| 41 | +Linux distros are likely shipped with some version of Python installed by default or at least available as ready to install package. For other systems if Python 3 is not installed yet it can be downloaded and installed from [https://www.python.org/](https://www.python.org/). |
| 42 | + |
| 43 | +For recent Windows versions Python is available from Microsoft Store. Version 3.9 or 3.10 should work fine. It can be also installed using `winget`: |
| 44 | + |
| 45 | +```sh |
| 46 | +$ winget install -i Python.Python.3.9 |
| 47 | +``` |
| 48 | + |
| 49 | +Similar on macOS, if using package manager, e.g. homebrew, Python can be installed with it: |
| 50 | + |
| 51 | +```sh |
| 52 | +$ brew install python3 |
| 53 | +``` |
| 54 | + |
| 55 | +### NetSIO hub |
| 56 | + |
| 57 | +Skip this step if you plan to use Launcher. |
| 58 | + |
| 59 | +If not interested into Launcher GUI the NetSIO hub can be started manually. Enter the scripts directory - the one with `emulator`, `fujinet-pc`, `launcher` and `netsiohub` subdirectories (DO NOT enter `netsiohub` subdirectory). |
| 60 | + |
| 61 | +Start NetSIO hub: |
| 62 | + |
| 63 | +```sh |
| 64 | +$ python -m netsiohub # or python3 -m netsiohub |
| 65 | +``` |
| 66 | + |
| 67 | +NetSIO hub command line options: |
| 68 | + |
| 69 | +``` |
| 70 | +usage: netsiohub [-h] [--netsio-port NETSIO_PORT] [-d] [--port PORT] [-v] |
| 71 | +
|
| 72 | +Connects NetSIO protocol (SIO over UDP) talking peripherals with NetSIO Altirra custom device (localhost TCP). |
| 73 | +
|
| 74 | +options: |
| 75 | + -h, --help show this help message and exit |
| 76 | + --netsio-port NETSIO_PORT |
| 77 | + Change UDP port used by NetSIO peripherals (default 9997) |
| 78 | + -d, --debug Print debug output |
| 79 | + --port PORT Change TCP port used by Altirra NetSIO custom device (default 9996) |
| 80 | + -v, --verbose Log emulation device commands |
| 81 | +``` |
| 82 | + |
| 83 | +### FujiNet-PC |
| 84 | + |
| 85 | +To allow the Launcher to control (start/stop and monitor) FujiNet-PC program the directory `fujinet-pc` must be populated with FujiNet-PC. Copy here the content of `build/dist` if it was built manually. Pre-build binaries for selected systems can be [downloaded](https://github.com/FujiNetWIFI/fujinet-pc/releases/latest) and files extracted here. |
| 86 | + |
| 87 | +The content of `fujinet-pc` directory should look like this: |
| 88 | + |
| 89 | +```sh |
| 90 | +% ls -l fujinet-pc |
| 91 | +drwx------ 3 a8jan staff 96 Aug 24 12:26 SD |
| 92 | +drwx------ 11 a8jan staff 352 Aug 24 12:26 data |
| 93 | +-rwx------ 1 a8jan staff 535 Aug 24 12:26 fnconfig.ini |
| 94 | +-rwx------ 1 a8jan staff 6189712 Aug 24 12:26 fujinet |
| 95 | +-rwx------ 1 a8jan staff 284 Aug 24 12:26 run-fujinet |
| 96 | +``` |
| 97 | +On Windows there will be additional DLL files together with `fujinet.exe` |
| 98 | + |
| 99 | +If you do not plan to use Launcher to start/stop FujiNet-PC the FujiNet-PC can be started manually. Enter `fujinet-pc` directory and start FujiNet-PC with `./run-fujinet` on Linux and Mac, use `run-fujinet.bat` on Windows. |
| 100 | + |
| 101 | +FujiNet-PC command line options: |
| 102 | + |
| 103 | +``` |
| 104 | +Usage: fujinet [-V] [-u URL] [-c config_file] [-s SD_directory] |
| 105 | +``` |
| 106 | + |
| 107 | +### Launcher |
| 108 | + |
| 109 | +FujiNet-PC Launcher uses [wxPython](https://wxpython.org/) library for its GUI. Check if it is installed: |
| 110 | + |
| 111 | +```sh |
| 112 | +$ python -c "import wx; print(wx.version())" |
| 113 | +4.1.2a1.dev5310+af8cca51 msw (phoenix) wxWidgets 3.1.5 |
| 114 | +``` |
| 115 | + |
| 116 | +If instead of version information the `ModuleNotFoundError: No module named 'wx` is printed then wxPython must be installed. Easiest way is to install additional software for Python is to use **pip** - package installer for Python. |
| 117 | + |
| 118 | +Note: Similar story to `python` vs `python3` is with `pip` vs `pip3` or even `python -m pip` vs `python3 -m pip`. Use the right pip command to manage Python 3 packages on your system (check Python version with `pip -V` or `pip3 -V`). |
| 119 | + |
| 120 | +To install wxPython using `pip` (or `pip3`): |
| 121 | + |
| 122 | +```sh |
| 123 | +$ pip install -U wxPython # or pip3 install -U wxPython |
| 124 | +``` |
| 125 | + |
| 126 | +This should work fine on macOS and Windows. Unfortunately, not on Linux - details [here](https://wxpython.org/pages/downloads/). |
| 127 | + |
| 128 | +There are two solutions to problem with wxPython installation on Linux: |
| 129 | + |
| 130 | +a) Use package provided by Linux distribution |
| 131 | + |
| 132 | +E.g on Ubuntu (quite old version): |
| 133 | +```sh |
| 134 | +$ sudo apt install python3-wxgtk4.0 |
| 135 | +``` |
| 136 | + |
| 137 | +b) Use Linux distribution [specific pip package](https://extras.wxpython.org/wxPython4/extras/linux/gtk3/) |
| 138 | + |
| 139 | +E.g on Ubuntu 22.04: |
| 140 | +```sh |
| 141 | +$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/ wxPython |
| 142 | +``` |
| 143 | + |
| 144 | +Now, with Python and wxPython installed, the Launcher program can be started. Enter the scripts directory - the one with `emulator`, `fujinet-pc`, `launcher` and `netsiohub` subdirectories (DO NOT enter `launcher` subdirectory). |
| 145 | + |
| 146 | +Start FujiNet-PC Launcher: |
| 147 | + |
| 148 | +```sh |
| 149 | +$ python -m launcher # or python3 -m launcher |
| 150 | +``` |
| 151 | + |
| 152 | +If all is good the FujiNet shaped window will open and FujiNet-PC and NetSIO hub will be started in background. |
| 153 | + |
| 154 | + |
| 155 | +FujiNet-PC Launcher command line options: |
| 156 | + |
| 157 | +``` |
| 158 | +usage: launcher [-h] [-l LABEL] [-g GUI_SCALE] [-t] [-u URL] [-c FNCONFIG] [-s SD] [-p PORT] [-r NETSIO_PORT] |
| 159 | + [-i INSTANCE] [-v] [-d] [-V] |
| 160 | +
|
| 161 | +This launcher program controls FujiNet-PC and NetSIO hub |
| 162 | +
|
| 163 | +options: |
| 164 | + -h, --help show this help message and exit |
| 165 | + -l LABEL, --label LABEL |
| 166 | + Launcher label |
| 167 | + -g GUI_SCALE, --gui-scale GUI_SCALE |
| 168 | + GUI scale |
| 169 | + -t, --top-window Stay on top window |
| 170 | + -u URL, --url URL FujiNet web interface ([0.0.0.0][:8000]) |
| 171 | + -c FNCONFIG, --fnconfig FNCONFIG |
| 172 | + Path to FujiNet configuration file (fnconfig.ini) |
| 173 | + -s SD, --sd SD Path to SD directory (SD) |
| 174 | + -p PORT, --port PORT TCP port used by Altirra NetSIO custom device (9996) |
| 175 | + -r NETSIO_PORT, --netsio-port NETSIO_PORT |
| 176 | + UDP port used by NetSIO peripherals (9997) |
| 177 | + -i INSTANCE, --instance INSTANCE |
| 178 | + FujiNet instance ID |
| 179 | + -v, --verbose Log emulation device commands |
| 180 | + -d, --debug Print debug output |
| 181 | + -V, --version Print program version and exit |
| 182 | +``` |
| 183 | + |
| 184 | + |
| 185 | +### Custom device for Altirra emulator |
| 186 | + |
| 187 | +Device file for Altirra emulator `netsio.atdevice` is located in `emulator/Altirra` directory. |
| 188 | + |
| 189 | +To connect Altirra with FujiNet follow the instructions [here](Install.md#4-connect-altirra-with-fujinet). |
0 commit comments