Xemu [doxygen]  hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
Macros | Typedefs | Functions | Variables
emutools.h File Reference
#include <SDL.h>
#include "xemu/emutools_basicdefs.h"
#include <dirent.h>
Include dependency graph for emutools.h:

Go to the source code of this file.

Macros

#define MSG_POPUP_WINDOW(sdlflag, title, msg, win)   SDL_ShowSimpleMessageBox_custom(sdlflag, title, msg, win)
 
#define INSTALL_DIRECTORY_ENTRY_NAME   "default-files"
 
#define APP_ORG   "xemu-lgb"
 
#define APP_DESC_APPEND   " - Xemu"
 
#define XEMU_MAIN_LOOP(func, p1, p2)   for (;;) func()
 
#define XEMU_CPU_STAT_INFO_BUFFER_SIZE   64
 
#define _REPORT_WINDOW_(sdlflag, str, ...)
 
#define INFO_WINDOW(...)   _REPORT_WINDOW_(SDL_MESSAGEBOX_INFORMATION, "INFO", __VA_ARGS__)
 
#define WARNING_WINDOW(...)   _REPORT_WINDOW_(SDL_MESSAGEBOX_WARNING, "WARNING", __VA_ARGS__)
 
#define ERROR_WINDOW(...)   _REPORT_WINDOW_(SDL_MESSAGEBOX_ERROR, "ERROR", __VA_ARGS__)
 
#define FATAL(...)
 
#define QUESTION_WINDOW(items, msg)   _sdl_emu_secured_modal_box_(items, msg)
 
#define ARE_YOU_SURE_OVERRIDE   1
 
#define ARE_YOU_SURE_DEFAULT_YES   2
 
#define ARE_YOU_SURE_DEFAULT_NO   4
 
#define XEMU_VIEWPORT_ADJUST_LOGICAL_SIZE   1
 
#define HAVE_MM_MALLOC
 
#define xemu_os_open   open
 
#define xemu_os_creat   creat
 
#define xemu_os_fopen   fopen
 
#define xemu_os_unlink   unlink
 
#define xemu_os_mkdir   mkdir
 
#define xemu_os_opendir   opendir
 
#define xemu_os_closedir   closedir
 
#define xemu_os_stat   stat
 
#define xemu_os_close   close
 

Typedefs

typedef char sha1_hash_str[41]
 
typedef Uint8 sha1_hash_bytes[20]
 
typedef DIR XDIR
 

Functions

void sysconsole_open (void)
 
void sysconsole_close (const char *waitmsg)
 
int sysconsole_toggle (int set)
 
void xemu_get_timing_stat_string (char *buf, unsigned int size)
 
const char * xemu_get_uname_string (void)
 
void clear_emu_events (void)
 
void xemu_drop_events (void)
 
int set_mouse_grab (SDL_bool state, int force_allow)
 
SDL_bool is_mouse_grab (void)
 
void save_mouse_grab (void)
 
void restore_mouse_grab (void)
 
int _sdl_emu_secured_modal_box_ (const char *items_in, const char *msg)
 
int ARE_YOU_SURE (const char *s, int flags)
 
void xemu_set_viewport (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int flags)
 
void xemu_get_viewport (unsigned int *x1, unsigned int *y1, unsigned int *x2, unsigned int *y2)
 
void xemu_window_snap_to_optimal_size (int forced)
 
int xemu_init_debug (const char *fn)
 
time_t xemu_get_unixtime (void)
 
struct tm * xemu_get_localtime (void)
 
Uint8 xemu_hour_to_bcd12h (Uint8 hours, int hour_offset)
 
unsigned int xemu_get_microseconds (void)
 
void * xemu_malloc (size_t size)
 
void * xemu_realloc (void *p, size_t size)
 
int xemu_is_first_time_user (void)
 
void * xemu_malloc_ALIGNED (size_t size)
 
char * xemu_strdup (const char *s)
 
void xemu_restrdup (char **ptr, const char *str)
 
void xemu_set_full_screen (int setting)
 
void xemu_set_screen_mode (int setting)
 
void xemu_timekeeping_delay (int td_em)
 
void xemu_pre_init (const char *app_organization, const char *app_name, const char *slogan)
 
int xemu_init_sdl (void)
 
int xemu_post_init (const char *window_title, int is_resizable, int texture_x_size, int texture_y_size, int logical_x_size, int logical_y_size, int win_x_size, int win_y_size, Uint32 pixel_format, int n_colours, const Uint8 *colours, Uint32 *store_palette, int render_scale_quality, int locked_texture_update, void(*shutdown_callback)(void))
 
int xemu_set_icon_from_xpm (char *xpm[])
 
void xemu_timekeeping_start (void)
 
void xemu_render_dummy_frame (Uint32 colour, int texture_x_size, int texture_y_size)
 
Uint32xemu_start_pixel_buffer_access (int *texture_tail)
 
void xemu_update_screen (void)
 
void sha1_checksum_as_words (Uint32 hash[5], const Uint8 *data, Uint32 size)
 
void sha1_checksum_as_bytes (sha1_hash_bytes hash_bytes, const Uint8 *data, Uint32 size)
 
void sha1_checksum_as_string (sha1_hash_str hash_str, const Uint8 *data, Uint32 size)
 
int xemu_os_readdir (XDIR *dirp, char *fn)
 
int xemu_os_file_exists (const char *fn)
 

Variables

int(* SDL_ShowSimpleMessageBox_custom )(Uint32, const char *, const char *, SDL_Window *)
 
int(* SDL_ShowMessageBox_custom )(const SDL_MessageBoxData *, int *)
 
int allow_mouse_grab
 
int i_am_sure_override
 
const char * str_are_you_sure_to_exit
 
char * sdl_window_title
 
char * window_title_custom_addon
 
char * window_title_info_addon
 
SDL_Window * sdl_win
 
Uint32 sdl_winid
 
SDL_PixelFormat * sdl_pix_fmt
 
int sdl_on_x11
 
int sdl_on_wayland
 
char * xemu_app_org
 
char * xemu_app_name
 
int seconds_timer_trigger
 
char * sdl_pref_dir
 
char * sdl_base_dir
 
char * sdl_inst_dir
 
int sysconsole_is_open
 
int sdl_default_win_x_size
 
int sdl_default_win_y_size
 
int register_new_texture_creation
 
SDL_version sdlver_compiled
 
SDL_version sdlver_linked
 
Uint32xemu_frame_pixel_access_p
 
const char EMPTY_STR []
 
const int ZERO_INT
 
const int ONE_INT
 

Macro Definition Documentation

◆ _REPORT_WINDOW_

#define _REPORT_WINDOW_ (   sdlflag,
  str,
  ... 
)
Value:
do { \
char _buf_for_win_msg_[4096]; \
CHECK_SNPRINTF(snprintf(_buf_for_win_msg_, sizeof _buf_for_win_msg_, __VA_ARGS__), sizeof _buf_for_win_msg_); \
fprintf(stderr, str ": %s" NL, _buf_for_win_msg_); \
if (debug_fp) \
fprintf(debug_fp, str ": %s" NL, _buf_for_win_msg_); \
if (sdl_win) { \
save_mouse_grab(); \
MSG_POPUP_WINDOW(sdlflag, sdl_window_title, _buf_for_win_msg_, sdl_win); \
clear_emu_events(); \
xemu_drop_events(); \
SDL_RaiseWindow(sdl_win); \
restore_mouse_grab(); \
xemu_timekeeping_start(); \
MSG_POPUP_WINDOW(sdlflag, sdl_window_title, _buf_for_win_msg_, sdl_win); \
} while (0)

Definition at line 91 of file emutools.h.

◆ APP_DESC_APPEND

#define APP_DESC_APPEND   " - Xemu"

Definition at line 52 of file emutools.h.

◆ APP_ORG

#define APP_ORG   "xemu-lgb"

Definition at line 50 of file emutools.h.

◆ ARE_YOU_SURE_DEFAULT_NO

#define ARE_YOU_SURE_DEFAULT_NO   4

Definition at line 126 of file emutools.h.

◆ ARE_YOU_SURE_DEFAULT_YES

#define ARE_YOU_SURE_DEFAULT_YES   2

Definition at line 125 of file emutools.h.

◆ ARE_YOU_SURE_OVERRIDE

#define ARE_YOU_SURE_OVERRIDE   1

Definition at line 124 of file emutools.h.

◆ ERROR_WINDOW

#define ERROR_WINDOW (   ...)    _REPORT_WINDOW_(SDL_MESSAGEBOX_ERROR, "ERROR", __VA_ARGS__)

Definition at line 111 of file emutools.h.

◆ FATAL

#define FATAL (   ...)
Value:
do { \
ERROR_WINDOW(__VA_ARGS__); \
XEMUEXIT(1); \
} while (0)

Definition at line 113 of file emutools.h.

◆ HAVE_MM_MALLOC

#define HAVE_MM_MALLOC

Definition at line 165 of file emutools.h.

◆ INFO_WINDOW

#define INFO_WINDOW (   ...)    _REPORT_WINDOW_(SDL_MESSAGEBOX_INFORMATION, "INFO", __VA_ARGS__)

Definition at line 109 of file emutools.h.

◆ INSTALL_DIRECTORY_ENTRY_NAME

#define INSTALL_DIRECTORY_ENTRY_NAME   "default-files"

Definition at line 43 of file emutools.h.

◆ MSG_POPUP_WINDOW

#define MSG_POPUP_WINDOW (   sdlflag,
  title,
  msg,
  win 
)    SDL_ShowSimpleMessageBox_custom(sdlflag, title, msg, win)

Definition at line 42 of file emutools.h.

◆ QUESTION_WINDOW

#define QUESTION_WINDOW (   items,
  msg 
)    _sdl_emu_secured_modal_box_(items, msg)

Definition at line 119 of file emutools.h.

◆ WARNING_WINDOW

#define WARNING_WINDOW (   ...)    _REPORT_WINDOW_(SDL_MESSAGEBOX_WARNING, "WARNING", __VA_ARGS__)

Definition at line 110 of file emutools.h.

◆ XEMU_CPU_STAT_INFO_BUFFER_SIZE

#define XEMU_CPU_STAT_INFO_BUFFER_SIZE   64

Definition at line 65 of file emutools.h.

◆ XEMU_MAIN_LOOP

#define XEMU_MAIN_LOOP (   func,
  p1,
  p2 
)    for (;;) func()

Definition at line 58 of file emutools.h.

◆ xemu_os_close

#define xemu_os_close   close

Definition at line 272 of file emutools.h.

◆ xemu_os_closedir

#define xemu_os_closedir   closedir

Definition at line 269 of file emutools.h.

◆ xemu_os_creat

#define xemu_os_creat   creat

Definition at line 264 of file emutools.h.

◆ xemu_os_fopen

#define xemu_os_fopen   fopen

Definition at line 265 of file emutools.h.

◆ xemu_os_mkdir

#define xemu_os_mkdir   mkdir

Definition at line 267 of file emutools.h.

◆ xemu_os_open

#define xemu_os_open   open

Definition at line 263 of file emutools.h.

◆ xemu_os_opendir

#define xemu_os_opendir   opendir

Definition at line 268 of file emutools.h.

◆ xemu_os_stat

#define xemu_os_stat   stat

Definition at line 270 of file emutools.h.

◆ xemu_os_unlink

#define xemu_os_unlink   unlink

Definition at line 266 of file emutools.h.

◆ XEMU_VIEWPORT_ADJUST_LOGICAL_SIZE

#define XEMU_VIEWPORT_ADJUST_LOGICAL_SIZE   1

Definition at line 146 of file emutools.h.

Typedef Documentation

◆ sha1_hash_bytes

typedef Uint8 sha1_hash_bytes[20]

Definition at line 238 of file emutools.h.

◆ sha1_hash_str

typedef char sha1_hash_str[41]

Definition at line 237 of file emutools.h.

◆ XDIR

typedef DIR XDIR

Definition at line 262 of file emutools.h.

Function Documentation

◆ _sdl_emu_secured_modal_box_()

int _sdl_emu_secured_modal_box_ ( const char *  items_in,
const char *  msg 
)

Definition at line 469 of file screen.c.

Here is the call graph for this function:

◆ ARE_YOU_SURE()

int ARE_YOU_SURE ( const char *  s,
int  flags 
)

Definition at line 1202 of file emutools.c.

Here is the caller graph for this function:

◆ clear_emu_events()

void clear_emu_events ( void  )

Definition at line 193 of file commodore_65.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_mouse_grab()

SDL_bool is_mouse_grab ( void  )

Definition at line 145 of file emutools.c.

Here is the caller graph for this function:

◆ restore_mouse_grab()

void restore_mouse_grab ( void  )

Definition at line 158 of file emutools.c.

Here is the call graph for this function:

◆ save_mouse_grab()

void save_mouse_grab ( void  )

Definition at line 151 of file emutools.c.

◆ set_mouse_grab()

int set_mouse_grab ( SDL_bool  state,
int  force_allow 
)

Definition at line 131 of file emutools.c.

Here is the caller graph for this function:

◆ sha1_checksum_as_bytes()

void sha1_checksum_as_bytes ( sha1_hash_bytes  hash_bytes,
const Uint8 data,
Uint32  size 
)

Definition at line 1840 of file emutools.c.

Here is the call graph for this function:

◆ sha1_checksum_as_string()

void sha1_checksum_as_string ( sha1_hash_str  hash_str,
const Uint8 data,
Uint32  size 
)

Definition at line 1853 of file emutools.c.

Here is the call graph for this function:

◆ sha1_checksum_as_words()

void sha1_checksum_as_words ( Uint32  hash[5],
const Uint8 data,
Uint32  size 
)

Definition at line 1805 of file emutools.c.

Here is the caller graph for this function:

◆ sysconsole_close()

void sysconsole_close ( const char *  waitmsg)

Definition at line 1393 of file emutools.c.

Here is the caller graph for this function:

◆ sysconsole_open()

void sysconsole_open ( void  )

Definition at line 1294 of file emutools.c.

Here is the caller graph for this function:

◆ sysconsole_toggle()

int sysconsole_toggle ( int  set)

Definition at line 1455 of file emutools.c.

Here is the call graph for this function:

◆ xemu_drop_events()

void xemu_drop_events ( void  )

Definition at line 294 of file emutools.c.

◆ xemu_get_localtime()

struct tm* xemu_get_localtime ( void  )

Definition at line 187 of file emutools.c.

◆ xemu_get_microseconds()

unsigned int xemu_get_microseconds ( void  )

Definition at line 205 of file emutools.c.

◆ xemu_get_timing_stat_string()

void xemu_get_timing_stat_string ( char *  buf,
unsigned int  size 
)

Definition at line 538 of file emutools.c.

◆ xemu_get_uname_string()

const char* xemu_get_uname_string ( void  )

Definition at line 468 of file emutools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xemu_get_unixtime()

time_t xemu_get_unixtime ( void  )

Definition at line 199 of file emutools.c.

◆ xemu_get_viewport()

void xemu_get_viewport ( unsigned int *  x1,
unsigned int *  y1,
unsigned int *  x2,
unsigned int *  y2 
)

Definition at line 877 of file emutools.c.

◆ xemu_hour_to_bcd12h()

Uint8 xemu_hour_to_bcd12h ( Uint8  hours,
int  hour_offset 
)

Definition at line 211 of file emutools.c.

◆ xemu_init_debug()

int xemu_init_debug ( const char *  fn)

Definition at line 582 of file emutools.c.

Here is the call graph for this function:

◆ xemu_init_sdl()

int xemu_init_sdl ( void  )

Definition at line 744 of file emutools.c.

◆ xemu_is_first_time_user()

int xemu_is_first_time_user ( void  )

Definition at line 623 of file emutools.c.

◆ xemu_malloc()

void* xemu_malloc ( size_t  size)

Definition at line 226 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_malloc_ALIGNED()

void* xemu_malloc_ALIGNED ( size_t  size)

◆ xemu_os_file_exists()

int xemu_os_file_exists ( const char *  fn)

Definition at line 1725 of file emutools.c.

◆ xemu_os_readdir()

int xemu_os_readdir ( XDIR dirp,
char *  fn 
)

Definition at line 1733 of file emutools.c.

◆ xemu_post_init()

int xemu_post_init ( const char *  window_title,
int  is_resizable,
int  texture_x_size,
int  texture_y_size,
int  logical_x_size,
int  logical_y_size,
int  win_x_size,
int  win_y_size,
Uint32  pixel_format,
int  n_colours,
const Uint8 colours,
Uint32 store_palette,
int  render_scale_quality,
int  locked_texture_update,
void(*)(void)  shutdown_callback 
)

Definition at line 908 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_pre_init()

void xemu_pre_init ( const char *  app_organization,
const char *  app_name,
const char *  slogan 
)

Definition at line 651 of file emutools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xemu_realloc()

void* xemu_realloc ( void *  p,
size_t  size 
)

Definition at line 235 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_render_dummy_frame()

void xemu_render_dummy_frame ( Uint32  colour,
int  texture_x_size,
int  texture_y_size 
)

Definition at line 1132 of file emutools.c.

Here is the call graph for this function:

◆ xemu_restrdup()

void xemu_restrdup ( char **  ptr,
const char *  str 
)

Definition at line 286 of file emutools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xemu_set_full_screen()

void xemu_set_full_screen ( int  setting)

Definition at line 311 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_set_icon_from_xpm()

int xemu_set_icon_from_xpm ( char *  xpm[])

Definition at line 1066 of file emutools.c.

Here is the call graph for this function:

◆ xemu_set_screen_mode()

void xemu_set_screen_mode ( int  setting)

Definition at line 343 of file emutools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xemu_set_viewport()

void xemu_set_viewport ( unsigned int  x1,
unsigned int  y1,
unsigned int  x2,
unsigned int  y2,
unsigned int  flags 
)

Definition at line 844 of file emutools.c.

◆ xemu_start_pixel_buffer_access()

Uint32* xemu_start_pixel_buffer_access ( int *  texture_tail)

Definition at line 1153 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_strdup()

char* xemu_strdup ( const char *  s)

Definition at line 278 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_timekeeping_delay()

void xemu_timekeeping_delay ( int  td_em)

Definition at line 405 of file emutools.c.

◆ xemu_timekeeping_start()

void xemu_timekeeping_start ( void  )

Definition at line 1122 of file emutools.c.

◆ xemu_update_screen()

void xemu_update_screen ( void  )

Definition at line 1184 of file emutools.c.

Here is the caller graph for this function:

◆ xemu_window_snap_to_optimal_size()

void xemu_window_snap_to_optimal_size ( int  forced)

Definition at line 808 of file emutools.c.

Variable Documentation

◆ allow_mouse_grab

int allow_mouse_grab

Definition at line 118 of file emutools.c.

◆ EMPTY_STR

const char EMPTY_STR[]

Definition at line 57 of file emutools.c.

◆ i_am_sure_override

int i_am_sure_override

Definition at line 74 of file emutools.c.

◆ ONE_INT

const int ONE_INT

Definition at line 59 of file emutools.c.

◆ register_new_texture_creation

int register_new_texture_creation

Definition at line 84 of file emutools.c.

◆ sdl_base_dir

char * sdl_base_dir

Definition at line 139 of file emutools.h.

◆ sdl_default_win_x_size

int sdl_default_win_x_size

Definition at line 112 of file emutools.c.

◆ sdl_default_win_y_size

int sdl_default_win_y_size

Definition at line 141 of file emutools.h.

◆ sdl_inst_dir

char * sdl_inst_dir

Definition at line 139 of file emutools.h.

◆ sdl_on_wayland

int sdl_on_wayland

Definition at line 136 of file emutools.h.

◆ sdl_on_x11

int sdl_on_x11

Definition at line 81 of file emutools.c.

◆ sdl_pix_fmt

SDL_PixelFormat* sdl_pix_fmt

Definition at line 80 of file emutools.c.

◆ sdl_pref_dir

char* sdl_pref_dir

Definition at line 97 of file emutools.c.

◆ SDL_ShowMessageBox_custom

int(* SDL_ShowMessageBox_custom) (const SDL_MessageBoxData *, int *)

Definition at line 63 of file emutools.c.

◆ SDL_ShowSimpleMessageBox_custom

int(* SDL_ShowSimpleMessageBox_custom) (Uint32, const char *, const char *, SDL_Window *)

Definition at line 62 of file emutools.c.

◆ sdl_win

SDL_Window* sdl_win

Definition at line 43 of file screen.c.

◆ sdl_window_title

char* sdl_window_title

Definition at line 89 of file emutools.c.

◆ sdl_winid

Uint32 sdl_winid

Definition at line 49 of file screen.c.

◆ sdlver_compiled

SDL_version sdlver_compiled

Definition at line 86 of file configuration.c.

◆ sdlver_linked

SDL_version sdlver_linked

Definition at line 143 of file emutools.h.

◆ seconds_timer_trigger

int seconds_timer_trigger

Definition at line 101 of file emutools.c.

◆ str_are_you_sure_to_exit

const char* str_are_you_sure_to_exit

Definition at line 75 of file emutools.c.

◆ sysconsole_is_open

int sysconsole_is_open

Definition at line 109 of file emutools.c.

◆ window_title_custom_addon

char* window_title_custom_addon

Definition at line 90 of file emutools.c.

◆ window_title_info_addon

char* window_title_info_addon

Definition at line 91 of file emutools.c.

◆ xemu_app_name

char * xemu_app_name

Definition at line 137 of file emutools.h.

◆ xemu_app_org

char* xemu_app_org

Definition at line 85 of file emutools.c.

◆ xemu_frame_pixel_access_p

Uint32* xemu_frame_pixel_access_p

Definition at line 93 of file emutools.c.

◆ ZERO_INT

const int ZERO_INT

Definition at line 58 of file emutools.c.

MSG_POPUP_WINDOW
#define MSG_POPUP_WINDOW(sdlflag, title, msg, win)
Definition: emutools.h:42
debug_fp
FILE * debug_fp
Definition: configuration.c:87
sdl_window_title
char * sdl_window_title
Definition: emutools.c:89
sdl_win
SDL_Window * sdl_win
Definition: screen.c:43
NL
#define NL
Definition: fat32.c:37