IANAL, but AFAIK it's absolutely not illegal in California; what's illegal is preventing you from working for a competitor AFTER you quit.
I've never had a salary employment contract in California that DIDN'T say they owned everything I did in my off time, at least if I was working on something in a similar domain. The best contracts explicitly state that I can get an exemption, or that I can work on unrelated projects, but all have the clause.
If it's illegal, a lot of companies are breaking the law.
RTFM here:
http://www.leginfo.ca.gov/cgi-bin/displaycode?section=lab&gr...
Seems pretty clear on the "similar business" front. IIRC that's been the wording in many if not most of the contracts I signed while I was still working as an employee in CA.
I've mostly worked in games, too, and so that pretty much meant "no game dev in my free time," period. A strong motivator to go indie/consulting.
I work in games. If I do something in my free time that's game-related, it's arguably related to the work my company does.
So I quit and started contracting. Now I own what I work on when I'm on my own time.
And if you get caught using any of employers code like Sergey Aleynikov you are SOL