equal
deleted
inserted
replaced
4 #include <QLibrary> |
4 #include <QLibrary> |
5 #include <QOpenGLFunctions> |
5 #include <QOpenGLFunctions> |
6 #include <QSurface> |
6 #include <QSurface> |
7 |
7 |
8 static QOpenGLContext* currentOpenglContext = nullptr; |
8 static QOpenGLContext* currentOpenglContext = nullptr; |
9 extern "C" void (*getProcAddress(const char* fn))() { |
9 extern "C" void* getProcAddress(const char* fn) { |
10 if (!currentOpenglContext) |
10 if (!currentOpenglContext) |
11 return nullptr; |
11 return nullptr; |
12 else |
12 else |
13 return currentOpenglContext->getProcAddress(fn); |
13 return reinterpret_cast<void*>(currentOpenglContext->getProcAddress(fn)); |
14 } |
14 } |
15 |
15 |
16 EngineInstance::EngineInstance(const QString& libraryPath, const QString&dataPath, QObject* parent) |
16 EngineInstance::EngineInstance(const QString& libraryPath, const QString&dataPath, QObject* parent) |
17 : QObject(parent), m_instance{nullptr, nullptr} { |
17 : QObject(parent), m_instance{nullptr, nullptr} { |
18 QLibrary hwlib(libraryPath); |
18 QLibrary hwlib(libraryPath); |
60 |
60 |
61 if (isValid()) { |
61 if (isValid()) { |
62 qDebug() << "Loaded engine library with protocol version" |
62 qDebug() << "Loaded engine library with protocol version" |
63 << hedgewars_engine_protocol_version(); |
63 << hedgewars_engine_protocol_version(); |
64 |
64 |
65 m_instance = std::unique_ptr<Engine::EngineInstance, Engine::cleanup_t*>(start_engine(dataPath.toUtf8().data()), cleanup); |
65 m_instance = std::unique_ptr<Engine::EngineInstance, Engine::cleanup_t*>( |
|
66 start_engine(reinterpret_cast<const int8_t*>(dataPath.toUtf8().data())), |
|
67 cleanup); |
66 } else { |
68 } else { |
67 qDebug("Engine library load failed"); |
69 qDebug("Engine library load failed"); |
68 } |
70 } |
69 } |
71 } |
70 |
72 |