Skip to content

Commit a8fb7a2

Browse files
committed
yay
1 parent 6d93ee7 commit a8fb7a2

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ luac.out
2929
*.exp
3030

3131
# Shared objects (inc. Windows DLLs)
32-
*.dll
3332
*.so
3433
*.so.*
3534
*.dylib

OBSReplayFolders.lua

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
obs = obslua
22

33
function script_description()
4-
return [[Saves replays to sub-folders using the Game Capture executable name.
4+
return [[Saves replays to sub-folders using the current fullscreen video game executable name.
55
66
Author: redraskal]]
77
end
88

99
function script_load()
10+
ffi = require("ffi")
11+
ffi.cdef[[
12+
int get_running_fullscreen_game_path(char* buffer, int bufferSize)
13+
]]
14+
detect_game = ffi.load(script_path() .. "detect_game.dll")
15+
print(get_running_game_title())
1016
obs.obs_frontend_add_event_callback(obs_frontend_callback)
11-
folder = get_running_game_title()
1217
end
1318

1419
function obs_frontend_callback(event)
15-
if event == obs.OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED then
16-
folder = get_running_game_title()
17-
end
1820
if event == obs.OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED then
1921
local path = get_replay_buffer_output()
22+
local folder = get_running_game_title()
2023
if path ~= nil and folder ~= nil then
2124
print("Moving " .. path .. " to " .. folder)
2225
move(path, folder)
@@ -36,9 +39,12 @@ function get_replay_buffer_output()
3639
end
3740

3841
function get_running_game_title()
39-
local handle = assert(io.popen("detect_game"))
40-
local result = handle:read("*all")
41-
handle:close()
42+
local path = ffi.new("char[?]", 260)
43+
local result = detect_game.get_running_fullscreen_game_path(path, 260)
44+
if result ~= 0 then
45+
return nil
46+
end
47+
result = ffi.string(path)
4248
local len = #result
4349
if len == 0 then
4450
return nil
@@ -55,7 +61,6 @@ function get_running_game_title()
5561
end
5662
i = i + 1
5763
end
58-
print("Current running game: " .. title)
5964
return title
6065
end
6166

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
# obs-replay-folders
22

33
Saves replay buffer files to game-specific folders (like ShadowPlay).
4-
5-
## Important:
6-
7-
1. The script requires `detect_game.exe` to be added to PATH.
8-
2. To update the replay folder, restart the Replay Buffer.
9-
10-
There is no way to run an executable in Lua without breaking fullscreen application focus. So, the current running game will not automatically update.

detect_game.dll

62 KB
Binary file not shown.

detect_game.exe

-111 KB
Binary file not shown.

0 commit comments

Comments
 (0)