Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
BletchMAME 1.0 has been released #115826 09/07/19 02:03 PM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
Now that MAME 0.213 is out, it is time for BletchMAME to go 1.0:

http://bletchmame.s3-website-us-east-1.amazonaws.com/

Re: BletchMAME 1.0 has been released [Re: Bletch] #115901 09/11/19 11:24 PM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
I'm trying to compile BletchMAME on the Mac. I've installed wxWidgets from Brew, and the first few files go well, but then...

Code
src/dialogs/inputs.cpp:146:75: warning: 'GetInputSeqRefs' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs();
                                                                                        ^
src/dialogs/inputs.cpp:113:75: note: overridden virtual function is here
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs() = 0;
                                                                                        ^
src/dialogs/inputs.cpp:165:75: warning: 'GetInputSeqRefs' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs();
                                                                                        ^
src/dialogs/inputs.cpp:113:75: note: overridden virtual function is here
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs() = 0;

/usr/bin/../include/c++/v1/__hash_table:868:5: error: 
      static_assert failed due to requirement 'integral_constant<bool, false>::value' "the specified hash does not meet the Hash requirements"
    static_assert(__check_hash_requirements<_Key, _Hash>::value,
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/bin/../include/c++/v1/__hash_table:883:1: note: 
      in instantiation of template class 'std::__1::__enforce_unordered_container_requirements<wxString, std::__1::hash<wxString>,
      std::__1::equal_to<wxString> >' requested here
typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type

/usr/bin/../include/c++/v1/unordered_map:856:26: note: 
      while substituting explicitly-specified template arguments into function template '__diagnose_unordered_container_requirements'
    static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
                         ^
src/dialogs/inputs.cpp:214:43: note: in instantiation of template class 'std::__1::unordered_map<wxString, wxString, std::__1::hash<wxString>,
      std::__1::equal_to<wxString>, std::__1::allocator<std::__1::pair<const wxString, wxString> > >' requested here
                std::unordered_map<wxString, wxString>          m_codes;                                                         ^


There are a series of follow-on errors in inputs.cpp that seem to be caused by that.

I get worse errors on Linux actually, but we'll make Clang happy first and see if that helps there.

Re: BletchMAME 1.0 has been released [Re: Bletch] #115911 09/13/19 10:18 AM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
While it is not an overall surprised that you're getting compilation errors with clang (I've been using GCC and MSVC, and running into warnings that in practice only happen with certain compilers is par the course), those particular problems seem odd, as I see "override" declarations there:

https://github.com/npwoods/bletchmame/blob/master/src/dialogs/inputs.cpp#L146
https://github.com/npwoods/bletchmame/blob/master/src/dialogs/inputs.cpp#L165

Re: BletchMAME 1.0 has been released [Re: Bletch] #115913 09/13/19 12:55 PM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
I'm more concerned about the invalid hash error than the override warnings right now smile

Re: BletchMAME 1.0 has been released [Re: Bletch] #115914 09/13/19 01:31 PM
Joined: Jun 2001
Posts: 414
O
Olivier Galibert Online Content
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 414
I don't see an override at line 162 on your link.

Re: BletchMAME 1.0 has been released [Re: Bletch] #115917 09/14/19 12:06 PM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
Good call OG, I added a few overrides. I tried to make that particular warning fail the compilation, but that caused some problems with the wxWidgets headers.

I don't know what to make of the hash problem, other than the fact that I don't see that problem on Windows. wxString derives from std::basic_string, which I would (perhaps naively) expect to just work with std::hash.

Re: BletchMAME 1.0 has been released [Re: Bletch] #115918 09/14/19 01:22 PM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
wxString doesn't derive from std::string on UTF-8 native systems (anything non-Windows, basically) so it's incompatible with std::hash.

Re: BletchMAME 1.0 has been released [Re: Bletch] #115920 09/15/19 01:24 PM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
Ugh; I'm pretty dependent on wxString being usable in C++ data structures... what to do :-|

Re: BletchMAME 1.0 has been released [Re: Bletch] #115931 09/16/19 04:19 AM
Joined: Jun 2001
Posts: 414
O
Olivier Galibert Online Content
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 414
Add a specialization of std::hash of wxString. That's reasonably simple. Here's what I used for QString:
Code
 namespace std {
 template<> struct hash<QString> {
     std::size_t operator()(const QString &s) const {
         return qHash(s);
     }
 };
 }

Re: BletchMAME 1.0 has been released [Re: Olivier Galibert] #115934 09/17/19 12:42 PM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
Hmmm I think I know why I don't have this problem. There is a define wxUSE_STD_STRING that seems to be 1 for me, and probably not for you.

Particularly odd is this code from wx/string.h:
Code
// Don't do this if ToStdWstring() is not available. We could work around it
// but, presumably, if using std::wstring is undesirable, then so is using
// std::hash<> anyhow.
#if wxUSE_STD_STRING

#include <functional>

namespace std
{
    template<>
    struct hash<wxString>
    {
        size_t operator()(const wxString& s) const
        {
            return std::hash<std::wstring>()(s.ToStdWstring());
        }
    };
} // namespace std

#endif // wxUSE_STD_STRING

This looks like laziness on the part of the wxWidgets developers to me. Hash functions are easy to write.

In any case, I tried adding template specializations that only kick in when wxUSE_STD_STRING is off.

Re: BletchMAME 1.0 has been released [Re: Bletch] #115935 09/17/19 01:27 PM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
Ok, I'll pull latest and give it another shot.

Re: BletchMAME 1.0 has been released [Re: R. Belmont] #115936 09/17/19 02:05 PM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
Googling around further, it sounds like if wxUSE_STD_STRING is off, then wxString doesn't derive from std::basic_string at all. I'm pretty dependent on that, and if that is indeed the case I suspect you may have bigger problems.

Re: BletchMAME 1.0 has been released [Re: Bletch] #116019 09/27/19 02:59 PM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
Would it be possible to have them be std::basic_strings in BletchMAME and convert when passing to/from wx? Otherwise you might as well have written it in MFC as far as portability goes.

Re: BletchMAME 1.0 has been released [Re: Bletch] #116022 09/27/19 05:38 PM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
I suppose it would be possible, but it would definitely be biggish surgery. The find and replace would be straight forward, but would then need to be followed up with explicit conversions between std::string (or a std::basic_string derivative) any time something comes in or out of wxWidgets.

I've got a potentially naive question - is it really that difficult to compile wxWidgets with wxUSE_STD_STRING=1 on Mac? Searching around I don't see anything explicitly saying that you can't.

On an amusing note, the last search result for wxUSE_STD_STRING on Google is this thread.

Re: BletchMAME 1.0 has been released [Re: Bletch] #116023 09/28/19 12:50 AM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
Plot twist: wxUSE_STD_STRING *is* defined on the Mac and Linux, the reference to it not being defined was from wx 2.x. But yet the "bad hash" error and the lack of cbegin()/cend() still happens.

Re: BletchMAME 1.0 has been released [Re: Bletch] #116026 09/28/19 10:57 AM
Joined: Nov 1999
Posts: 657
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 657
That is extremely strange.

I'm assuming that when you say it is defined, you do not mean defined as in:
Code
#define wxUSE_STD_STRING 0

Re: BletchMAME 1.0 has been released [Re: Bletch] #116027 09/28/19 02:14 PM
Joined: Mar 2001
Posts: 16,336
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,336
Right. /usr/local/lib/wx/include/osx_cocoa-unicode-3.0/setup.h has the settings for the Mac build I'm using (from Brew) and it has #define wxUSE_STD_STRING 1.

Putting an #error inside the #ifdef wxUSE_STD_STRING block in string.h does trigger as well.

Last edited by R. Belmont; 09/28/19 02:23 PM.
Page 1 of 2 1 2

Who's Online Now
6 registered members (R. Belmont, Reznor007, Olivier Galibert, ICEknight, 2 invisible), 145 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,693
Posts114,269
Members4,865
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3