logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0005-Support-lua-5.4.patch (2137B)


  1. From ae44889fc30137f38b74cd0119fe7196c0a1b043 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Sun, 3 Dec 2023 11:57:01 -0800
  4. Subject: [PATCH] Support lua 5.4
  5. ---
  6. player/lua.c | 5 -----
  7. player/lua/osc.lua | 8 ++++----
  8. 2 files changed, 4 insertions(+), 9 deletions(-)
  9. diff --git a/player/lua.c b/player/lua.c
  10. index 63547694e2..0b8c632acd 100644
  11. --- a/player/lua.c
  12. +++ b/player/lua.c
  13. @@ -455,11 +455,6 @@ static int load_lua(struct mp_script_args *args)
  14. stats_register_thread_cputime(ctx->stats, "cpu");
  15. - if (LUA_VERSION_NUM != 501 && LUA_VERSION_NUM != 502) {
  16. - MP_FATAL(ctx, "Only Lua 5.1 and 5.2 are supported.\n");
  17. - goto error_out;
  18. - }
  19. -
  20. lua_State *L = ctx->state = luaL_newstate();
  21. if (!L) {
  22. MP_FATAL(ctx, "Could not initialize Lua.\n");
  23. diff --git a/player/lua/osc.lua b/player/lua/osc.lua
  24. index 3ba1890a92..945af861f0 100644
  25. --- a/player/lua/osc.lua
  26. +++ b/player/lua/osc.lua
  27. @@ -175,7 +175,7 @@ local margins_opts = {
  28. function get_virt_scale_factor()
  29. local w, h = mp.get_osd_size()
  30. if w <= 0 or h <= 0 then
  31. - return 0, 0
  32. + return 1, 1
  33. end
  34. return osc_param.playresx / w, osc_param.playresy / h
  35. end
  36. @@ -193,7 +193,7 @@ end
  37. function set_virt_mouse_area(x0, y0, x1, y1, name)
  38. local sx, sy = get_virt_scale_factor()
  39. - mp.set_mouse_area(x0 / sx, y0 / sy, x1 / sx, y1 / sy, name)
  40. + mp.set_mouse_area(x0 // sx, y0 // sy, x1 // sx, y1 // sy, name)
  41. end
  42. function scale_value(x0, x1, y0, y1, val)
  43. @@ -299,7 +299,7 @@ end
  44. -- multiplies two alpha values, formular can probably be improved
  45. function mult_alpha(alphaA, alphaB)
  46. - return 255 - (((1-(alphaA/255)) * (1-(alphaB/255))) * 255)
  47. + return alphaA + alphaB - alphaA * alphaB / 255
  48. end
  49. function add_area(name, x1, y1, x2, y2)
  50. @@ -318,7 +318,7 @@ function ass_append_alpha(ass, alpha, modifier)
  51. if state.animation then
  52. av = mult_alpha(av, state.animation)
  53. end
  54. - ar[ai] = av
  55. + ar[ai] = math.floor(av)
  56. end
  57. ass:append(string.format("{\\1a&H%X&\\2a&H%X&\\3a&H%X&\\4a&H%X&}",
  58. --
  59. 2.44.0