emularity
emularity copied to clipboard
cfg file in genesis don't work
First of all, thank you for your amazing work. I would like to configure my own keys to genesis emulator, there a problem with defaults keys, ALT key in Firefox show the menu, I can use config file, but don't works. For example, this is Wiz n' Liz running in genesis emulator (Internet archive example), it have a configuration file:
The content of the file is:
<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="genesis">
<input>
<port tag=":PAD1_3B" type="P1_BUTTON2" mask="16" defvalue="16">
<newseq type="standard">
KEYCODE_X OR JOYCODE_1_BUTTON2
</newseq>
</port>
<port tag=":PAD1_3B" type="P1_BUTTON3" mask="32" defvalue="32">
<newseq type="standard">
KEYCODE_C OR JOYCODE_1_BUTTON3
</newseq>
</port>
<port tag=":PAD1_3B" type="P1_BUTTON1" mask="64" defvalue="64">
<newseq type="standard">
KEYCODE_Z OR JOYCODE_1_BUTTON1
</newseq>
</port>
</input>
</system>
</mameconfig>
Z --> Button A X --> Button B C --> Button C
But in the emulator don't works, only CTRL, ALT, ESPACE key is working. ¿Is it a known problem? I use this parameter:
MAMELoader.mountFile("genesis.cfg",
MAMELoader.fetchFile("Config File",
"genesis.cfg")),
I use this configuration in local, but config file don't work too.
That looks ok to me, though I'm no MAME expert. Have you tried passing in command-line arguments to tell MAME to use that file specifically? It's pretty particular about what files it loads.
I have the same question. The emulator doesn't see the config file, although I mount it where the emulator expects to find it by default. Has anyone succeeded with redefining the control buttons?
I also tried to create a settings file in MAMEUI and then mount it. Without effect.
I will say more, the genesis.cfg file has no effect on the archive.org site, where IALoader is used. It is loaded into the "emulator" directory and is visible in the file system.
Today I experimented. In principle, the config file should be in the file /cfg/nes.cfg. I wrote it to the file system (and default.cfg too) before downloading the emulator, but it still does not load it. The strangest thing is that after I changed the settings in the emulator itself, they are not saved to disk. So far I’m guessing what’s wrong.
The Alt key in FireFox can be disabled in the about:config, but simple users are unlikely to do this. I would like to resolve the issue on our part.
Another oddity: I can create this directory /emulator/cfg/, but I can’t enter it - both the emulator and direct calls say that I do not have permission to access. Perhaps this is the reason why the settings are not read or saved.
Examples of code:
loader.js:1011
FS.writeFile('/cfg/default.cfg', '<?xml version="1.0"?>\n' +
'<!-- This file is autogenerated; comments and unknown tags will be stripped -->\n' +
'<mameconfig version="10">\n' +
' <system name="nes">\n' +
' <input>\n' +
' <port tag=":ctrl1:joypad:JOYPAD" type="P1_BUTTON2" mask="1" defvalue="1">\n' +
' <newseq type="standard">\n' +
' KEYCODE_X\n' +
' </newseq>\n' +
' </port>\n' +
' <port tag=":ctrl1:joypad:JOYPAD" type="P1_BUTTON1" mask="2" defvalue="2">\n' +
' <newseq type="standard">\n' +
' KEYCODE_Z\n' +
' </newseq>\n' +
' </port>\n' +
' <port tag=":ctrl1:joypad:JOYPAD" type="P1_SELECT" mask="4" defvalue="4">\n' +
' <newseq type="standard">\n' +
' KEYCODE_RSHIFT\n' +
' </newseq>\n' +
' </port>\n' +
' <port tag=":ctrl1:joypad:JOYPAD" type="P1_START" mask="8" defvalue="8">\n' +
' <newseq type="standard">\n' +
' KEYCODE_ENTER\n' +
' </newseq>\n' +
' </port>\n' +
' </input>\n' +
' <image_directories>\n' +
' <device instance="cartridge" directory="software" />\n' +
' </image_directories>\n' +
' </system>\n' +
'</mameconfig>\n', function(err) {
FS.readFile('/cfg/nes.cfg', function(err, contents) {
console.log(contents.toString());
});
});
Custom methods to read this file:
function test() {
var stats = FS.stat("/cfg/nes.cfg");
var fileSizeInBytes = stats["size"];
console.log(fileSizeInBytes);
var stream = FS.open('/cfg/nes.cfg', 'r');
var buf = new Uint8Array(fileSizeInBytes);
FS.read(stream, buf, 0, fileSizeInBytes, 0);
FS.close(stream);
console.log(buf);
/*stream = FS.open('/cfg/nes.cfg', 'w');
FS.write(stream, buf, 0, fileSizeInBytes);
FS.close(stream);*/
console.log(ab2str(buf));
}
function ab2str(buf) {
return String.fromCharCode.apply(null, new Uint16Array(buf));
}
I have been looking at this for MAME and Street Fighter 2
You need to set MAMELoader.extraArgs(["-ctrlrpath","/emulator","-ctrlr","sf2ce"]) to get Mame to load your config, where sf2ce is your config system name.
MAMELoader.mountFile("sf2ce.zip", MAMELoader.fetchFile("Game File", "games/sf2ce.zip")),
MAMELoader.mountFile("sf2ce.cfg", MAMELoader.fetchFile("CFG File", "games/sf2ce.cfg")),
MAMELoader.extraArgs(["-ctrlrpath", "/emulator","-ctrlr","sf2ce"])