Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
0.213 arcade OSX Popeye audio bug #115812 09/06/19 05:17 PM
Joined: Jan 2007
Posts: 184
M
MacBox360 Offline OP
Senior Member
OP Offline
Senior Member
M
Joined: Jan 2007
Posts: 184
I compiled the newly released 0.213 SDLmame (arcade games only, subtarget=arcade in configuration file) and it crashes on Popeye Rev.D with this error

Code
Driver popeye (file popeye.cpp): 1 errors, 0 warnings
Errors:
   Netlist Sound Device device 'snd_nl': netlist FATAL: Invalid number conversion ACCURACY : 1,000000000e-05
   

Driver popeyeb3 (file popeye.cpp): 1 errors, 0 warnings
Errors:
   Netlist Sound Device device 'snd_nl': netlist FATAL: Invalid number conversion ACCURACY : 1,000000000e-05
   

Driver popeyef (file popeye.cpp): 1 errors, 0 warnings
Errors:
   Netlist Sound Device device 'snd_nl': netlist FATAL: Invalid number conversion ACCURACY : 1,000000000e-05
   

Driver popeyehs (file popeye.cpp): 1 errors, 0 warnings
Errors:
   Netlist Sound Device device 'snd_nl': netlist FATAL: Invalid number conversion ACCURACY : 1,000000000e-05
   

Driver popeyeu (file popeye.cpp): 1 errors, 0 warnings
Errors:
   Netlist Sound Device device 'snd_nl': netlist FATAL: Invalid number conversion ACCURACY : 1,000000000e-05
   

Fatal error: netlist FATAL: Invalid number conversion ACCURACY : 1,000000000e-05

logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.



This does not occour on Popeye clones, only the parent one and it was present also in 0.212 release too. The host machine is a MacPro 2010 with dual Xeon 2.40 GHz and Mojave OS 10.14.6, latest Xcode and SDL installed.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115814 09/06/19 05:51 PM
Joined: Feb 2004
Posts: 2,061
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,061
Eugh, that's that bizarre netlist number conversion code. It was happening to lots of people on all netlist drivers at one point, but seemed to be hacked up enough to work most of the time. I still don't like the way the code is written. What are your locale settings?

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115815 09/06/19 06:11 PM
Joined: Jan 2007
Posts: 184
M
MacBox360 Offline OP
Senior Member
OP Offline
Senior Member
M
Joined: Jan 2007
Posts: 184
If I correctly understand your question I think you are referring to Preferences panel of OSX where the decimal numbers syntax is set, if so here are my settings (I hope to translate it correctly)

Numeric spacer - Groups (dot) Decimals (comma)
Money value (euro) - Group (dot) Decimals (comma)
Measure Unit: Metric

If you need other infos I will be happy to answer.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115863 09/09/19 07:46 PM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
Can you please post the output of "locale" in your terminal, e.g.

Code
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=


That will hopefully allow me to replicate the issue.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115867 09/09/19 10:46 PM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
Seems something is going wrong on OSX build - not netlist related.
If I understand the c++ documentation right, the use of localization is not enabled by default in c++ programs.
c++ programs explicitly have to call setlocale(LC_ALL, "") to enable localization.

In machine.cpp I placed a line which prints the current locale:

Code
	m_ui = manager().create_ui(*this);
	printf("Locale post  %s", std::setlocale(LC_ALL, NULL));


On linux this reports the "C" locale - even if a local locale is set, e.g.

Code
export LC_ALL=de_DE.utf8


On OSX however, it reports the local locale set by

Code
export LC_ALL=de_DE.UTF-8


i.e. "Locale post de_DE.UTF-8".

Consequently calls to vsnprintf (pfmt.cpp) use the local locale - and in this case "," instead of ".".

This means something somewhere is switching the locale on OSX. A grep for setlocale shows that some 3rd party libs are calling it but I don't have the time to further dig into it now.
Linux is behaving correctly here - all based on my understanding of the c++ locale docs I know.

Long term netlist - as a library - must be made immune against locale switches in calling programs. I can fix the exception in netlist. But there is an issue with one of the 3rd party libraries MAME uses in the first place.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115869 09/10/19 01:44 AM
Joined: Feb 2004
Posts: 2,061
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,061
You can't trust anything on cplusplus.com - the information there is various flavours of outdated, inaccurate and misleading. In any case, the netlist library shouldn't make an assumption about the global locale. It's supposed to be a library, so it shouldn't make assumptions about the hosting application. On macOS, the global locale is probably being set by the UI toolkit.

Re: 0.213 arcade OSX Popeye audio bug [Re: Vas Crabb] #115882 09/10/19 08:35 PM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
Originally Posted by Vas Crabb
You can't trust anything on cplusplus.com - the information there is various flavours of outdated, inaccurate and misleading.


You should raise this with Bjarne. It's mentioned as a resource here: https://isocpp.org/get-started

