News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Devilmarkus

CPC emulators/tools for Windows and Registry

Started by Devilmarkus, 21:13, 09 October 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Devilmarkus

Hello emu coders,
This thread I start to talk about a good solution to find a international solution for registry settings.
(Talking about adding shell commands or icons to DSK, CDT, SNA and other emulator related things)

The main problem is that not all emulators/tools do the same settings.

WinCPC for example adds unasked registry entries and overwrites probably exising ones to:
HKLM/Software/Classes/.DSK
it gives the DSK format the instruction: "Look at HKLM/Software/Classes/WinCPC.dsk! This will rule the world now"

CPCDiskXP does similar. (Good point here: You can select to do that or not)
HKLM/Software/Classes/.DSK and also! HKCU/Software/Classes/.DSK
there it tells the .dsk extension to look @ HKLM/Software/Classes/dsk.document

So you can see:
2 tools, 2 different registry settings.

Next will be JavaCPC which will also add some registry settings (No guys, I don't plan to steal any icons or so)
and add a few fileformat depending shell popup menu entries.
(E.g. rightclick on .DSK -> Mount DSK in JavaCPC)

I do that by adding registry settings into:
HKLM/Software/Classes/.DSK
Instruction: Hey , DSK, look at 'dskfile' <~~~~ could be a good idea to find a common registry point, many entries are like XXXfile

Then, in HKLM/Software/Classes/dskfile I add only popup additional shell extension. Thats all. (No default icon set)

DiskUtil 1.3 (available here: http://cpc-live.com/data/list.php?dir=-tool ) does similar:
It adds a smart registry entry for dsk files: "Edit" (localized, German people will see "Bearbeiten")

So, why don't we find a registry entry which we could use as standard for this?
It really suxx, when many applications use their own registry names. (DSK.Document, WinCPC.DSK, NonAmiga.DSK or however)

A clear registry entry suitable for all would be the best solution!

Please post some ideas.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Devilmarkus

BTW.: If you are confused about registry settings:
This is how I add them in DiskUtil1.3:

    protected void setupReg() {
        try {
            String command = "reg.exe QUERY \"HKCU\\Software\\Classes\\.DSK\" /ve";
            process = Runtime.getRuntime().exec(command);
            InputStream is = process.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            String line;
            String result = "";
            while ((line = br.readLine()) != null) {
                result += line;
            }
            if (result.contains("REG_SZ")) {
                while (!result.startsWith("REG_SZ")) {
                    result = result.substring(1);
                }
                result = result.substring(7);
                while (result.startsWith(" ")) {
                    result = result.substring(1);
                }
            }
            System.out.println(result);
            System.out.println(result.length());
            br.close();
            process = null;
            String rem = "testpath";
            File checkit = new File(rem);
            String got = "\"\\\"" + checkit.getAbsolutePath().replace(rem, "");
            got = got + "DiskUtil.exe\\\" \\\"%1\\\"\"";

            if (result.length() > 0) {
                command = "reg.exe ADD \"HKLM\\Software\\Classes\\" + result + "\\shell\\Edit\\command\" /ve /t REG_SZ /d " + got + " /f";
                Runtime.getRuntime().exec(command);
            } else {
                command = "reg.exe ADD \"HKLM\\Software\\Classes\\.DSK\" /ve /t REG_SZ /d dskfile /f";
                Runtime.getRuntime().exec(command);
                command = "reg.exe ADD \"HKCU\\Software\\Classes\\.DSK\" /ve /t REG_SZ /d dskfile /f";
                Runtime.getRuntime().exec(command);
                command = "reg.exe ADD \"HKLM\\Software\\Classes\\dskfile\\shell\\Edit\\command\" /ve /t REG_SZ /d " + got + " /f";
                Runtime.getRuntime().exec(command);
            }
           
            // WinCPC fucks your Registry up?
            // we add DiskUtil menu entry here, too!
            command = "reg.exe ADD \"HKLM\\Software\\Classes\\WinCPC.DSK\\shell\\Edit\\command\" /ve /t REG_SZ /d " + got + " /f";
            Runtime.getRuntime().exec(command);

            // CPCDiskXP fucks your Registry up?
            // we add DiskUtil menu entry here, too!
            command = "reg.exe ADD \"HKLM\\Software\\Classes\\dsk.Document\\shell\\Edit\\command\" /ve /t REG_SZ /d " + got + " /f";
            Runtime.getRuntime().exec(command);
        } catch (Exception e) {
        }
    }
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Gryzor

Is there really a point in coordinating registry edits? The only negative thing I see in the current situation is if a program takes over an extension without telling you or asking for your confirmation. Otherwise, why bother really?

arnoldemu

Quote from: Gryzor on 08:37, 11 October 10
Is there really a point in coordinating registry edits? The only negative thing I see in the current situation is if a program takes over an extension without telling you or asking for your confirmation. Otherwise, why bother really?
Yes exactly.

This is what Markus is saying, which I also agree with:

1. No emu should steal file associations (.dsk, .cdt, .sna etc).

2. Each emu can have a "make default" option which will overwrite "open" fields in registry, but only if you choose this option.
So each user can have more than one emu installed and be free to choose which is default. Same as internet browsers ;)
When default, emu can take icon too if it wants, but otherwise should not.

3. Each emu should also add a "open with" option. So if you have more than one emu you can then choose which emu to open the file with.
This should be added always, and then emu works happily with others if it is not default.

Settings in HKCU (current user), override file associations for the current user, and good if you have more than one user on your computer.
Best to use here.

HKLM (local machine), set file associations for all (but HKCU overrides this).


The idea of having .dsk -> dskfile is more to prevent registry bloat/pollution.
But really the following should happen in good emus:

1. detect if association is setup already.
2. if one exists, add your "open with" here. if default also change "open" here.
If one doesn't exist, create one, and add your "open with here". if default also add "open".

I use 3 cpc emus for testing etc. So it would be nice if the emu didn't change my icons and steal my associations ;)

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod