Open HarryMuscle opened 3 days ago
Portal 2 uses a newer branch of the engine and some of its interfaces are not backwards-compatible. Updating the plugin to support different incompatible interface versions would be a big change. I essentially wrote this project off when 64-bit TF2 got released so I don't feel like putting the effort in.
Instead, I threw together a script that does the same thing as this plugin. To use it, download the win32 lua_plugin binaries, install them as any other addon, and replace the contents of lua_plugin.lua
with what's below.
lua_plugin.lua
You have to edit the script to change which resolutions it adds. In-game, use mat_setvideomode width height 1
to change to one of those resolutions (or you can put it in your autoexec.cfg
).
When testing, I was not able to get above native resolution. It looks as if Portal clamped the resolution to native when switching, which is not something TF2 does. I'm not sure how to get around that.
Thanks for the quick answer. Unfortunately I'm having trouble getting the lua_plugin plugin to work with Portal 2. I created a new issue in that repo related to this:
The Lua script from the lua_plugin
release archive won't work with Portal 2 because of different interface versions. Did you replace it with the snippet from https://github.com/jooonior/SourceRes/issues/1#issuecomment-2373478611?
Yes, I also tried using the following basic example:
local Plugin = {}
function Plugin:Load()
print("Hello World!")
end
return Plugin
and I still get the same error message.
Just to make sure I have things configured correctly, I have the following 4 files
lua_plugin.dll
lua_plugin.lua
lua_plugin.vdf
lua51.dll
in the following folder
C:\Games\Steam\steamapps\common\Portal 2\portal2\addons
where C:\Games\Steam
is the folder I have Steam installed in.
That seems like it should work. Strange. Here's my addons folder: addons.zip. Can you try that?
I just tried your addon folder contents on two separate computers and both give me the exact same error (Unable to load plugin "addons/lua_plugin"
). I even tried resetting all my Portal 2 configuration options on one of the computers and I still can't get the plugin to load. Are you testing this on a development PC? Is there maybe another dll that is required that exists on your PC but not on a PC without dev tools installed?
The binaries are built with GitHub actions, not on my PC. Still, it's possible that it links to something you don't have. I'll check it out.
What happens when you delete the .lua
script? If you don't see this message, that means the problem is likely with the linker.
I just tried running Portal 2 with the .lua
script file deleted (but the other 3 files still in the addons
folder) and I do NOT get that message (I still only get the Unable to load plugin "addons/lua_plugin"
message).
Can you check if DLL imports are resolved correctly? Not sure what's the proper way to do this on Windows, but I found this https://github.com/lucasg/Dependencies. When I open lua_plugin.dll
in the GUI I get this:
There are some errors under kernel32, but since it works for me, those don't matter, I guess.
From https://github.com/jooonior/lua_plugin/issues/1#issue-2548954334:
In case it helps, I also tried version 1.1.0 and it gives the following error message
ICVar interface not found Unable to load plugin "addons/lua_plugin"
The ICVar interface not found
message is from the example Lua script, so it looks like v1.1.0 works. Can you try these:
I think we're getting somewhere. The missing dependencies are:
MSVCP140D.dll
VCRUNTIME140D.dll
ucrtbased.dll
however, if I'm not mistaken all of these are debug dependencies and not release dependencies (the release versions of these dependencies would not have a D
or d
at the end of their name). I think the lua_plugin might be getting build in debug mode and not release mode maybe?
From jooonior/lua_plugin#1 (comment):
In case it helps, I also tried version 1.1.0 and it gives the following error message
ICVar interface not found Unable to load plugin "addons/lua_plugin"
The
ICVar interface not found
message is from the example Lua script, so it looks like v1.1.0 works. Can you try these:1. Use v1.1.0 but delete the Lua script. You should get the message I talked about in [Does Not Work In Portal 2 #1 (comment)](https://github.com/jooonior/SourceRes/issues/1#issuecomment-2375257157). 2. Use v1.1.0 with the Lua script from [Does Not Work In Portal 2 #1 (comment)](https://github.com/jooonior/SourceRes/issues/1#issuecomment-2373478611).
You're right, version 1.1.0 works after I change the lua script (I guess I forgot to do that when I tested it originally). So it looks like the main issue is that version 1.2.0 was compiled in debug mode and not release mode.
however, if I'm not mistaken all of these are debug dependencies and not release dependencies (the release versions of these dependencies would not have a
D
ord
at the end of their name). I think the lua_plugin might be getting build in debug mode and not release mode maybe?
Yeah, you're right. In 1.2.0 I switched from Visual Studio projects to CMake. I guess CMAKE_BUILD_TYPE=Release
is not enough to link release libs. Oh well, I'll figure it out. TY for the help.
Also can you go above your native resolution? It didn't work for me. I was getting:
mat_setvideomode 3840 2160 1
Changing resolutions from (1920, 1080) -> (1920, 1080)
Also can you go above your native resolution? It didn't work for me. I was getting:
mat_setvideomode 3840 2160 1 Changing resolutions from (1920, 1080) -> (1920, 1080)
That's what I've been playing around with for the last little bit. I even replaced every single registered resolution with a resolution higher than native and it still won't go above the native resolution. So frustrating.
Not sure if it would work, but CRU lets you run resolutions that your monitor doesn't support. I use it with Looking Glass to get higher refresh rates than my dummy HDMI 1 display output allows. But you'd probably need two monitors, since the affected one won't make sense of the data its receiving.
Also I remember someone using virtual resolution or whatever it's called (render higher res and scale down, AMD drivers had that option at one time I think) to record 4k with 1080 monitor. You might be able to get something like that working too.
When trying to use this plugin with Portal 2 the plug fails to load and shows the following error message:
I believe this error message comes from line 22 in the SourceRes.cpp file.
Any chance this plugin can be made to work with Portal 2?