Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions addons/extension/fnc_initSession.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,49 @@ addMissionEventHandler ["ExtensionCallback", {
INFO("Mission registered. Starting data send.");
GVAR(sessionReady) = true;
};

if (_function isEqualTo ":MISSION:SAVED:") exitWith {
// Payload shapes:
// ["ok", path]
// ["partial", path, error]
// ["error", error]
private _status = _data param [0, ""];
private _detail = _data param [1, ""];
private _extra = _data param [2, ""];
Comment thread
fank marked this conversation as resolved.
Outdated

switch (_status) do {
case "ok": {
INFO_1("Mission save complete — path: %1",_detail);
GVAR(lastSaveResult) = ["ok", _detail];
[
format["OCAP saved %1 successfully", briefingName],
2,
[0, 0.8, 0, 1]
] remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
};
case "partial": {
WARNING_2("Mission save complete but upload failed — path: %1 error: %2",_detail,_extra);
GVAR(lastSaveResult) = ["partial", _detail, _extra];
[
format["OCAP saved locally (%1) but upload failed: %2", _detail, _extra],
2,
[1, 0.8, 0, 1]
] remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
};
case "error": {
ERROR_MSG_1("Mission save failed: %1",_detail);
GVAR(lastSaveResult) = ["error", _detail];
[
format["OCAP save failed: %1", _detail],
2,
[1, 0, 0, 1]
] remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
};
default {
WARNING_1("Unknown :MISSION:SAVED: status: %1",_status);
};
};
};
}];


Expand Down
15 changes: 9 additions & 6 deletions addons/recorder/fnc_exportData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,17 @@ private _endMessage = if (isNil "_message") then {if (_winSide == "") then {"Mis

private _saveTag = if (!isNil "_tag") then {_tag} else {EGVAR(settings,saveTag)};
INFO_3("Saving recording — mission: %1 | frames: %2 | tag: %3",GVAR(missionName),_endFrameNumber,_saveTag);
private _saveStart = diag_tickTime;
[":MISSION:SAVE:", []] call EFUNC(extension,sendData);
INFO_2("Recording saved — took %1 ms | mission: %2",round ((diag_tickTime - _saveStart) * 1000),GVAR(missionName));
OCAPEXTLOG(ARR4("Saved recording of mission",GVAR(missionName),"with tag",_saveTag));

// Save is now asynchronous — the extension returns immediately and will fire
// a :MISSION:SAVED: ExtensionCallback when the write + upload finishes.
// The final success/failure notification is driven from that callback in
// fnc_initSession.sqf.
INFO_2("Mission save queued — mission: %1 | frames: %2",GVAR(missionName),_endFrameNumber);
[":MISSION:SAVE:", []] call EFUNC(extension,sendData);
OCAPEXTLOG(ARR4("Queued recording of mission",GVAR(missionName),"with tag",_saveTag));

// notify players that the recording was saved with a 2 second delay to ensure the "stopped recording" entries populate first
[format["OCAP saved %1 frames successfully", _endFrameNumber], 1, [1, 1, 1, 1]] remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
// Interim "saving..." toast; the final result comes from :MISSION:SAVED:
[format["OCAP saving %1 (%2 frames) — upload will follow", briefingName, _endFrameNumber], 1, [1, 1, 1, 1]] remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
Comment thread
fank marked this conversation as resolved.
[[GVAR(missionName), GVAR(captureFrameNo)], {
params ["_missionName", "_endFrame"];

Expand Down
Loading