Advertisement
deathbeam

Untitled

Jul 22nd, 2022
1,388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.58 KB | None | 0 0
  1. diff --git a/src/main.cpp b/src/main.cpp
  2. index 3346ae4..cb2c83a 100644
  3. --- a/src/main.cpp
  4. +++ b/src/main.cpp
  5. @@ -500,7 +500,7 @@ static int l_LaunchSubScript(lua_State* L)
  6.          LAssert(L, lua_isstring(L, i), "LaunchSubScript() argument %d: expected string, got %t", i, i);
  7.      }
  8.      for (int i = 4; i <= n; i++) {
  9. -        LAssert(L, lua_isnil(L, i) || lua_isboolean(L, i) || lua_isnumber(L, i) || lua_isstring(L, i),
  10. +        LAssert(L, lua_isnil(L, i) || lua_isboolean(L, i) || lua_isnumber(L, i) || lua_isstring(L, i),
  11.                             "LaunchSubScript() argument %d: only nil, boolean, number and string types can be passed to sub script", i);
  12.      }
  13.      int slot = pobwindow->subScriptList.size();
  14. @@ -948,7 +948,7 @@ int main(int argc, char **argv)
  15.  
  16.      RegisterGeneralLuaCallbacks(L);
  17.  
  18. -    int result = luaL_dofile(L, "src/Launch.lua");
  19. +    int result = luaL_dofile(L, argv[1]);
  20.      if (result != 0) {
  21.          lua_error(L);
  22.      }
  23. @@ -963,6 +963,12 @@ int main(int argc, char **argv)
  24.      QFontDatabase::addApplicationFont("VeraMono.ttf");
  25.      QFontDatabase::addApplicationFont("LiberationSans-Regular.ttf");
  26.      QFontDatabase::addApplicationFont("LiberationSans-Bold.ttf");
  27. -    return app.exec();
  28. +    int out = app.exec();
  29. +    pushCallback("OnExit");
  30. +    result = lua_pcall(L, 1, 0, 0);
  31. +    if (result != 0) {
  32. +        lua_error(L);
  33. +    }
  34. +    return out;
  35.  }
  36.  
  37. diff --git a/src/pobwindow.cpp b/src/pobwindow.cpp
  38. index 9216b55..54b9419 100644
  39. --- a/src/pobwindow.cpp
  40. +++ b/src/pobwindow.cpp
  41. @@ -38,6 +38,27 @@ void pushMouseString(QMouseEvent *event) {
  42.  
  43.  bool pushKeyString(int keycode) {
  44.      switch (keycode) {
  45. +    case Qt::Key_F1:
  46. +        lua_pushstring(L, "F1");
  47. +        break;
  48. +    case Qt::Key_F2:
  49. +        lua_pushstring(L, "F2");
  50. +        break;
  51. +    case Qt::Key_F3:
  52. +        lua_pushstring(L, "F3");
  53. +        break;
  54. +    case Qt::Key_F4:
  55. +        lua_pushstring(L, "F4");
  56. +        break;
  57. +    case Qt::Key_F5:
  58. +        lua_pushstring(L, "F5");
  59. +        break;
  60. +    case Qt::Key_F6:
  61. +        lua_pushstring(L, "F6");
  62. +        break;
  63. +    case Qt::Key_Control:
  64. +        lua_pushstring(L, "CTRL");
  65. +        break;
  66.      case Qt::Key_Escape:
  67.          lua_pushstring(L, "ESCAPE");
  68.          break;
  69. @@ -327,7 +348,7 @@ QOpenGLTexture& POBWindow::GetTexture(TextureIndex index)
  70.  
  71.  bool POBWindow::RetrieveLoadedTextures()
  72.  {
  73. -   textureLoader.collect_loaded_textures(tmpLoadedTextures);
  74. +   textureLoader.collect_loaded_textures(tmpLoadedTextures);
  75.     if (tmpLoadedTextures.empty()) {
  76.         return false;
  77.     }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement