JohnEarnest / Octo

A Chip8 IDE
MIT License
679 stars 54 forks source link

Provide graceful fallback for flag registers if localStorage is unavailable #163

Closed Faffotron closed 2 years ago

Faffotron commented 2 years ago

Many browsers have introduced the option to block third-party cookies and localStorage use. This can cause use of flag registers to fail ungracefully, zeroing them out. This change performs a quick check at runtime to see if localStorage is available for the flag registers and if not will dummy out the functions that would attempt this access, allowing regular emulation to proceed without repeated error messages.

Tested working as expected in:

JohnEarnest commented 2 years ago

Nice and simple. Thanks for doing the groundwork for this fix, @Faffotron!