Dosbox in a Browser

The place to ask for technical support and offer assistance
danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Dosbox in a Browser

Post by danoon » March 31st, 2011, 4:49 pm

jDosbox is a java port of DosBox. It might be useful for the games that don't run in JPC or games that can use SB16.

http://jdosbox.sourceforge.net/

User avatar
DOSGuy
Website Administrator
Posts: 1021
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Dosbox in a Browser

Post by DOSGuy » April 1st, 2011, 8:38 am

I'm having a LOT of problems with jDosbox as an applet.

One glaring oversight is that the applet doesn't prevent the Alt key from going to the browser. The majority of platform games (especially Apogee/id) use Ctrl and Alt for jump and shoot. Shooters like AstroFire also use Alt to fire weapons. In such games, I can shoot once, but that activates the browser's dropdown menu. I have to get rid of the menu and click on the applet again in order to continue playing. Basically, this renders the vast majority of platform games unplayable. I'm currently writing a Javascript capture code to try to prevent the Alt key from getting to the browser. What a pain!

It looks like images are opened read-only in jDosbox. Some games fail at startup with a notice like "Couldn't open BOARD1.HXG for writing."

jDosbox doesn't fully support batch files! For games that have more than one episode, I created a batch file that lets you play the episode you want, based on the result of user input and errorlevel. Errorlevel is not executed, so the batch file attempts to run [game.exe] instead of [game1.exe].

Three methods are listed in the How-to-Applets file. I already have 178 zipped IMG files that are playable online, so Method 1 would be best for me. Problems with Method 1:

1) The first game that I run in the browser works fine. As soon as I go to a different page to play a different game, everything falls apart. The applet window will show the last thing that was seen in the previous game, or just a black screen. In either event, absolutely nothing happens when I click on the applet. Attempts to reload the page fail. Note that I am using a no-cache META instruction on the page, but this doesn't resolve anything. Clearing the cache manually doesn't help. Once a copy of jDosbox is loaded into system RAM, it's stuck there. Tested on IE9 and Chrome 10.

2) Some hard drive images won't load. Games come in a variety of sizes, so my IMG files are for different hard drive capacities! The How-to-Applets file lists a single size parameter: "-size 512,16,2,512". Whereas DOSBox can mount any IMG without the -size parameter, this fails in jDosbox. No problem, I'll send custom parameters. In DOSBox, the syntax is "-size bps,spc,total clusters,free clusters". Clearly jDosbox is using a different syntax. 512 bps * 16 spc = 8 KB/cluster * 2 clusters = HD capacity of 16 KB.

So, I had to switch to Method 2 to prevent the game from being stored in RAM. This means that I have to recreate every image on the site in order to put the game in a folder called "jdos", which is now underway.
Today entirely the maniac there is no excuse with the article.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 10:00 am

I'll take a look as some of your img files that jpc uses and test them.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 11:44 am

Wow, I misunderstood you original post, I didn't realize you already solved your problem.

I went to you online page and test several games and they appear to work well.

Have you seen any games that don't work?

User avatar
DOSGuy
Website Administrator
Posts: 1021
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Dosbox in a Browser

Post by DOSGuy » April 1st, 2011, 11:45 am

Games that don't work

Games that freeze while loading:

Blackthorne

Games that are unplayable due to mouse issues:

Animal Quest
Dinosaur Predators
Magic Crayon
VGA Jigsaw

Games that have issues

Games that have displayed rounding errors:

Aspetra
Last edited by DOSGuy on August 3rd, 2015, 9:18 pm, edited 1 time in total.
Today entirely the maniac there is no excuse with the article.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 1:22 pm

File system images loaded from a jar are now writable, the writes are stored in RAM. I tested this with Abuse.

Build#18 is available at

http://sourceforge.net/projects/jdosbox ... r/download

I'll continue to investigate the other problems.

User avatar
DOSGuy
Website Administrator
Posts: 1021
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Dosbox in a Browser

Post by DOSGuy » April 1st, 2011, 1:33 pm

Awesome! That's exactly how I was planning to solve that problem: by loading the game into a RAMdisk.
Today entirely the maniac there is no excuse with the article.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 2:37 pm

I'm not sure what to do about the alt key, perhaps it should be mapped to another key, but which one?

User avatar
DOSGuy
Website Administrator
Posts: 1021
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Dosbox in a Browser

Post by DOSGuy » April 1st, 2011, 3:03 pm

Are you talking about a DOSBox map that would allow another key to substitute for Alt, or having the applet redirect the Alt key so that the browser detects a different key press?
Today entirely the maniac there is no excuse with the article.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 3:31 pm

I'm still trying to understand the alt key handling. I think I got it to work. I tested this with k6demo

Here is a one off build that you can test with.

http://jdosbox.sourceforge.net/v18a/jdosbox.jar

User avatar
DOSGuy
Website Administrator
Posts: 1021
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Dosbox in a Browser

Post by DOSGuy » April 1st, 2011, 3:40 pm

Sweet! That seems to be working! This is awesome!

The one weak point is the mouse. The mouse pointer sometimes jumps around while I'm dragging the map windows in Warcraft, and it eventually stops responding to mouse clicks.
Today entirely the maniac there is no excuse with the article.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 4:58 pm

Found a bug when files were access via file control blocks (FCB). This fixes Titanic and maybe some others.

http://jdosbox.sourceforge.net/v18b/jdosbox.jar

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 1st, 2011, 6:33 pm

Fixed the choice /t command and added %errorlevel% environment variable. I tested this fix with Arctic Adventure. Hopefully the other games had the same problem.

http://jdosbox.sourceforge.net/v18c/jdosbox.jar

User avatar
DOSGuy
Website Administrator
Posts: 1021
Joined: September 2nd, 2005, 8:28 pm
Contact:

Re: Dosbox in a Browser

Post by DOSGuy » April 2nd, 2011, 2:52 am

Awesome!

Most of the remaining problems seem to be related to the mouse. Animal Quest and Dinosaur Predators (both by Alive Software using the same engine) don't work because the mouse goes crazy.

In Gobliiins, left-clicking should initiate action and right-clicking should cycle through the available actions. Instead, left-clicking cycles, and right-clicking does nothing.

The graphics issue I noted in Hocus Pocus occurs during the Episode / Difficulty selection / Results screens. A star field should fly past the screen, emanating from the center in four directions, but the effect is limited to the bottom right quadrant.

Jazz Jackrabbit (not previously supported by JPC) fails with "DPMI error (400A): insufficient extended memory". MEM reports 16 MB of EMS and XMS. Other games that use DPMI work fine.


I got a rounding error in Ant Run that caused "Score" to list as 479.9999999999999 and "Score Needed" to list as "305.9999999999999" after Level 2.
Today entirely the maniac there is no excuse with the article.

danoon
DOSBox Programmer
Posts: 14
Joined: March 31st, 2011, 4:37 pm

Re: Dosbox in a Browser

Post by danoon » April 2nd, 2011, 6:10 pm

Build #19 is up at sf.net

http://sourceforge.net/projects/jdosbox ... r/download

This fixes the right mouse button problems you have been seeing. I tested it Warcraft 2.

Post Reply