Originally Posted by Vas Crabb
In any case, the netlist library shouldn't make an assumption about the global locale. It's supposed to be a library, so it shouldn't make assumptions about the hosting application. On macOS, the global locale is probably being set by the UI toolkit.


That's a double standard. Netlist shouldn't make an assumption about the global locale. Fine. I fixed that. But it is ok that the UI toolkit not only makes assumptions about the global locale but forces it on the application? Somewhere during initialization? After other application resources have been intialized? I consider the use of such libraries dangerous. Anyhow, fixed.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115884 09/10/19 11:20 PM
Joined: Mar 2001
Posts: 16,300
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,300
The UI toolkit does have a vested interest in showing things correctly for your country and language and so on, so it's not surprising it does that.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115887 09/11/19 04:14 AM
Joined: Feb 2004
Posts: 2,061
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,061
The UI toolkit is designed to run as an IoC container - under normal circumstances, it is the main program. SDL somewhat subverts this, and MAME subverts it further by pumping events in the debugger (all this subversion is why some stuff doesn't work quite right in the debugger). Long-term, I want MAME to be more respectful of global locale/language settings in its own UI. The world doesn't all speak English and doesn't all use US conventions. Software should be able to deal with that by now. If you want a particular format for settings storage, logging, or something else, you shouldn't be using functions that depend on the global locale.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115890 09/11/19 08:01 AM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
Thanks a lot for the comments. Understood.

Currently on *nix we run MAME with the standard "C" locale and on OSX we run MAME with the system locale.
Shouldn't we have a common approach here? Should be as simple as inserting

Code
setlocale(LC_ALL,"");


and switching the standard io streams. The ui could get the language as well from the locale. That should work on Windows/mingw as well.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115891 09/11/19 01:38 PM
Joined: Mar 2001
Posts: 16,300
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,300
I think we shouldn't change the system locale at all and instead should find some other way to convert between strings and floats.

I have a plan in the back of my head to convert the Mac version to native Cocoa all the way (Vas's work on CoreAudio helps with a chunk of that) but that's relatively time-consuming.

Re: 0.213 arcade OSX Popeye audio bug [Re: R. Belmont] #115898 09/11/19 07:15 PM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
Originally Posted by R. Belmont
I think we shouldn't change the system locale at all and instead should find some other way to convert between strings and floats..


OK, I'll leave it to Vas and you to sort this out.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115900 09/11/19 08:03 PM
Joined: Mar 2001
Posts: 16,300
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,300
For string to float/double, atof_l() lets you specify a locale for the conversion without changing the system locale, but it might not be available on Linux. (It is on Windows, Mac, and other BSD-derived systems). Continuing research.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115902 09/12/19 04:15 AM
Joined: Feb 2004
Posts: 2,061
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,061
You can use a std::istream and call imbue.

Re: 0.213 arcade OSX Popeye audio bug [Re: Vas Crabb] #115912 09/13/19 10:18 AM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
Originally Posted by Vas Crabb
You can use a std::istream and call imbue.


I am using this approach now in netlist. Also removing all c library stuff and moving to c++ library.

Another detail on the UI toolkit: The toolkit only changes the C library locale (setlocale). The c++ locale reports "C" on a call to locale().
So c++ functions use the "C" locale and c functions (stod and friends, printf ...) use the system locale when running on OSX.

Re: 0.213 arcade OSX Popeye audio bug [Re: couriersud] #115933 09/16/19 12:36 PM
Joined: Jan 2007
Posts: 184
M
MacBox360 Offline OP
Senior Member
OP Offline
Senior Member
M
Joined: Jan 2007
Posts: 184
Sorry for the delay, I was on holiday. Here is my locale configuration, the same I used for build latest 0.213 SDLmame:

Code
LANG="it_IT.UTF-8"
LC_COLLATE="it_IT.UTF-8"
LC_CTYPE="it_IT.UTF-8"
LC_MESSAGES="it_IT.UTF-8"
LC_MONETARY="it_IT.UTF-8"
LC_NUMERIC="it_IT.UTF-8"
LC_TIME="it_IT.UTF-8"
LC_ALL=


Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115937 09/17/19 06:21 PM
Joined: Feb 2007
Posts: 473
C
couriersud Offline
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 473
The issue should be fixed now.

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115938 09/17/19 07:13 PM
Joined: Mar 2001
Posts: 16,300
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,300
Great, thanks couriersud!

Re: 0.213 arcade OSX Popeye audio bug [Re: MacBox360] #115939 09/17/19 07:54 PM
Joined: Jan 2007
Posts: 184
M
MacBox360 Offline OP
Senior Member
OP Offline
Senior Member
M
Joined: Jan 2007
Posts: 184
Just compiled the GitHub snapshot, I confirm the issue is gone. Thank you very much! :-)

Last edited by MacBox360; 09/17/19 07:54 PM.
Page 1 of 2 1 2

Moderated by  R. Belmont 

Who's Online Now
1 registered members (rfka01), 159 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,683
Posts114,012
Members4,863
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3