Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: MAME not saving joystick mapping  (Read 6766 times)

0 Members and 1 Guest are viewing this topic.

Tetsuo1981

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 12
  • Last login:July 20, 2017, 02:33:04 pm
  • I want to build my own arcade machine!!
MAME not saving joystick mapping
« on: November 24, 2016, 04:53:07 pm »
Hi all

New to this forum but have been lurking before joining doing research for my own home arcade project.
 
I have just recieved and wired up my arcade stick and buttons witgh a zero delay usb encoder. I go Into MAME and set all of my buttons accordingly and key combos for escape etc. and save my settings. Everything plays fine untill I use my button combo to ESC back to menu and MAME crashes with an error code of 'caught unhandled st11logic_error exception: basic_string::_M_construct null not valid' then when I go back into MAME all of my settings are gone. I've set ctrlr and cfg to write and changed my ini file on the following lines:
 
​'writeconfig               1'
 
'global_inputs             1'
 
I'm stumped and a little but disheartened to be honest. I've worked and saved to get this far and it feels like its all for naught at the moment, alongside the Model 2 Emulator not working properly It feels like my homemade cabinet is over before it started. Any help would be great
 
Cheers guys

Tafoid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 238
  • Last login:February 12, 2025, 04:47:22 am
  • Emulation Devotee
    • MAMELOAD TNG (Front-End)
Re: MAME not saving joystick mapping
« Reply #1 on: November 25, 2016, 01:03:51 pm »
Hi all

New to this forum but have been lurking before joining doing research for my own home arcade project.
 
I have just recieved and wired up my arcade stick and buttons witgh a zero delay usb encoder. I go Into MAME and set all of my buttons accordingly and key combos for escape etc. and save my settings. Everything plays fine untill I use my button combo to ESC back to menu and MAME crashes with an error code of 'caught unhandled st11logic_error exception: basic_string::_M_construct null not valid' then when I go back into MAME all of my settings are gone. I've set ctrlr and cfg to write and changed my ini file on the following lines:
 
​'writeconfig               1'
 
'global_inputs             1'
 
I'm stumped and a little but disheartened to be honest. I've worked and saved to get this far and it feels like its all for naught at the moment, alongside the Model 2 Emulator not working properly It feels like my homemade cabinet is over before it started. Any help would be great
 
Cheers guys

I'd love to hear more about this issue.  We've gotten numerous complaints about this error and if you can, in a clean install, come up with a 100% way of reproducing it (a certain mapping combination, maybe?), please post what you find here.  Anyone that can work on the issue is having difficulty identifying the cause and being able to reproduce.


Tetsuo1981

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 12
  • Last login:July 20, 2017, 02:33:04 pm
  • I want to build my own arcade machine!!
Re: MAME not saving joystick mapping
« Reply #2 on: November 25, 2016, 02:02:58 pm »
GLADLY!!

Ok, so I have replicated this error on two 32bit PC's, one running XP Pro SP3 and the other Windows 10 Pro. In MAME 0177 with my arcade panel connected via USB with a Zero Delay encoder I enter 'Configure Options' then 'General Inputs/User Interface and change:
UI Select to Joy1 button 3
UI Cancel to ESC or Joy1 button 5 Joy1 button 8 (two buttons at once)

Then I go into Player 1 Controls and change:
P1 button 1 to Joy1 button 0
P1 button 2 to Joy1 button 1
P1 button 3 to Joy1 button 2
P1 button 4 to Joy1 button 3
P1 button 5 to Joy1 button 4
P1 button 6 to Joy1 button 5
P1 button 7 to Joy1 button 8

Then I go to Other Controls and change:
1 Player Start to Joy1 button 6
Coin 1 to 5 or Joy1 button 7

In Advanced Options Joystick Is on

I return to previous menu until I am offered to Save Configuration which I do. I have opened MAME in window mode so I can get to the cfig and ctrlr foleders (both with Read Only Disabled). ctrlr has 5 cfg files for different control panels at my best guess. cfg has '___empty.cfg' and 'default.cfg' and both contain the following code:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default" />
</mameconfig>

Only 'default.cfg' changes after saving my settings showing:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default">
        <input>
            <port type="P1_BUTTON1">
                <newseq type="standard">
                    JOYCODE_1_BUTTON1
                </newseq>
            </port>
            <port type="P1_BUTTON2">
                <newseq type="standard">
                    KEYCODE_LALT OR JOYCODE_1_BUTTON2 OR MOUSECODE_1_BUTTON3 OR GUNCODE_1_BUTTON2 OR JOYCODE_1_BUTTON2
                </newseq>
            </port>
            <port type="P1_BUTTON3">
                <newseq type="standard">
                    KEYCODE_SPACE OR JOYCODE_1_BUTTON3 OR MOUSECODE_1_BUTTON2 OR JOYCODE_1_XAXIS_RIGHT_SWITCH OR JOYCODE_1_BUTTON3
                </newseq>
            </port>
            <port type="P1_BUTTON4">
                <newseq type="standard">
                    KEYCODE_LSHIFT OR JOYCODE_1_BUTTON4 OR JOYCODE_1_BUTTON4
                </newseq>
            </port>
            <port type="P1_BUTTON5">
                <newseq type="standard">
                    KEYCODE_Z OR JOYCODE_1_BUTTON5 OR JOYCODE_1_BUTTON5
                </newseq>
            </port>
            <port type="P1_BUTTON6">
                <newseq type="standard">
                    KEYCODE_X OR JOYCODE_1_BUTTON6 OR JOYCODE_1_BUTTON6
                </newseq>
            </port>
            <port type="P1_BUTTON7">
                <newseq type="standard">
                    KEYCODE_C OR JOYCODE_1_BUTTON7 OR JOYCODE_1_BUTTON9
                </newseq>
            </port>
            <port type="START1">
                <newseq type="standard">
                    JOYCODE_1_BUTTON7
                </newseq>
            </port>
            <port type="COIN1">
                <newseq type="standard">
                    KEYCODE_5 OR JOYCODE_1_UNKNOWN_SWITCH OR JOYCODE_1_BUTTON8
                </newseq>
            </port>
            <port type="UI_SELECT">
                <newseq type="standard">
                    JOYCODE_1_BUTTON4
                </newseq>
            </port>
            <port type="UI_CANCEL">
                <newseq type="standard">
                    KEYCODE_ESC OR JOYCODE_1_BUTTON6 JOYCODE_1_BUTTON9
                </newseq>
            </port>
        </input>
    </system>
</mameconfig>


So I open a rom (Aliens World set 1) and everything works fine until I use my ESC combo of button and I am presented with the 'caught unhandled st11logic_error exception: basic_string::_M_construct null not valid' error which either locks up MAME and / or locks the mouse and keyboard from clearing the error which leave Ctrl+Alt+Del as the only option to quit. Then the 'default.cfg' reverts back to:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default" />
</mameconfig>

I am a member on another forum and have been advised to change the 'default.cfg' to 'read only' after my settings have been inputted to see if that works, which I will and report back here with results.

I have AIDA64 Extreme installed on both my everyday windows 10 PC and my Arcade Project Win XP PC so If anyone thinks its a hardware issue let me know and I can post full reports on both machines.

I really hope this helps someone with more knowledge regarding programming than myself to fix the issue, as stated before, I have been working and saving to make my cabinet and this really knocked the wind out of my sails.

Cheers

Tafoid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 238
  • Last login:February 12, 2025, 04:47:22 am
  • Emulation Devotee
    • MAMELOAD TNG (Front-End)
Re: MAME not saving joystick mapping
« Reply #3 on: November 26, 2016, 01:44:24 am »
GLADLY!!

Ok, so I have replicated this error on two 32bit PC's, one running XP Pro SP3 and the other Windows 10 Pro. In MAME 0177 with my arcade panel connected via USB with a Zero Delay encoder I enter 'Configure Options' then 'General Inputs/User Interface and change:
UI Select to Joy1 button 3
UI Cancel to ESC or Joy1 button 5 Joy1 button 8 (two buttons at once)

Then I go into Player 1 Controls and change:
P1 button 1 to Joy1 button 0
P1 button 2 to Joy1 button 1
P1 button 3 to Joy1 button 2
P1 button 4 to Joy1 button 3
P1 button 5 to Joy1 button 4
P1 button 6 to Joy1 button 5
P1 button 7 to Joy1 button 8

Then I go to Other Controls and change:
1 Player Start to Joy1 button 6
Coin 1 to 5 or Joy1 button 7

In Advanced Options Joystick Is on

I return to previous menu until I am offered to Save Configuration which I do. I have opened MAME in window mode so I can get to the cfig and ctrlr foleders (both with Read Only Disabled). ctrlr has 5 cfg files for different control panels at my best guess. cfg has '___empty.cfg' and 'default.cfg' and both contain the following code:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default" />
</mameconfig>

Only 'default.cfg' changes after saving my settings showing:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default">
        <input>
            <port type="P1_BUTTON1">
                <newseq type="standard">
                    JOYCODE_1_BUTTON1
                </newseq>
            </port>
            <port type="P1_BUTTON2">
                <newseq type="standard">
                    KEYCODE_LALT OR JOYCODE_1_BUTTON2 OR MOUSECODE_1_BUTTON3 OR GUNCODE_1_BUTTON2 OR JOYCODE_1_BUTTON2
                </newseq>
            </port>
            <port type="P1_BUTTON3">
                <newseq type="standard">
                    KEYCODE_SPACE OR JOYCODE_1_BUTTON3 OR MOUSECODE_1_BUTTON2 OR JOYCODE_1_XAXIS_RIGHT_SWITCH OR JOYCODE_1_BUTTON3
                </newseq>
            </port>
            <port type="P1_BUTTON4">
                <newseq type="standard">
                    KEYCODE_LSHIFT OR JOYCODE_1_BUTTON4 OR JOYCODE_1_BUTTON4
                </newseq>
            </port>
            <port type="P1_BUTTON5">
                <newseq type="standard">
                    KEYCODE_Z OR JOYCODE_1_BUTTON5 OR JOYCODE_1_BUTTON5
                </newseq>
            </port>
            <port type="P1_BUTTON6">
                <newseq type="standard">
                    KEYCODE_X OR JOYCODE_1_BUTTON6 OR JOYCODE_1_BUTTON6
                </newseq>
            </port>
            <port type="P1_BUTTON7">
                <newseq type="standard">
                    KEYCODE_C OR JOYCODE_1_BUTTON7 OR JOYCODE_1_BUTTON9
                </newseq>
            </port>
            <port type="START1">
                <newseq type="standard">
                    JOYCODE_1_BUTTON7
                </newseq>
            </port>
            <port type="COIN1">
                <newseq type="standard">
                    KEYCODE_5 OR JOYCODE_1_UNKNOWN_SWITCH OR JOYCODE_1_BUTTON8
                </newseq>
            </port>
            <port type="UI_SELECT">
                <newseq type="standard">
                    JOYCODE_1_BUTTON4
                </newseq>
            </port>
            <port type="UI_CANCEL">
                <newseq type="standard">
                    KEYCODE_ESC OR JOYCODE_1_BUTTON6 JOYCODE_1_BUTTON9
                </newseq>
            </port>
        </input>
    </system>
</mameconfig>


So I open a rom (Aliens World set 1) and everything works fine until I use my ESC combo of button and I am presented with the 'caught unhandled st11logic_error exception: basic_string::_M_construct null not valid' error which either locks up MAME and / or locks the mouse and keyboard from clearing the error which leave Ctrl+Alt+Del as the only option to quit. Then the 'default.cfg' reverts back to:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default" />
</mameconfig>

I am a member on another forum and have been advised to change the 'default.cfg' to 'read only' after my settings have been inputted to see if that works, which I will and report back here with results.

I have AIDA64 Extreme installed on both my everyday windows 10 PC and my Arcade Project Win XP PC so If anyone thinks its a hardware issue let me know and I can post full reports on both machines.

I really hope this helps someone with more knowledge regarding programming than myself to fix the issue, as stated before, I have been working and saving to make my cabinet and this really knocked the wind out of my sails.

Cheers

Some headway..
https://github.com/mamedev/mame/issues/1778

Try taking out whatever produced the "JOYCODE_1_UNKNOWN_SWITCH" for your COIN1 mapping and see if that doesn't crash.  As it stand there is supposedly some safeguard now in source which will stop the crashing at least - but the detection of the UNKNOWN stuff is hard to track down when you don't have a controller that can replicate it.


Tetsuo1981

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 12
  • Last login:July 20, 2017, 02:33:04 pm
  • I want to build my own arcade machine!!
Re: MAME not saving joystick mapping
« Reply #4 on: November 26, 2016, 04:25:03 am »
That's great news that others have found the problem and can replicate it, I thought I was going mad and when googling the error message found very little about it. I will be honest, heading the github link provided tied my head in knots (my only coding experience was basic HTML back in 2001 at uni) but I will have a look and see what happens if I change coin 1.

I managed to successfully configure my joystick as above on my windows 10 PC with MAME 0179 using 0178 ROMS and CHDs by opening MAME in a window (after adding '-w' to a shortcut of the .exe) and as soon as the cfg had my mappings in it I changed it to 'read ' only in windows properties. It took me a couple of goes together it to stick (probably down to myself) but it held my config settings after repeated closing and opening of MAME and a couple.of computer reboots. Whether this is a permanent fix or not remains to be seen, and whether It works on my XP Arcade computer remain to be seen but I'll post back here with any findings.

Cheers

Tetsuo1981

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 12
  • Last login:July 20, 2017, 02:33:04 pm
  • I want to build my own arcade machine!!
Re: MAME not saving joystick mapping
« Reply #5 on: November 26, 2016, 04:47:30 am »
@Tafoid

In theory I could just open the cfg file and delete

'OR JOYCODE_1_UNKNOWN_SWITCH'

So coin 1 reads as

'KEYCODE_5 OR JOYCODE_1_BUTTON8'

And save it?

Tafoid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 238
  • Last login:February 12, 2025, 04:47:22 am
  • Emulation Devotee
    • MAMELOAD TNG (Front-End)
Re: MAME not saving joystick mapping
« Reply #6 on: November 26, 2016, 05:00:49 pm »
@Tafoid

In theory I could just open the cfg file and delete

'OR JOYCODE_1_UNKNOWN_SWITCH'

So coin 1 reads as

'KEYCODE_5 OR JOYCODE_1_BUTTON8'

And save it?

Presumably, yes - that should fix the issue of crashing on exit for you.  The underlining reason it is being injected into the code is unknown at the moment.

Tetsuo1981

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 12
  • Last login:July 20, 2017, 02:33:04 pm
  • I want to build my own arcade machine!!
Re: MAME not saving joystick mapping
« Reply #7 on: November 26, 2016, 08:36:42 pm »
@Tafoid

In theory I could just open the cfg file and delete

'OR JOYCODE_1_UNKNOWN_SWITCH'

So coin 1 reads as

'KEYCODE_5 OR JOYCODE_1_BUTTON8'

And save it?

Presumably, yes - that should fix the issue of crashing on exit for you.  The underlining reason it is being injected into the code is unknown at the moment.

Thanks for the reply and your help. I'm in the process of moving my complete 0178 set from my main PC to my Arcade PC and will report back any issues setting up and saving my settings. Touch wood all the preliminary testing i have done using your advice has not led to any crashes since so hopefully it is a stable fix. As I said before my coding knowledge is practically nonexistent so I greatly appreciate your input and everyone else's input to looking for errors and rectifying them. I shared the github link you provided on another forum I am a member of to highlight the issue for anyone else having the same problem to show it is being looked at. Again, thanks for the help. Its made me able to get the enthusiasm to keep plugging on with my build.

Cheers