Opened 17 years ago

Closed 17 years ago

Last modified 5 years ago

#8693 closed patch

Action recorder

Reported by: SF/h00ligan Owned by: sev-
Priority: normal Component: --Other--
Version: Keywords:
Cc: Game:

Description

This patch implements record and playback of scummvm game progress.

Remarks: - every backend must delete eventManager instance (as I already implemented for SDL) - all random sources must be registered with eventManager by unique name

Ticket imported from: #1738058. Ticket imported from: patches/798.

Attachments (2)

TEST5.patch (23.8 KB ) - added by SF/h00ligan 17 years ago.
Recorder patch
TEST6.patch (24.5 KB ) - added by SF/h00ligan 17 years ago.
Recorder patch

Download all attachments as: .zip

Change History (13)

by SF/h00ligan, 17 years ago

Attachment: TEST5.patch added

Recorder patch

comment:1 by sev-, 17 years ago

Usage:

set record_mode=record

in scummvm.ini

Play game

set record_mode=playback

and run scummvm with same target again. It will playback recorded sequence.

It will create 3 files in savepath:

record.bin record.time

and record.tmp, which is a temporary file, but can not be removed due to lack of functionality in our File class

comment:2 by SF/knakos, 17 years ago

This works just fine on wince (scumm games tested) with a small patch (follows - I didn't attach it because it's trivial) and the savepath variable defined. Possible enhancements include: per-game/user naming for saved files, start-pause-stop playback, gui for it. good work!

---cut----

Index: wince-sdl.cpp

--- wince-sdl.cpp (revision 27470) +++ wince-sdl.cpp (working copy) @@ -278,11 +278,13 @@ // one timer in scummvm (for the time being) _timer = _int_timer = new DefaultTimerManager(); _timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok - SDL_SetTimer(10, &timer_handler_wrapper);

// Chain init OSystem_SDL::initBackend();

+ // Start timer after all init has been done + SDL_SetTimer(10, &timer_handler_wrapper); + // Query SDL for screen size and init screen dependent stuff OSystem_WINCE3::initScreenInfos(); _isSmartphone = CEDevice::isSmartphone();

comment:3 by sev-, 17 years ago

Max, any opinion about the code?

comment:4 by sev-, 17 years ago

Owner: changed from sev- to fingolfin

comment:5 by joostp, 17 years ago

Just tried this patch and it seems to work nicely for the most part.

Here's my feedback:

- Something went wrong the first time I recorded me playing BASS: during playback it seemed to skip one (or more) mouse-clicks I made about 1 minute into playing, causing the playback to behave strangely as Foster didn't enter the door like I did when it was recording, and now it was subsequently performing clicks and mouse-movements that should be performed in the next room.
I was able to consistently reproduce this using the same replay file. Afterwards I tried a few times to reproduce this with a new recording, but wasn't able to (and unfortunately the original replay file that exhibited the problem was since overwritten).

- During playback I tried to move the ScummVM window by clicking its decoration/title and dragging it, but found that while attempting this that it seemed to receive all kinds of mouse-move events (presumably from the playback), thus causing the window to warp around my desktop(s) like crazy.
I'm using the XFCE4 window manager on X.org if that matters.

comment:6 by fingolfin, 17 years ago

Eugene: Sorry, I didn't have a chance to look at this yet.

comment:7 by fingolfin, 17 years ago

Note that readRecord / writeRecord write structs in one go. This is not portable, and also not future safe.

by SF/h00ligan, 17 years ago

Attachment: TEST6.patch added

Recorder patch

comment:8 by SF/h00ligan, 17 years ago

new version uploaded. fixed portability issues. File Added: TEST6.patch

comment:9 by sev-, 17 years ago

Owner: changed from fingolfin to sev-
Status: newclosed

comment:10 by sev-, 17 years ago

I modified patch as following:

- Made it compile with current SVN - Extended it to new engines - Added command line options - Fixed crash when record files do not exist

Still some work is needed in this direction: - Try to avoid warpMouse() calls at playback, so the system will be useable - Perhaps we need to indicate recording mode. May be draw triangle/circle in some corner. Use OSD overlay for that - Still it is possible that time will drift away even with current implementation. Do something about it

comment:11 by digitall, 5 years ago

Component: --Other--
Note: See TracTickets for help on using tickets.