Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct retro_core_t

unsigned poll_type;
uint8_t flags;
void *core_data; /* Arbitrary core data. @see RETRO_ENVIRONMENT_GET_CORE_DATA */
};


Expand Down
25 changes: 25 additions & 0 deletions libretro-common/include/libretro.h
Original file line number Diff line number Diff line change
Expand Up @@ -2569,6 +2569,31 @@ enum retro_mod
*/
#define RETRO_ENVIRONMENT_GET_FILE_BROWSER_START_DIRECTORY 80

/**
* Sets a pointer to arbitrary data for the actively running core.
Comment thread
RobLoach marked this conversation as resolved.
*
* This is can be set in either \c retro_init() or \c retro_load_game().
*
* @param[in] data <tt>void *</tt>. Pointer to the data to set.
* @return \c true if the environment call is available.
*
* @see RETRO_ENVIRONMENT_GET_CORE_DATA
*/
#define RETRO_ENVIRONMENT_SET_CORE_DATA 81

/**
* Gets a pointer to arbitrary data for the actively running core.
*
* This is persistent for the lifetime of the core until \c retro_deinit() is called.
*
* @param[out] data <tt>void **</tt>. Pointer to the data that was set.
* May be \c NULL if the data was not set yet.
* @return \c true if the environment call is available.
*
* @see RETRO_ENVIRONMENT_SET_CORE_DATA
*/
#define RETRO_ENVIRONMENT_GET_CORE_DATA 82

/**@}*/

/**
Expand Down
12 changes: 12 additions & 0 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -3583,6 +3583,18 @@ bool runloop_environment_cb(unsigned cmd, void *data)
}
}
break;

case RETRO_ENVIRONMENT_SET_CORE_DATA:
runloop_st->current_core.core_data = data;
break;

case RETRO_ENVIRONMENT_GET_CORE_DATA:
if (data != NULL) {
void **core_data = (void **)data;
*core_data = runloop_st->current_core.core_data;
}
break;

default:
RARCH_LOG("[Environ]: UNSUPPORTED (#%u).\n", cmd);
return false;
Expand Down