RetroArch/gfx/video_state_tracker.h

113 lines
2.9 KiB
C
Raw Normal View History

2012-04-21 21:13:50 +00:00
/* RetroArch - A frontend for libretro.
2014-01-01 00:50:59 +00:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2017-01-22 12:40:32 +00:00
* Copyright (C) 2011-2017 - Daniel De Matteis
*
2012-04-21 21:13:50 +00:00
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
2012-04-21 21:13:50 +00:00
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
2012-04-21 21:31:57 +00:00
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
2015-01-12 15:00:13 +00:00
#ifndef __VIDEO_STATE_TRACKER_H
#define __VIDEO_STATE_TRACKER_H
#include <stdint.h>
2016-06-03 03:43:49 +00:00
#include <boolean.h>
2016-06-03 03:43:49 +00:00
#include <retro_common_api.h>
2016-06-03 03:43:49 +00:00
RETRO_BEGIN_DECLS
2012-04-07 10:17:40 +00:00
enum state_tracker_type
{
RARCH_STATE_CAPTURE = 0,
2012-04-21 21:25:32 +00:00
RARCH_STATE_CAPTURE_PREV,
RARCH_STATE_TRANSITION,
RARCH_STATE_TRANSITION_COUNT,
RARCH_STATE_TRANSITION_PREV,
RARCH_STATE_PYTHON
};
2012-04-07 10:17:40 +00:00
enum state_ram_type
{
2012-04-21 21:25:32 +00:00
RARCH_STATE_NONE,
RARCH_STATE_WRAM,
RARCH_STATE_INPUT_SLOT1,
RARCH_STATE_INPUT_SLOT2
};
2012-04-07 10:17:40 +00:00
struct state_tracker_uniform_info
{
2012-04-07 10:17:40 +00:00
enum state_tracker_type type;
enum state_ram_type ram_type;
2017-09-08 22:02:38 +00:00
char id[64];
2012-02-12 17:05:33 +00:00
uint16_t mask;
uint16_t equal;
2017-09-08 22:02:38 +00:00
uint32_t addr;
};
2012-04-07 10:17:40 +00:00
struct state_tracker_info
{
const char *script;
2011-06-06 16:50:36 +00:00
const char *script_class;
2011-06-07 13:33:29 +00:00
bool script_is_file;
2017-09-08 22:02:38 +00:00
const uint8_t *wram;
unsigned info_elem;
const struct state_tracker_uniform_info *info;
};
2012-04-07 10:17:40 +00:00
struct state_tracker_uniform
{
const char *id;
float value;
};
2012-04-07 10:17:40 +00:00
typedef struct state_tracker state_tracker_t;
2015-01-11 21:39:50 +00:00
/**
* state_tracker_init:
* @info : State tracker info handle.
*
* Creates and initializes graphics state tracker.
*
* Returns: new state tracker handle if successful, otherwise NULL.
**/
2012-04-07 10:17:40 +00:00
state_tracker_t* state_tracker_init(const struct state_tracker_info *info);
2014-09-08 15:57:18 +00:00
2015-01-11 21:39:50 +00:00
/**
* state_tracker_free:
* @tracker : State tracker handle.
*
* Frees a state tracker handle.
**/
2012-04-07 10:17:40 +00:00
void state_tracker_free(state_tracker_t *tracker);
2015-01-11 21:39:50 +00:00
/**
2015-01-12 01:15:35 +00:00
* state_tracker_get_uniform:
2015-01-11 21:39:50 +00:00
* @tracker : State tracker handle.
* @uniforms : State tracker uniforms.
* @elem : Amount of uniform elements.
* @frame_count : Frame count.
*
* Calls update_input(), and updates each uniform
* element accordingly.
*
* Returns: Amount of state elements (either equal to @elem
* or equal to @tracker->info_eleme).
**/
2015-01-12 01:15:35 +00:00
unsigned state_tracker_get_uniform(state_tracker_t *tracker,
2014-09-08 15:57:18 +00:00
struct state_tracker_uniform *uniforms,
unsigned elem, unsigned frame_count);
void state_tracker_update_input(uint16_t *input1, uint16_t *input2);
2016-06-03 03:43:49 +00:00
RETRO_END_DECLS
#endif