Route ODE messages into LOVR log system

ODE errors, debugs and messages are redirected into LOVR's log system
by a callback mechanism for each.

The ODE submodule is updated to revision that does not crash when error
or debug occurs.
This commit is contained in:
Josip Miskovic 2021-03-28 19:39:43 +02:00 committed by Bjorn
parent 0daaca7a4f
commit f6fbc2ad17
2 changed files with 22 additions and 1 deletions

2
deps/ode vendored

@ -1 +1 @@
Subproject commit 8bf3aa17d1283aa65bf55a39a13b82dcb5853aaf
Subproject commit e17fac33eee0c291d62fdd49a337837140a56116

View File

@ -39,11 +39,32 @@ static uint32_t findTag(World* world, const char* name) {
return NO_TAG;
}
static void onErrorMessage(int num, const char* format, va_list args) {
char message[1024];
vsnprintf(message, 1024, format, args);
lovrLog(LOG_ERROR, "PHY", message);
}
static void onDebugMessage(int num, const char* format, va_list args) {
char message[1024];
vsnprintf(message, 1024, format, args);
lovrLog(LOG_DEBUG, "PHY", message);
}
static void onInfoMessage(int num, const char* format, va_list args) {
char message[1024];
vsnprintf(message, 1024, format, args);
lovrLog(LOG_INFO, "PHY", message);
}
static bool initialized = false;
bool lovrPhysicsInit() {
if (initialized) return false;
dInitODE();
dSetErrorHandler(onErrorMessage);
dSetDebugHandler(onDebugMessage);
dSetMessageHandler(onInfoMessage);
return initialized = true;
}