Major code change pushed

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Major code change pushed

Postby Bart » Sun Mar 26, 2017 8:30 pm

I sincerely apologize for any inconvenience my massive commit just now may cause. I've pushed the new config system. Not necessarily much better than the old one for now but I think it facilitates XML parsing better and could in the future be used for unit testing if Supermodel ever expands in scope. The API may be a little bit confusing; I can give a run-down if need-be but I don't think anyone has much need right now for adding config options at the moment.

Perhaps the most annoying change will be the presence of Config/Games.xml. Not all games have been listed in the XML. It'll be done over the next day or so.

C++11 is required. Eventually, I would also like to modernize the code base and get rid of my idiosyncratic C-like code. Some of the newly added code uses an inconsistent naming convention. I will eventually fix that to conform to the rest of Supermodel.

I hope this doesn't break your builds for too long but if you need any assistance, please let me know ASAP!
User avatar
Bart
Site Admin
 
Posts: 1995
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Major code change pushed

Postby Ian » Mon Mar 27, 2017 2:35 am

I've used c++ 11 in other parts of the code base >_< so it's been required for a while .. :)
Will probably be busy with work this week, and have no immediate code to push
Ian
 
Posts: 1120
Joined: Tue Feb 23, 2016 9:23 am

Re: Major code change pushed

Postby Spindizzi » Mon Mar 27, 2017 2:50 am

Hi,
Whaou, big internal changes
Can you explain why you have taken out the datas about the roms in an external xml file? Normally these datas are engraved in the marble and must not be changed by the users ?
Will config files be converted to xml also in the future (instead of .ini) ?
In the "oops" section, you've forgotten to remove the textures dump in Real3d destructor ;)
++
Spindizzi
 
Posts: 59
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: Major code change pushed

Postby Ian » Mon Mar 27, 2017 7:19 am

visual studio moans about ..

\model3 emutalor\code\src\util\genericvalue.h(32): error C2143: syntax error : missing ';' before 'const'
\model3 emutalor\code\src\util\genericvalue.h(33) : see reference to class template instantiation 'Util::detail::IntegerEncodableAsHex<T>' being compiled
\model3 emutalor\code\src\util\genericvalue.h(32): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\model3 emutalor\code\src\util\newconfig.h(136): warning C4520: 'Util::Config::Node::const_iterator' : multiple default constructors specified
Ian
 
Posts: 1120
Joined: Tue Feb 23, 2016 9:23 am

Re: Major code change pushed

Postby Spindizzi » Mon Mar 27, 2017 8:06 am

I personally don't integrate genericvalue.h to the project header, try to remove
and have you removed all old files related to config (deleted ones)
With VS2015, it's ok
Spindizzi
 
Posts: 59
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: Major code change pushed

Postby Bart » Mon Mar 27, 2017 8:41 am

Ian wrote:visual studio moans about ..

\model3 emutalor\code\src\util\genericvalue.h(32): error C2143: syntax error : missing ';' before 'const'
\model3 emutalor\code\src\util\genericvalue.h(33) : see reference to class template instantiation 'Util::detail::IntegerEncodableAsHex<T>' being compiled
\model3 emutalor\code\src\util\genericvalue.h(32): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\model3 emutalor\code\src\util\newconfig.h(136): warning C4520: 'Util::Config::Node::const_iterator' : multiple default constructors specified


Oh, crap. Which version of VS are you using? Pretty sure this is all valid C++11 code but my understanding is that C++11 support is spotty prior to VS2015. I'll have to dig into this. Unfortunately the whole config system relies on GenericValue. :/ I may be able to introduce a workaround for part of it though.
User avatar
Bart
Site Admin
 
Posts: 1995
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Major code change pushed

Postby Ian » Mon Mar 27, 2017 8:52 am

2013 professional ..
Seems a little, over engineered ? :)
Not even really sure what you are trying to do there. Checking at compile time if the type is large enough?

std::is_integral<T>::value

seems fine, so i am not even sure what the compiler is complaining about tbh
Ian
 
Posts: 1120
Joined: Tue Feb 23, 2016 9:23 am

Re: Major code change pushed

Postby Bart » Mon Mar 27, 2017 9:05 am

No, I'm checking for integral types that are not bytes. If you want to convert a string to an integer, ParseInteger() should be invoked, but *not* if you are converting to a byte (uint8_t, int8_t, unsigned char, char). The reason for this is simply that "char" is indistinguishable from "int8_t", and you don't want ValueAs<char>() to invoke an integer parser that converts an ASCII '9' to the number 9.

Let me see if it works without constexpr... That seems to be what Visual Studio is not supporting.

The code could also possibly be made to distinguish between the special case of "unsigned char/uint8_t" and "signed char/int8_t", with the latter being interpreted as ASCII and the former invoking an integer parser.
User avatar
Bart
Site Admin
 
Posts: 1995
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Major code change pushed

Postby Ian » Mon Mar 27, 2017 9:13 am

yeah it's the constexpr
saying it can't evaluate it at compile time
Ian
 
Posts: 1120
Joined: Tue Feb 23, 2016 9:23 am

Re: Major code change pushed

Postby Bart » Mon Mar 27, 2017 9:14 am

Ian wrote:yeah it's the constexpr
saying it can't evaluate it at compile time


Can you comment out the constexpr? It should still work. I just tried compiling here at work on Linux without the constexpr and it appears to be ok.

Code: Select all
static /*constexpr*/ const bool value = std::is_integral<T>::value && sizeof(T) >= 2 && sizeof(T) <= 8;
User avatar
Bart
Site Admin
 
Posts: 1995
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Next

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron