taisei/src/replay/replay.h
Andrei Alexeyev 173c8c3cc6
replay: general refactor
* Split replay.c into multiple files under replay/; improve logical
  separation of replay-related code.
* Separate replay playback state from data.
* Get rid of global static replay struct and avoid unnecessary replay
  copying.
* Replay playback and recording are now independent and may occur
  simultaneously, although this functionality is not yet exposed. This
  enables replay "re-recording" while synthesizing new desync check
  events, possibly at a different rate from the original replay.
* Rate of recorded desync check events can now be controlled with the
  TAISEI_REPLAY_DESYNC_CHECK_FREQUENCY environment variable. The default
  value is 300 as before.
* Probably other stuff I forgot about.
2021-06-16 01:43:10 +03:00

50 lines
1.5 KiB
C

/*
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#ifndef IGUARD_replay_replay_h
#define IGUARD_replay_replay_h
#include "taisei.h"
#include "eventloop/eventloop.h"
#include <SDL.h>
#define REPLAY_EXTENSION "tsr"
#ifdef DEBUG
// #define REPLAY_LOAD_DEBUG
#endif
typedef struct Replay Replay;
typedef struct ReplayStage ReplayStage;
typedef struct ReplayEvent ReplayEvent;
typedef enum ReplayReadMode {
// bitflags
REPLAY_READ_META = (1 << 0),
REPLAY_READ_EVENTS = (1 << 1),
REPLAY_READ_ALL = REPLAY_READ_META | REPLAY_READ_EVENTS,
} ReplayReadMode;
void replay_reset(Replay *rpy) attr_nonnull_all;
void replay_destroy_events(Replay *rpy) attr_nonnull_all;
bool replay_write(Replay *rpy, SDL_RWops *file, uint16_t version) attr_nonnull_all;
bool replay_read(Replay *rpy, SDL_RWops *file, ReplayReadMode mode, const char *source) attr_nonnull(1, 2);
bool replay_save(Replay *rpy, const char *name) attr_nonnull_all;
bool replay_load(Replay *rpy, const char *name, ReplayReadMode mode) attr_nonnull_all;
bool replay_load_syspath(Replay *rpy, const char *path, ReplayReadMode mode) attr_nonnull_all;
int replay_find_stage_idx(Replay *rpy, uint8_t stageid) attr_nonnull_all;
void replay_play(Replay *rpy, int firstidx, CallChain next) attr_nonnull_all;
#endif // IGUARD_replay_replay_h