Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error reporting and general output #2694

Merged
merged 6 commits into from Jan 28, 2014

Conversation

robn
Copy link
Member

@robn robn commented Jan 28, 2014

This does a few things to try and improve game output and error reporting. Almost certainly not the last word, but its surely a step in the right direction.

  • OS::Warning and OS::Error moved to utils.cpp, renamed Warning and Error, and reimplemented to use SDL_ShowSimpleMessageBox. It looks like this:

Win32 (via Wine):

screenshot - 280114 - 21 06 43

Linux:

screenshot - 280114 - 21 07 21

Output also goes to the output channel for easy copying. The nice thing about this is that it doesn't require that we have any screen stuff, GL context, anything set up. So we always have a way to tell the user what happened.

  • Always exit gracefully on Error(), since abort() causes an ugly runtime exception on Windows.
  • All printf(...) and fprintf(stderr, ...) replaced by a function Output(). Currently it just throws stuff on stderr (or to the logfile if enabled). This way there's no odd mix of output to stdout or stderr, and we can do other things later (like all output to in-game console)
  • If RedirectStdio is enabled (as it is by default on Window), output now goes to a single output.txt instead of the old stdout.txt and stderr.txt. Again, easier for problem reporting.
  • Since nothing now uses them, Gui::Screen::ShowBadError and Gui::MainLoopIteration are gone. No more redscreen!

@fluffyfreak
Copy link
Contributor

Looked through the code and it all looks good. Definitely a change for the better.
I'm just compiling to test on my laptop (my work PC is taking an hour to load a level!!!) but if it all goes ok I'll merge it at lunchtime unless there's any objections or problems.

@fluffyfreak
Copy link
Contributor

Actually that all checked out just fine. Much nicer, forced an error by modifying the MainMenu.lua to have no ship specified and up popped a nice dialog.

@robn
Copy link
Member Author

robn commented Jan 28, 2014

Yeah, I tested by breaking a shader. Thanks man!

@robn
Copy link
Member Author

robn commented Jan 28, 2014

Oh, you know that, because screenshots. Duh.

@robn
Copy link
Member Author

robn commented Jan 28, 2014

Since you like it, I'll merge it myself so I can get it into tonight's build.

@robn robn merged commit 60df331 into pioneerspacesim:master Jan 28, 2014
@robn robn deleted the errors-and-output branch January 28, 2014 11:40
@fluffyfreak
Copy link
Contributor

Woot, saved me a lunchtime job ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants