From 5b476460d869e7544e8e3df76e28f9cdff2ddc2b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Sep 2014 18:31:44 +0200 Subject: [PATCH] Style / indent nits --- driver_menu.h | 9 +++-- frontend/frontend_context.h | 7 ++-- general.h | 3 +- libretro_private.h | 41 ++++++++++++++++------ rewind.c | 70 +++++++++++++++++++++++-------------- thread/xenon_sdl_threads.c | 2 +- 6 files changed, 88 insertions(+), 44 deletions(-) diff --git a/driver_menu.h b/driver_menu.h index 3461d9379a..24ef7497f0 100644 --- a/driver_menu.h +++ b/driver_menu.h @@ -134,13 +134,16 @@ typedef struct menu_ctx_driver_backend { int (*iterate)(unsigned); void (*shader_manager_init)(menu_handle_t *); - void (*shader_manager_get_str)(struct gfx_shader *, char *, size_t, const char *, const char *, unsigned); - void (*shader_manager_set_preset)(struct gfx_shader *, unsigned, const char*); + void (*shader_manager_get_str)(struct gfx_shader *, char *, + size_t, const char *, const char *, unsigned); + void (*shader_manager_set_preset)(struct gfx_shader *, + unsigned, const char*); void (*shader_manager_save_preset)(const char *, bool); unsigned (*shader_manager_get_type)(const struct gfx_shader *); int (*shader_manager_setting_toggle)(unsigned, const char *, unsigned); unsigned (*type_is)(const char *, unsigned); - void (*setting_set_label)(char *, size_t, unsigned *, unsigned, const char *, const char *, unsigned); + void (*setting_set_label)(char *, size_t, unsigned *, + unsigned, const char *, const char *, unsigned); const char *ident; } menu_ctx_driver_backend_t; diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h index 8b2c5bb90d..7331d286f7 100644 --- a/frontend/frontend_context.h +++ b/frontend/frontend_context.h @@ -71,8 +71,11 @@ extern const frontend_ctx_driver_t frontend_ctx_android; extern const frontend_ctx_driver_t frontend_ctx_psp; extern const frontend_ctx_driver_t frontend_ctx_null; -const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize. -const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes. +/* Finds driver with ident. Does not initialize. */ +const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); + +/* Finds first suitable driver and initialize. */ +const frontend_ctx_driver_t *frontend_ctx_init_first(void); int main_entry_iterate_clear_input(signature(), args_type() args); int main_entry_iterate_load_content(signature(), args_type() args); diff --git a/general.h b/general.h index 73a80f641e..db09f4731b 100644 --- a/general.h +++ b/general.h @@ -811,7 +811,8 @@ int rarch_main(int argc, char *argv[]); bool rarch_replace_config(const char *path); -void rarch_main_init_wrap(const struct rarch_main_wrap *args, int *argc, char **argv); +void rarch_main_init_wrap(const struct rarch_main_wrap *args, + int *argc, char **argv); int rarch_main_init(int argc, char *argv[]); void rarch_main_set_state(unsigned action); diff --git a/libretro_private.h b/libretro_private.h index 3751d3a433..8423fefbee 100644 --- a/libretro_private.h +++ b/libretro_private.h @@ -23,23 +23,42 @@ #ifndef LIBRETRO_PRIVATE_H__ #define LIBRETRO_PRIVATE_H__ -// Private additions to libretro. No API/ABI stability guaranteed. +/* Private additions to libretro. No API/ABI stability guaranteed. */ #include "libretro.h" #define RETRO_ENVIRONMENT_SET_LIBRETRO_PATH (RETRO_ENVIRONMENT_PRIVATE | 0) - // const char * -- - // Sets the absolute path for the libretro core pointed to. RETRO_ENVIRONMENT_EXEC will use the last libretro core set with this call. - // Returns false if file for absolute path could not be found. + /* const char * -- + * Sets the absolute path for the + * libretro core pointed to. + * RETRO_ENVIRONMENT_EXEC will use + * the last libretro core set with this call. + * Returns false if file for absolute path + * could not be found. + */ #define RETRO_ENVIRONMENT_EXEC (RETRO_ENVIRONMENT_PRIVATE | 1) - // const char * -- - // Requests that this core is deinitialized, and a new core is loaded. - // The libretro core used is set with SET_LIBRETRO_PATH, and path to game is passed in _EXEC. NULL means no game. + /* const char * -- + * Requests that this core is + * deinitialized, and a new core is loaded. + * The libretro core used is set with + * SET_LIBRETRO_PATH, and path to + * game is passed in _EXEC. NULL + * means no game. */ #define RETRO_ENVIRONMENT_EXEC_ESCAPE (RETRO_ENVIRONMENT_PRIVATE | 2) - // const char * -- - // Requests that this core is deinitialized, and a new core is loaded. It also escapes the main loop the core is currently - // bound to. - // The libretro core used is set with SET_LIBRETRO_PATH, and path to game is passed in _EXEC. NULL means no game. + /* const char * -- + * Requests that this core is + * deinitialized, and a new core + * is loaded. + * + * It also escapes the main loop + * the core is currently + * bound to. + * + * The libretro core used is set + * with SET_LIBRETRO_PATH, and + * path to game is passed in + * _EXEC. NULL means no game. + */ #endif diff --git a/rewind.c b/rewind.c index 13b5d6e26a..f2eb81c992 100644 --- a/rewind.c +++ b/rewind.c @@ -33,41 +33,59 @@ #define CPU_X86 #endif -// Other arches SIGBUS (usually) on unaligned accesses. +/* Other arches SIGBUS (usually) on unaligned accesses. */ #ifndef CPU_X86 #define NO_UNALIGNED_MEM #endif -// Format per frame: -// size nextstart; -// repeat { -// uint16 numchanged; // everything is counted in units of uint16 -// if (numchanged) { -// uint16 numunchanged; // skip these before handling numchanged -// uint16[numchanged] changeddata; -// } -// else -// { -// uint32 numunchanged; -// if (!numunchanged) break; -// } -// } -// size thisstart; -// -// The start offsets point to 'nextstart' of any given compressed frame. -// Each uint16 is stored native endian; anything that claims any other endianness refers to the endianness of this specific item. -// The uint32 is stored little endian. -// Each size value is stored native endian if alignment is not enforced; if it is, they're little endian. -// The start of the buffer contains a size pointing to the end of the buffer; the end points to its start. -// Wrapping is handled by returning to the start of the buffer if the compressed data could potentially hit the edge; -// if the compressed data could potentially overwrite the tail pointer, the tail retreats until it can no longer collide. -// This means that on average, ~2 * maxcompsize is unused at any given moment. +/* Format per frame (pseudocode): */ +#if 0 +size nextstart; +repeat { + uint16 numchanged; /* everything is counted in units of uint16 */ + if (numchanged) + { + uint16 numunchanged; /* skip these before handling numchanged */ + uint16[numchanged] changeddata; + } + else + { + uint32 numunchanged; + if (!numunchanged) + break; + } +} +size thisstart; +#endif -// These are called very few constant times per frame, keep it as simple as possible. +/* The start offsets point to 'nextstart' of any given compressed frame. + * Each uint16 is stored native endian; anything that claims any other + * endianness refers to the endianness of this specific item. + * The uint32 is stored little endian. + * + * Each size value is stored native endian if alignment is not enforced; + * if it is, they're little endian. + * + * The start of the buffer contains a size pointing to the end of the + * buffer; the end points to its start. + * + * Wrapping is handled by returning to the start of the buffer if the + * compressed data could potentially hit the edge; + * + * if the compressed data could potentially overwrite the tail pointer, + * the tail retreats until it can no longer collide. + * + * This means that on average, ~2 * maxcompsize is + * unused at any given moment. */ + + +/* These are called very few constant times per frame, + * keep it as simple as possible. */ static inline void write_size_t(void *ptr, size_t val) { memcpy(ptr, &val, sizeof(val)); } + static inline size_t read_size_t(const void *ptr) { size_t ret; diff --git a/thread/xenon_sdl_threads.c b/thread/xenon_sdl_threads.c index e235c6febf..7f4cd437cd 100644 --- a/thread/xenon_sdl_threads.c +++ b/thread/xenon_sdl_threads.c @@ -39,7 +39,7 @@ int SDL_CondWait(SDL_cond *cond, SDL_mutex *lock) SDL_mutexV(lock); *sleeping = true; - while (*sleeping); // Yeah, we all love busyloops don't we? ._. + while (*sleeping); /* Yeah, we all love busyloops don't we? ._. */ SDL_mutexP(lock); return 0;