added lua support for ubuntu#969
Conversation
|
how's that different from the existing lua engine support? (i never used it, so i dont know how it works) |
|
@rofl0r the problem is that there is no lua engine support if you build desmume for linux. You click on "Tools" and you can just see "View Layers". I needed a way to run a Lua script |
|
sounds like a great idea. I'm happy using this code for my personal use in the meantime |
do i read this correctly as "take it or leave it, i don't intend to do the work for proper integration" ? if so i can close this. |
|
It's a skill issue I'm not really familiar with the codebase. To me, it seemed like there's a windows folder for building windows and a posix folder that can be used for building linux. Mixing them didn't seem like a good idea because I don't want to break windows accidentally. I don't know where I would put the extracted code that both of them would use. I'm sure somebody else could refactor it correctly I might look into it in a week when I have more free time |
|
it's a similar problem to the addition of the import/export battery save (.sav) option that was added recently. b1ffe0a . basically you need to look at what the windows code does when the item in the menu is clicked (grepping for the text displayed in the menu gets you halfways there) and then do the same thing in the GTK port(s). not rocket science. if you have access to a LLM like copilot, you can even ask it to find the exact code for you. |
|
There's been a misunderstanding. I thought you wanted me to refactor both windows and posix code so it reuses the same code on building. I already did copy and paste most of it from windows. Did you want me to change the label to "New Lua Script Window"? |
|
ok. so you use the same backend code as the windows UI already. great. so what's left to do is make everything behave exactly like in the windows version. if the menu item in windows is called X, then it must be called X too in linux. if it opens a window, we need to do the same. if the window has 2 buttons Y and Z, then the linux port must have it to. also the internal naming should be consistent. if the windows callback function when clicking on the menuitem is called "CreateLuaWindow", then it would be inconsistent to call it "addluascript" in GTK (i didnt read the windows code and dont know precisely how it's called there, just making a name up to show the point). of course the second menuitem "Close All Script Windows" needs to be added as well and behave identical to the windows version. |
Screencast.from.2026-06-20.13-24-00.webm |
|
@rofl0r I owe you an apology. I completely misread everything you said in your second reply because I was in a call with someone. |
|
can you provide a link to the lua script you're using? |
|
I am using this lua script for connecting platinum kaizo to this webpage. I think it's easier to find another lua script for a game that you already have. |
|
thanks for adding the gtk2 code.
i'm using my own distro https://github.com/sabotage-linux/sabotage/ and build everything from source. not every linux uses apt and binary packages. i just spent the day backporting a now required feature to wireshark so i can keep using the gtk2 version and have a lean system that doesnt waste RAM by loading a different GUI toolkit for every program. i'll test your code in a bit and get back to you. maybe @thesourcehim wants to test the gtk3 version? |
I'll get to it in a couple of weeks when I return from vacation. |
|
@marko-kriskovic adding -rdynamic doesn't seem to be necessary for lua script support and pessimizes codegen. can you explain your use case for it? also the script you linked to requires elaborate setup, do you know of any other lua scripts for desmume that can be more easily tested? |
|
Im going work on lua support for macOS im assuming i could do something similar here to achieve the same thing? |
|
after playing with the vs-link lua script, I realized I had an error in the script. I fixed it, but I needed some lua symbols from .so in .dynsym. -rdynamic was an overkill. The exported symbols are the ones needed to run vs-link.so. UPDATE: |
how so? if lua is statically linked to desmume (i.e. liblua.a is linked, not liblua.so). does ubuntu not ship static lua? IIRC the authors from PUC Rio themselves recommend linking lua statically. having the symbols exported should only be necessary if you dlopen() some external .so, but opening a lua script with the already-linked lua should not require it.
thanks. |


adds "Tools -> Lua Scripts -> Add new script" when building on linux (tested only on ubuntu)
Lua 5.1 (the language) is required for the functionality to work, but isn't provided in this PR. The user will have to install it manually. I built lua 5.1.5 from source
Tested on only one lua script (the one that I needed for my game)
Not tested if this breaks lua on windows