decaf-emu / decaf-emu

Researching Wii U emulation.
GNU General Public License v3.0
1.25k stars 141 forks source link

Checking OSMutex::tag does not work in some games. #194

Closed brett19 closed 8 years ago

brett19 commented 8 years ago

Some games just willie-nillie use mutexes without initializing them.

brett19 commented 8 years ago

I think we should refactor all the tag-checks that use decaf_check(mutex && mutex->tag == OSMutex::Tag) to use something like coreinit_tag_check(mutex) with a definition in coreinit.h of #define coreinit_tag_check(obj) decaf_check(obj && obj->tag == decltype(obj)::Tag). This will allow us to have it off by default, but to enable it when debugging? On the other hand, if lots of games do this, perhaps we are better of just updating the OSMutex assertion such that tag == nullptr is alright (it is a structure that does not NEED to be initialized).

brett19 commented 8 years ago

This is already done. OSLockMutex now initializes the mutex if it was not already initialized. This is due to a common theme among games to reuse existing memory for new purposes without doing initialization for mutexes (but they do for most other things :/).