mirror of
https://github.com/Mylloon/obs-replay-folders.git
synced 2024-10-06 22:41:11 +02:00
yay
This commit is contained in:
parent
6d93ee7510
commit
a8fb7a21cb
5 changed files with 14 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -29,7 +29,6 @@ luac.out
|
|||
*.exp
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
obs = obslua
|
||||
|
||||
function script_description()
|
||||
return [[Saves replays to sub-folders using the Game Capture executable name.
|
||||
return [[Saves replays to sub-folders using the current fullscreen video game executable name.
|
||||
|
||||
Author: redraskal]]
|
||||
end
|
||||
|
||||
function script_load()
|
||||
ffi = require("ffi")
|
||||
ffi.cdef[[
|
||||
int get_running_fullscreen_game_path(char* buffer, int bufferSize)
|
||||
]]
|
||||
detect_game = ffi.load(script_path() .. "detect_game.dll")
|
||||
print(get_running_game_title())
|
||||
obs.obs_frontend_add_event_callback(obs_frontend_callback)
|
||||
folder = get_running_game_title()
|
||||
end
|
||||
|
||||
function obs_frontend_callback(event)
|
||||
if event == obs.OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED then
|
||||
folder = get_running_game_title()
|
||||
end
|
||||
if event == obs.OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED then
|
||||
local path = get_replay_buffer_output()
|
||||
local folder = get_running_game_title()
|
||||
if path ~= nil and folder ~= nil then
|
||||
print("Moving " .. path .. " to " .. folder)
|
||||
move(path, folder)
|
||||
|
@ -36,9 +39,12 @@ function get_replay_buffer_output()
|
|||
end
|
||||
|
||||
function get_running_game_title()
|
||||
local handle = assert(io.popen("detect_game"))
|
||||
local result = handle:read("*all")
|
||||
handle:close()
|
||||
local path = ffi.new("char[?]", 260)
|
||||
local result = detect_game.get_running_fullscreen_game_path(path, 260)
|
||||
if result ~= 0 then
|
||||
return nil
|
||||
end
|
||||
result = ffi.string(path)
|
||||
local len = #result
|
||||
if len == 0 then
|
||||
return nil
|
||||
|
@ -55,7 +61,6 @@ function get_running_game_title()
|
|||
end
|
||||
i = i + 1
|
||||
end
|
||||
print("Current running game: " .. title)
|
||||
return title
|
||||
end
|
||||
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
# obs-replay-folders
|
||||
|
||||
Saves replay buffer files to game-specific folders (like ShadowPlay).
|
||||
|
||||
## Important:
|
||||
|
||||
1. The script requires `detect_game.exe` to be added to PATH.
|
||||
2. To update the replay folder, restart the Replay Buffer.
|
||||
|
||||
There is no way to run an executable in Lua without breaking fullscreen application focus. So, the current running game will not automatically update.
|
||||
|
|
BIN
detect_game.dll
Normal file
BIN
detect_game.dll
Normal file
Binary file not shown.
BIN
detect_game.exe
BIN
detect_game.exe
Binary file not shown.
Loading…
Reference in a new issue