Forums

Forums (http://www.abandonia.com/vbullet/index.php)
-   General compatibility fixes (http://www.abandonia.com/vbullet/forumdisplay.php?f=95)
-   -   Linux Dosbox Trick (http://www.abandonia.com/vbullet/showthread.php?t=29037)

jonnan001 03-09-2012 10:34 PM

Linux Dosbox Trick
 
I'm fairly pleased with myself for figuring this out, and since I can't find anywhere on the Internet it mentions this, I'm posting it for people.

There is a Linux feature (intended for running scripts in an interpreter) called hashbang or shebang. Basically, if you have a text script that uses '#' to denote comments, in linux you can mark the script executable and put "#! /path/to/script-interpreter" as the first line, and when linux runs it it will use that interpreter.

Since DOSBox .conf files use #comments, it works perfectly well with DOSbox.
Thus:
#!/usr/bin/dosbox -conf
(configuration)
(end-of-file)

Configuration/Caveats

Where is dosbox installed?
From the command-line, type "whereis dosbox".

Permissions:
File needs to be marked 'executable'.

end-of-line character:
*has* to be linefeed (e.g. Unix), *not* carriage-return/linefeed (e.g. MS-DOS/Windows);
It will fail silently if it has the latter, but this can be fixed with a unix utility called 'dos2unix'. usage: dos2unix ~/bin/*
(This caught me offguard when porting gog.com games in, and I felt really stupid when I figured out why the exact same configuration was fine in one file, but just opened DOSBox in another - <G>.)

File Naming:
They do not need the .conf extension, and if you intend to open them via double clicking, they can be named anything. However if you want to run them from the command line, they need to be in a location Linux see's in your $PATH (ideally ~/bin/), and you probably want to avoid a name containing spaces: typing moo2 will work, typing "Master of Orion 2" will work but you actually need the quotes, clicking on the file "Master of Orion 2" with no quotes will work fine though.

I probably shouldn't be as annoyingly pleased with myself over this that I am . . . but hey, it's really quite nice and easy and loads stuff better than my previous system of manually adding games to gnome menus.

Jonnan

Japo 04-09-2012 07:35 PM

Thanks, this is pretty good :)

jonnan001 05-09-2012 06:37 AM

Quote:

Originally Posted by Japo (Post 445775)
Thanks, this is pretty good :)

Thanks - as I said, what I had been doing was manually adding games to the menus, which is not hard one at a time but is a pain en masse. It was just one of those odd thoughts as I was updating GoG.com conf files where your brain goes "Come to think . . . is there any reason that wouldn't work? I can't see why not, right?"

To be fair, this is still a pain en masse, but considerably less of one, and I prefer the end result over having it in the menus anyway.

Pug


The current time is 09:31 AM (GMT)

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.