Transition count semantic.

This commit is contained in:
Themaister 2011-06-06 21:32:10 +02:00
parent f62120861a
commit e02d9f41e8
4 changed files with 16 additions and 2 deletions

View File

@ -420,6 +420,8 @@ static bool load_imports(const char *dir_path, config_file_t *conf)
tracker_type = SSNES_STATE_CAPTURE;
else if (strcmp(semantic, "transition") == 0)
tracker_type = SSNES_STATE_TRANSITION;
else if (strcmp(semantic, "transition_count") == 0)
tracker_type = SSNES_STATE_TRANSITION_COUNT;
else if (strcmp(semantic, "capture_previous") == 0)
tracker_type = SSNES_STATE_CAPTURE_PREV;
else if (strcmp(semantic, "transition_previous") == 0)

View File

@ -441,6 +441,8 @@ static bool get_import_value(const char *path, xmlNodePtr ptr)
tracker_type = SSNES_STATE_CAPTURE_PREV;
else if (strcmp((const char*)semantic, "transition") == 0)
tracker_type = SSNES_STATE_TRANSITION;
else if (strcmp((const char*)semantic, "transition_count") == 0)
tracker_type = SSNES_STATE_TRANSITION_COUNT;
else if (strcmp((const char*)semantic, "transition_previous") == 0)
tracker_type = SSNES_STATE_TRANSITION_PREV;
#ifdef HAVE_PYTHON

View File

@ -42,7 +42,7 @@ struct snes_tracker_internal
uint8_t prev[2];
int frame_count;
uint8_t old_value;
int transition_count;
};
struct snes_tracker
@ -160,6 +160,15 @@ static void update_element(
uniform->value = info->frame_count;
break;
case SSNES_STATE_TRANSITION_COUNT:
if (info->old_value != fetch())
{
info->old_value = fetch();
info->transition_count++;
}
uniform->value = info->transition_count;
break;
case SSNES_STATE_TRANSITION_PREV:
if (info->prev[0] != fetch())
{

View File

@ -27,8 +27,9 @@
enum snes_tracker_type
{
SSNES_STATE_CAPTURE,
SSNES_STATE_TRANSITION,
SSNES_STATE_CAPTURE_PREV,
SSNES_STATE_TRANSITION,
SSNES_STATE_TRANSITION_COUNT,
SSNES_STATE_TRANSITION_PREV,
#ifdef HAVE_PYTHON
SSNES_STATE_PYTHON