Better e-uae integration
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    I had set out to better integrate e-uae with Linux/Gnome. The requirements were:

    1) Ability to launch either an a500 or a1200 from the adf's context menu in Nautilus.
    2) The file action would find all disks in the set and attach the first four to uae. If the adf file name does not adhere to TOSEC naming standard (Filename (Disk x of y).adf), thae single disk would still be attached to uae and you would have to manually select the others as needed.
    3) The GUI would never be seen. Once you double click your adf, the game would appear in a window. Once you exit the game you see nothing more.

    I was able to accomplish this with some Perl magic and a custom build of uae. MorphOS is already to launch adfs via double click but it does not find the other disks in the set (Disk x of y)... I am wondering if something like this can be done in ARexx? I don't know if it supports regex or not. If anyone would like to take this on I could send you the perl code and perhaps it can be done in ARexx. Who knows.. Just a thought. :)
  • »13.06.10 - 04:49
    Profile
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Perl scripts work in MorphOS if you have the SDK installed.
    1 + 1 = 3 with very large values of 1
  • »13.06.10 - 10:28
    Profile
  • Fab
  • MorphOS Developer
    Fab
    Posts: 1331 from 2003/6/16
    I'll convert that to a rexx equivalent as soon as i'm done with my current stuff. :)

    Rexx has no regexp, but for the thing you do, a simple:
    parse var filename basename '(Disk ' index ' of ' total ').adf' would be enough to set the basename, index and total variables. In fact, listing the directory and looking for the adfs is more work than the parsing part. :)

    [ Edited by Fab on 2010/6/13 16:03 ]
  • »13.06.10 - 13:58
    Profile Visit Website
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Would it be possible to include Perl as standard with MorphOS? Without trying to sound presumptuous, OS X includes Perl, so would it be an issue for Morph?
  • »16.06.10 - 13:56
    Profile
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    I beat you to it, Fab. I emailed you the REXX script. I will hash out a couple of final details and then convert those last two commands to AREXX. I think it'll work. :)
  • »16.06.10 - 13:57
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 3108 from 2003/3/5
    From: Canada
    @gdanko

    Quote:

    Would it be possible to include Perl as standard with MorphOS? Without trying to sound presumptuous, OS X includes Perl, so would it be an issue for Morph?


    Not really - Perl relies heavily on the GeekGadgets environment that has to be present / setup for it to work. We do not want to clutter the default system installation with all the /bin, /usr, /home, etc *nix crap. It's certainly possible to remove such dependancies from Perl, but that's probably too much work.

    [ Edited by jacadcaps on 2010/6/16 17:17 ]
  • »16.06.10 - 14:16
    Profile Visit Website
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Quote:

    Not really - Perl relies heavily on the GeekGadgets environment that has to be present / setup for it to work. We do not want to clutter the default system installation with all the /bin, /usr, /home, etc *nix crap. It's certainly possible to remove such dependancies from Perl, but that's probably too much work.


    Fair enough. I can respect that.
  • »16.06.10 - 14:32
    Profile
  • Yokemate of Keyboards
    Yokemate of Keyboards
    magnetic
    Posts: 2129 from 2003/3/1
    From: Los Angeles
    better UAE integration has been a wish for some time, glad its getting done. Good job guys and good collaboration.
    Pegasos 2 Rev 2B3 w/ Freescale 7447 "G4" @ 1ghz / 1gb Nanya Ram
    Quad Boot: MorphOS 2.7 | Amiga OS4.1 U4 | Ubuntu PPC GNU/Linux | OS X 10.4
  • »17.06.10 - 02:11
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    xyphoid
    Posts: 870 from 2008/7/11
    From: Delaware, USA
    Well I can't wait seeing I never got it going anyways :-P :-P
  • »17.06.10 - 02:18
    Profile
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Quote:


    magnetic wrote:
    better UAE integration has been a wish for some time, glad its getting done. Good job guys and good collaboration.


    I finally got the DVI > SVGA adapter for my Mac Mini back home so I will do more extensive testing with the rexx script and work with Fab to get the page updated. It will work. :)
  • »17.06.10 - 02:38
    Profile
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    My script is working in that all the disks are hunted down and a working uae command string is generated. However, I don't know how to get ARexx to execute an external command. :(

    In perl I can do:
    system("$command");

    How is this done in ARexx?
  • »20.06.10 - 05:08
    Profile
  • Fab
  • MorphOS Developer
    Fab
    Posts: 1331 from 2003/6/16
    easy:

    address command <command string>

    If you need to change current directory for whatever reason, you'd use:
    pragma('D', <new directory>);
  • »20.06.10 - 12:13
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    magnetic
    Posts: 2129 from 2003/3/1
    From: Los Angeles
    gdanko

    How are you? Any updates on this project? :)
    Pegasos 2 Rev 2B3 w/ Freescale 7447 "G4" @ 1ghz / 1gb Nanya Ram
    Quad Boot: MorphOS 2.7 | Amiga OS4.1 U4 | Ubuntu PPC GNU/Linux | OS X 10.4
  • »21.06.10 - 06:33
    Profile Visit Website
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Yup! Over the weekend I worked on it and it's working.
    * The script logs to the ram disk
    * The script finds the first four disks of your set and maps them to dh0-3
    * Disks not found are logged to the log file
    * If your adf is not of the filename format "Title (Disk x of y).adf" then just that adf is mapped to dh0 and disk swaps will be manual.

    Many thanks to Fab for answering my ARexx questions. This was my first foray into the ARexx world. :)

    [ Edited by gdanko on 2010/6/21 7:15 ]
  • »21.06.10 - 13:13
    Profile
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Quote:


    magnetic wrote:
    gdanko

    How are you? Any updates on this project? :)


    Here is the script. You map it to your application/x-adf mime type and you're ready to go. For now you'll need one for a500 and one for a1200.

    The mapping will look like this:
    >nil: Data:Scripts/uae-a500.rexx %sp

    Fab will hopefully integrate this into his howto so I won't reinvent the wheel and put up a new page.

    /* uae-a500.rexx */
    parse ARG adf_filename

    /* strip double quotes from the filename since this breaks exist */
    strlen = length(adf_filename)
    if right(adf_filename, 1) = '"' then do
    adf_filename = substr(adf_filename, 1, strlen -1)
    strlen = length(adf_filename)
    end

    if left(adf_filename, 1) = '"' then do
    adf_filename = substr(adf_filename, 2, strlen -1)
    end

    parse var adf_filename basename '(Disk 'index' of 'total').adf'

    base_dir = "System:Applications/e-uae"

    single_disk = "Yes"
    counter = 1
    log_file = "RAM:e-uae.log"
    uae = base_dir"/e-uae"

    /* arexx's time/date functions are weak */
    month = date(M)
    month = substr(month, 1, 3)
    date = date(U)
    date = substr(date, 4, 2)

    datestamp = month date
    timestamp = datestamp time(N)

    /* open the log file for writing */
    if open('FH', log_file, 'w') then do
    call writeln('FH', timestamp "Starting")
    end

    uae_command = uae "-f" base_dir"/conf/A500-hires.conf"

    /* hunt for disks 1-4 of any game and map them if they exist */
    do while counter <= total
    filename = basename"(Disk" counter "of" total").adf"
    if exists(filename) then do
    single disk = "No"
    call close('ADF')
    call writeln('FH', timestamp "Mapping" filename "to dh"counter-1)
    uae_command = uae_command "-"counter-1 '"'filename'"'
    end
    else
    call writeln('FH', timestamp "Unable to find "filename)

    counter = counter + 1
    end

    /* only one disk to be mapped */
    if single_disk = "Yes" then do
    call writeln('FH', timestamp "Mapping" adf_filename "to dh0")
    uae_command = uae_command "-0 " '"'adf_filename'"'

    call writeln('FH', timestamp "The command is: "uae_command)
    call close('FH')

    /* launch uae */
    address command uae_command

    Hmm the editor stripped my tab stops :) Oh well.

    [ Edited by gdanko on 2010/6/23 0:31 ]
  • »23.06.10 - 06:29
    Profile
  • Yokemate of Keyboards
    Yokemate of Keyboards
    magnetic
    Posts: 2129 from 2003/3/1
    From: Los Angeles
    Very cool! Thanks alot man... I wonder if some dev in free time could do a quick interface or button to launch the arexx script.. I remember Targhan did some stuff like this way back when..
    Pegasos 2 Rev 2B3 w/ Freescale 7447 "G4" @ 1ghz / 1gb Nanya Ram
    Quad Boot: MorphOS 2.7 | Amiga OS4.1 U4 | Ubuntu PPC GNU/Linux | OS X 10.4
  • »03.07.10 - 06:48
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    amyren
    Posts: 219 from 2010/5/15
    From: Norway
    Quote:


    magnetic wrote:
    Very cool! Thanks alot man... I wonder if some dev in free time could do a quick interface or button to launch the arexx script.. I remember Targhan did some stuff like this way back when..


    And what did you have in mind for that interface?
    I dont think it will be needed. If you do as suggested and add it to the mime prefs you can set it to be a part of the right-click popup menu, or/and you can set it as an action when double-clicking on the file.
    btw: a similar function have been available earlier, it was included in the pack ultimate, and was based on some scripts made by Fab.(included in the e-uae bonus drawer in some e-uae archives as well)...if I remember this correctly
    So I have the pack installed, and I already have these menu items on adf files, like "Runinuae A1200" and "RunInUae A500".

    What is different I think is that this new script have added the function to locate the additional disks in a set, so this is an improvement :)
  • »03.07.10 - 07:55
    Profile
  • Fab
  • MorphOS Developer
    Fab
    Posts: 1331 from 2003/6/16
    Yes, use this script as action instead of the simple previous command. Locating disks automagically is certainly better. )
  • »03.07.10 - 12:11
    Profile Visit Website
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    You need to update the mime action as well
  • »05.07.10 - 21:48
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    amyren
    Posts: 219 from 2010/5/15
    From: Norway
    gdanko:
    "The Editor stripped my tab stops"

    Thats probably why just editing the script makes this requestor pop up:
    'Please insert volume "System: in any drive'

    What did change in the editor?
  • »06.07.10 - 06:49
    Profile
  • Yokemate of Keyboards
    Yokemate of Keyboards
    magnetic
    Posts: 2129 from 2003/3/1
    From: Los Angeles
    Guys
    I think what i'm trying to suggest is to make it as PLUG AND GO for the User as possible. As we get new users for Morphos from Amigaland it would be cool to have some kind of built in gui prefs for UAE so we can just double click launch adf files without much config... do you know what Im getting at?

    I think this is one of the features missing from Morphos is better uae integration..
    Pegasos 2 Rev 2B3 w/ Freescale 7447 "G4" @ 1ghz / 1gb Nanya Ram
    Quad Boot: MorphOS 2.7 | Amiga OS4.1 U4 | Ubuntu PPC GNU/Linux | OS X 10.4
  • »06.07.10 - 22:47
    Profile Visit Website
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    All works now.
  • »07.07.10 - 01:10
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    xyphoid
    Posts: 870 from 2008/7/11
    From: Delaware, USA
    With Magnetic on this one, As I've struggled with getting this going. Instead of revisting past failures (previous attempts thread) can some one simplify it again for me? I more or less have the basic stuff. Will this give me an environment to run non adf such as programs/ games which reside still on the dusty 1200?
    Oh and totally lost on the mime app concept.
    Thanks!!
  • »26.07.10 - 03:54
    Profile
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Quote:


    magnetic wrote:
    Guys
    I think what i'm trying to suggest is to make it as PLUG AND GO for the User as possible. As we get new users for Morphos from Amigaland it would be cool to have some kind of built in gui prefs for UAE so we can just double click launch adf files without much config... do you know what Im getting at?

    I think this is one of the features missing from Morphos is better uae integration..


    I agree with you 100%. Though I don't know how well this would work as far as including a "control panel" in for an OpenSource app in a commercial OS. However, OS X has stuff like Samba and whatnot so I imagine you COULD include UAE in MorphOS.
  • »26.07.10 - 12:36
    Profile
  • Caterpillar
    Caterpillar
    gdanko
    Posts: 28 from 2010/6/8
    Quote:

    Oh and totally lost on the mime app concept.
    Thanks!!


    You're simply mapping *.adf files with an action, ie; open UAE with these options. Not much to it.
  • »26.07.10 - 12:37
    Profile