//
//  Copyright (C) 2018 Team Kodi
//  This file is part of Kodi - https://kodi.tv
//
//  SPDX-License-Identifier: MIT
//  See LICENSES/README.md for more information.
//

include "video.fbs";

namespace KODI.RETRO;

// Savestate schema
// Version 3

file_identifier "SAV_";

enum SaveType : uint8 {
  Unknown,
  Auto,
  Manual
}

table Savestate {
  // Schema version
  version:uint8 (id: 0);

  // Savestate properties
  type:SaveType (id: 1);
  slot:uint8 (id: 2);
  label:string (id: 3);
  caption:string (id: 11);
  created:string (id: 4); // W3C date time [ISO 8601 : 1988 (E)] with timezone info

  // Game properties
  game_file_name:string (id: 5);

  // Environment properties
  timestamp_frames:uint64 (id: 6);
  timestamp_wall_clock_ns:uint64 (id: 7);

  // Emulator properties
  emulator_addon_id:string (id: 8);
  emulator_version:string (id: 9); // Semantic version

  // Video stream properties
  pixel_format:PixelFormat (id: 12);
  nominal_width:uint16 (id: 13);
  nominal_height:uint16 (id: 14);
  max_width:uint16 (id: 15);
  max_height:uint16 (id: 16);
  pixel_aspect_ratio:float (id: 17);

  // Video frame properties
  video_data:[uint8] (id: 18);
  video_width:uint16 (id: 19);
  video_height:uint16 (id: 20);
  rotation_ccw:VideoRotation (id: 21);

  // Memory properties
  memory_data:[uint8] (id: 10);
}

root_type Savestate;
