Core/Misc: Fix some static analysis issues

Fix some static analysis issues about:
- uninitialized values, most of which are false positives, always initialized before being accessed
- unchecked return values
- dead code never executed
- bad formatting leading to wrong behavior

Please ensure EventMap is never used with event id set to 0 or those events will never execute.