Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internet in EM-Dosbox #32

Open
veso266 opened this issue Mar 6, 2016 · 25 comments
Open

Internet in EM-Dosbox #32

veso266 opened this issue Mar 6, 2016 · 25 comments

Comments

@veso266
Copy link

veso266 commented Mar 6, 2016

Hi I would like to know if its posible to hook emulate Windows 95 or 3.1 to Internet with this Javascript Dosbox Emulator like you can do this with DosBox Megabuild: http://gadgets.itwriting.com/2158-getting-windows-3-1-connected-to-the-internet-in-dosbox-of-course.html

Thanks for Anwsering and Best Regards

PS: Can I get S3 Video drivers in Win3.1 and use it in Higher color mode?

@dreamlayers
Copy link
Owner

There are two obstacles restricting your Internet use from a browser. First, you have the same-origin policy limiting where you can connect. You then only use certain protocols, and can't make a generic TCP or UDP connection.

You can compile SDL_net under Emscripten, and then build Em-DOSBox with SDL_net. Then you can connect a serial port to an IP by dialing it like a phone number with ATDT. However, the connection will be WebSocket, not the ordinary TCP you'd expect when DOSBox is compiled natively.

Then you need a kind of proxy, on an address where you're allowed to connect via the same-origin policy. It provides a SLIP or PPP connection via WebSocket to Em-DOSBox. From the point of view of programs running in DOSBox it's dial-up Internet access.

This has already been done with Windows 3.1. Someone else set it up, and I only helped out.

Yes, S3 drivers should work for higher colour and higher resolution modes.

@veso266
Copy link
Author

veso266 commented Apr 9, 2016

Thanks can you provide some instruction how to do it (compile with SDL_Net) and what to do then?

Do you have a web adress of that vorking Windows 3.1 in Internet installation so I can inspect how it was done?

Thanks for Anwsering and Best Regards

@dreamlayers
Copy link
Owner

Here's Jason Scott's blog post on it: http://ascii.textfiles.com/archives/4546

I don't know if the site is still up, and forget where it was located.

@veso266
Copy link
Author

veso266 commented Apr 12, 2016

Hi Thanks now I only need to compile em-dosbox with SDL_Net support (what is the best way to do that)

I've install ./configure and make and sudo make install on SDL2_net downloaded from here: https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.zip

sudo make install
[sudo] password for mitja:
make[1]: Entering directory '/home/mitja/emdosbox/sdl_net/SDL2_net-2.0.1'
/bin/mkdir -p '/usr/local/lib'
/bin/bash ./libtool --mode=install /usr/bin/install -c libSDL2_net.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libSDL2_net-2.0.so.0.0.1 /usr/local/lib/libSDL2_net-2.0.so.0.0.1
libtool: install: (cd /usr/local/lib && { ln -s -f libSDL2_net-2.0.so.0.0.1 libSDL2_net-2.0.so.0 || { rm -f libSDL2_net-2.0.so.0 && ln -s libSDL2_net-2.0.so.0.0.1 libSDL2_net-2.0.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libSDL2_net-2.0.so.0.0.1 libSDL2_net.so || { rm -f libSDL2_net.so && ln -s libSDL2_net-2.0.so.0.0.1 libSDL2_net.so; }; })
libtool: install: /usr/bin/install -c .libs/libSDL2_net.lai /usr/local/lib/libSDL2_net.la
libtool: install: /usr/bin/install -c .libs/libSDL2_net.a /usr/local/lib/libSDL2_net.a
libtool: install: chmod 644 /usr/local/lib/libSDL2_net.a
libtool: install: ranlib /usr/local/lib/libSDL2_net.a

libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib

Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:

  • add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  • add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  • use the `-Wl,-rpath -Wl,LIBDIR' linker flag
  • have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

/bin/mkdir -p '/usr/local/include/SDL2'
/usr/bin/install -c -m 644 SDL_net.h '/usr/local/include/SDL2'
/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 SDL2_net.pc '/usr/local/lib/pkgconfig'
make[1]: Leaving directory '/home/mitja/emdosbox/sdl_net/SDL2_net-2.0.1'
.

and then I've done emconfigure ./configure on emdosbox but it isn't finding SDL2_net:

checking SDL_net.h usability... no
checking SDL_net.h presence... no
checking for SDL_net.h... no
checking for SDLNet_Init in -lSDL2_net... no
configure: WARNING: Can't find SDL2_net, internal modem and ipx disabled
.

Thanks for Anwsering and Best Regards

@veso266
Copy link
Author

veso266 commented Feb 16, 2017

any help?

@jbaicoianu
Copy link

jbaicoianu commented Mar 1, 2017

Hi @veso266, I just found your issue today - I did the work necessary to get SDL_net running with emscripten a year or so back when I set up http://www.metacade.com/win311 - I can talk you through how to get that working, and explain how I got the networking working without worrying about cross-origin issues.

First, SDL_net is available via emscripten's port system so you shouldn't have to do the work yourself, if emcc gets the right arguments (-s USE_SDL_NET=2) it'll automatically download and install the SDL_net port from https://github.com/emscripten-ports/SDL2_net

The problem though is getting emconfigure to pick up the sdl_net.h availability so that it can trigger the port compilation. I'm not really sure how to do this aside from manually copying SDL_net.h into the SDL include directory, but this feels dirty and hackish, so I'm not sure how to integrate it cleanly. Maybe @kripken has some hints about this?

Once it is compiled, the next step is to set up a server somewhere (I used AWS) running pppd with a websocket proxy in front of it. This is a bit tricky if you haven't run this sort of service in the past, I started writing a big post about how to do it but never actually published it. I can clean it up and publish it when you get to that point though.

Once that's all done, you then use a ppp client in DOSBox to connect, and with the command ATDTyour.hostname.com:port and DOSBox does the rest for you. I've used this technique successfully from both DOS and Win3.11, and others have had success using similar techniques for IPX games (Warcraft, Doom, etc).

@kripken
Copy link

kripken commented Mar 1, 2017

The configure script might have a way to add include dirs. Otherwise you can set the CC env var to add an include dir that way. Really depends on the configure script though, they often need hacking for each new platform.

@jbaicoianu
Copy link

@kripken the problem is that assuming a clean install of emscripten and a fresh compile of some app, there is no include directory to point the configure script to - emscripten doesn't download and install the port until something requests it, and it's not requested until some file is compiled using -s USE_SDL_NET=2 - which never happens because ./configure doesn't see the .h file, so it doesn't ever add that flag to the compiler arguments. Kind of a catch-22 situation.

A while ago I tried to look to see how apps which use SDL_image handle this, but didn't really turn up anything revealing. Is it just standard practice to make sure you have all the necessary ports installed before running ./emcofigure? Or should we modify our configure.ac file to do this step for us if we detect we're running in an Emscripten environment?

@kripken
Copy link

kripken commented Mar 2, 2017

Yes, for something like this, you may want to run the embuilder.py tool to build SDL2 before configure runs (embuilder.py build sdl2).

@veso266
Copy link
Author

veso266 commented Mar 8, 2017

@jbaicoianu Hi thanks for this could you plese explain a bit more on how to compile this properly? (emconfigure ./configure then make (so what should I do so emscripten will find SDL_Net.h properly and compile emdosbox with Net support? (or share emdosbox.js (so I can go with easy road first and then try to compile it from source)

and please post your PPP Server setup

Thanks for Anwsering and Best Regards

@dreamlayers
Copy link
Owner

dreamlayers commented Mar 9, 2017

For building you could: emconfigure ./configure CPPFLAGS="-s USE_SDL=2 -s USE_SDL_NET=2" LDFLAGS="-s USE_SDL_NET=2"

I think this is stupid and maybe I should do something to make it more user-friendly. There, CPPFLAGS are to make the ./configure tests and compiling work, and LDFLAGS are to make the final link work. Ignore warnings about -lSDL2_net; failure to find it is fine as long as there are no undefined symbols.

@veso266
Copy link
Author

veso266 commented Mar 9, 2017

I've tried with above command but when I do make I get a lot of these warnings
WARNING:root:Assigning a non-existent settings attribute "USE_SDL_NET" WARNING:root: - did you mean one of USE_SDL_TTF, USE_SDL, USE_SDL_IMAGE? WARNING:root: - perhaps a typo in emcc's -s X=Y notation? WARNING:root: - (see src/settings.js for valid values) WARNING:root:generating system library: libcxx_noexcept.a... WARNING:root: ok WARNING:root:generating system library: libcxxabi.bc... WARNING:root: ok
and it didn't build corecly because it builded without network support

@dreamlayers
Copy link
Owner

@veso266, you must be using an old version of Emscripten, which doesn't understand USE_SDL_NET. Current Emscripten incoming understands it. So, you need to either use a newer Emscripten, or build SDL_net separately and use different options to build with it. I recommend a newer Emscripten.

@veso266
Copy link
Author

veso266 commented Mar 10, 2017

It compiled 👍 (after updating cmake and emscripten)

now can anyone post a working dosbox.conf (my doesn't work it shows this:
Serial1: Modem could not open TCP port 23.

config is here:
[serial]
serial1=modem listenport:23

@jbaicoianu now I am just waiting for your ppp server tutorial :)

@dreamlayers
Copy link
Owner

@veso266, you're trying to listen for incoming connections? I don't think WebSockets allows you to do that. You need to run a server which will accept a WebSockets connection and make an outbound connection from DOSBox to that server.

@veso266 veso266 closed this as completed Mar 10, 2017
@veso266
Copy link
Author

veso266 commented Mar 10, 2017

ups closed :( can somene reopen it???

@dreamlayers
Copy link
Owner

reopening

@dreamlayers dreamlayers reopened this Mar 10, 2017
@jbaicoianu
Copy link

@veso266 ok I published the article - http://blog.vrcade.io/2017/03/setting-up-a-visp-using-pppow/ - I've also put my config files up on github, https://github.com/jbaicoianu/PPPoW-server

Let me know if you run into any problems, I'll be happy to help.

@veso266
Copy link
Author

veso266 commented Mar 11, 2017

@jbaicoianu thanks for the article (I understand PPP, routing part but I am a bit confused about websockify and emdosbox conf file (lets say I want to connect to bbs.starbase21.net for a smoke test

I would setup a dosbox.conf like this:
[serial]
serial1=modem listenport:23`

and then when I run emdosbox I get this:
Serial1: Modem could not open TCP port 23
OK I can't listen to incoming connection so I've changed my config a bit to look like this:
[serial]
serial1=modem listenport:0`
now emdosbox doesn't complain but when I run telemate and say atdt bbs.starbase21.net I get NO CARRIER and when I want to try this a second time I get ERROR

now how must I setup websockify and dosbox.conf to be able to do this

Thanks for helping

PS: Can anyone tell me how to load custom dosbox.conf into this: https://github.com/db48x/emdosbox-loader
PPS: I know this isn't in a scope of this issue but if my windows (and it also affects linux) keyboard layout is set to SL-SI (Slovenian) or anything other then EN-US I can't type any special characters (':, /, , , itd.(etc.)
the best thing would be if emdosbox recognized keyboard layout like dosbox does so I would have / on / and : on : and so on

@dreamlayers
Copy link
Owner

PPS: I know this isn't in a scope of this issue but if my windows (and it also affects linux) keyboard layout is set to SL-SI (Slovenian) or anything other then EN-US I can't type any special characters (':, /, , , itd.(etc.)
the best thing would be if emdosbox recognized keyboard layout like dosbox does so I would have / on / and : on : and so on

I can confirm that in Firefox: #40

@jbaicoianu
Copy link

jbaicoianu commented Mar 12, 2017

Hah, that's funny, bbs.starbase21.net was the first thing I connected to when I got networking working with DOSBox too :) https://www.youtube.com/watch?v=NviTHfJPiHU - leave me a message on that BBS when you get it working! (username is bai).

Looking back at the config for this, in dosbox.conf I have the same as you:

[serial]
serial1=modem listenport:0

From what I recall I think for the BBS stuff I may have configured it with an option to send all stuff through my websockify proxy, let me poke at this a bit and see if I can remember how I set it up.

@veso266
Copy link
Author

veso266 commented Mar 12, 2017

@jbaicoianu Hi i got it working but its not like you have I set my proxy like this: websockify localhost:8181 bbs.starbase21.net:23 (but you just did adtd bbs.starbase.net and it worked (if I do that I get NO CARRIER)

and then I must do adtd localhost:8181 in telemate
I have written you a message on starbase21 but I don't know how to send it so here is a picture of it:
emdosbox-internet

also you have more information on what is going on with a modem in console then me (do you maybe know why?)

PS: has anyone written a keygen for Telemate??

@jbaicoianu
Copy link

Yeah I think I may have cheated a bit for the video :) I think what I did was compile with -s WEBSOCKET_URL=wss://localhost:8181 -s SOCKET_DEBUG=1 and then had a websockify instance pointing to bbs.starbase21.net:23. This way the ATDT command arguments are mostly ignored, but I still typed in the hostname to look good for the video.

The fact that you have to set up a proxy for each bbs you want to connect to is what sent me down the ppp route.

@veso266
Copy link
Author

veso266 commented Mar 13, 2017

@jbaicoianu will go with PPP Route but then I can't use Telemate to dial StarBase BBS (or does Telemate support Telnet)
PS: how I can setup Trumpet Winsock part on windows 3.1? (in your example: http://www.metacade.com/win311 it aphears it actualy dials some number not websockify instance)
PPS: Which Loader are you using here: http://www.metacade.com/win311 its not emularity and its not emdosbox-loader its something else?)
Thanks for Anwsering and Best Regards

@jbaicoianu
Copy link

@veso266 the loader I'm using here is EMLoader, I wrote it a couple years back when I first started working with JSMESS, and then extended it to work with em-dosbox a bit later. The main difference is that it does everything in WebGL and is mainly intended for embedding the emulators into 3d worlds. It was developed in parallel with Emularity, basically I would do crazy experiments with EMLoader and then work with @db48x to incorporate them into a more sane package which we use on Archive.org.

The Trumpet Winsock stuff set-up is....well it was fun to set up :) For the most part it's just a matter of putting the username/password into the "Profile" menu, and setting the phone number to the hostname:port of your proxied ppp server.

From there, I went a little overboard with the modem sounds - I actually found a recording of a modem handshake, and I split it up into the various phases of negotiation, and then I use Winsock's script system to play those sounds at the appropriate part of the process. So if the server never "picks up" you hear the numbers dial but no negotiation, or if the negotiation fails you get a long tone and then a retry, just like it used to work. So you get the full experience of dial-up-and-pray, where you're listening for just the right sounds to let you know it worked successfully, or whether you need to hang up and try again.

You probably don't need the fancy scripts unless you really want to emulate that authentic feeling, but all of it is triggered from the login script in c:\trumpet\login.cmd. I had to dig up some old help files on the wayback machine to re-learn all that old syntax though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants