Xemu [doxygen]  hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
Macros | Functions | Variables
emutools.c File Reference
#include "xemu/emutools.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <limits.h>
#include <errno.h>
#include "build/xemu-48x48.xpm"
Include dependency graph for emutools.c:

Go to the source code of this file.

Macros

#define __TIMING_METHOD_DESC   "SDL_GetPerformanceCounter"
 

Functions

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)
 
struct tm * xemu_get_localtime (void)
 
time_t xemu_get_unixtime (void)
 
unsigned int xemu_get_microseconds (void)
 
Uint8 xemu_hour_to_bcd12h (Uint8 hours, int hour_offset)
 
void * xemu_malloc (size_t size)
 
void * xemu_realloc (void *p, size_t size)
 
void * _xemu_malloc_ALIGNED_emulated (size_t size)
 
char * xemu_strdup (const char *s)
 
void xemu_restrdup (char **ptr, const char *str)
 
void xemu_drop_events (void)
 
void xemu_set_full_screen (int setting)
 
void xemu_set_screen_mode (int setting)
 
void xemu_timekeeping_delay (int td_em)
 
const char * xemu_get_uname_string (void)
 
void xemu_get_timing_stat_string (char *buf, unsigned int size)
 
int xemu_init_debug (const char *fn)
 
int xemu_is_first_time_user (void)
 
void xemu_pre_init (const char *app_organization, const char *app_name, const char *slogan)
 
int xemu_init_sdl (void)
 
void xemu_window_snap_to_optimal_size (int forced)
 
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)
 
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)
 
int ARE_YOU_SURE (const char *s, int flags)
 
int _sdl_emu_secured_modal_box_ (const char *items_in, const char *msg)
 
void sysconsole_open (void)
 
void sysconsole_close (const char *waitmsg)
 
int sysconsole_toggle (int set)
 
int xemu_os_file_exists (const char *fn)
 
int xemu_os_readdir (XDIR *dirp, char *fn)
 
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)
 

Variables

const char EMPTY_STR [] = ""
 
const int ZERO_INT = 0
 
const int ONE_INT = 1
 
int(* SDL_ShowSimpleMessageBox_custom )(Uint32, const char *, const char *, SDL_Window *) = SDL_ShowSimpleMessageBox
 
int(* SDL_ShowMessageBox_custom )(const SDL_MessageBoxData *, int *) = SDL_ShowMessageBox
 
int i_am_sure_override = 0
 
const char * str_are_you_sure_to_exit = "Are you sure to exit Xemu?"
 
SDL_Window * sdl_win = NULL
 
SDL_Renderer * sdl_ren = NULL
 
SDL_Texture * sdl_tex = NULL
 
SDL_PixelFormat * sdl_pix_fmt
 
int sdl_on_x11 = 0
 
int sdl_on_wayland = 0
 
int register_new_texture_creation = 0
 
char * xemu_app_org = NULL
 
char * xemu_app_name = NULL
 
char * sdl_window_title = (char*)default_window_title
 
char * window_title_custom_addon = NULL
 
char * window_title_info_addon = NULL
 
Uint32sdl_pixel_buffer = NULL
 
Uint32xemu_frame_pixel_access_p = NULL
 
int texture_x_size_in_bytes
 
int emu_is_fullscreen = 0
 
char * sdl_pref_dir = NULL
 
char * sdl_base_dir = NULL
 
char * sdl_inst_dir = NULL
 
Uint32 sdl_winid
 
int seconds_timer_trigger
 
SDL_version sdlver_compiled
 
SDL_version sdlver_linked
 
int sysconsole_is_open = 0
 
FILE * debug_fp = NULL
 
int chatty_xemu = 1
 
int sdl_default_win_x_size
 
int sdl_default_win_y_size
 
int allow_mouse_grab = 1
 

Macro Definition Documentation

◆ __TIMING_METHOD_DESC

#define __TIMING_METHOD_DESC   "SDL_GetPerformanceCounter"

Function Documentation

◆ _sdl_emu_secured_modal_box_()

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

Definition at line 1220 of file emutools.c.

Here is the call graph for this function:

◆ _xemu_malloc_ALIGNED_emulated()

void* _xemu_malloc_ALIGNED_emulated ( size_t  size)

Definition at line 244 of file emutools.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:

◆ 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_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 = 1

Definition at line 118 of file emutools.c.

◆ chatty_xemu

int chatty_xemu = 1

Definition at line 111 of file emutools.c.

◆ debug_fp

FILE* debug_fp = NULL

Definition at line 110 of file emutools.c.

◆ EMPTY_STR

const char EMPTY_STR[] = ""

Definition at line 57 of file emutools.c.

◆ emu_is_fullscreen

int emu_is_fullscreen = 0

Definition at line 95 of file emutools.c.

◆ i_am_sure_override

int i_am_sure_override = 0

Definition at line 74 of file emutools.c.

◆ ONE_INT

const int ONE_INT = 1

Definition at line 59 of file emutools.c.

◆ register_new_texture_creation

int register_new_texture_creation = 0

Definition at line 84 of file emutools.c.

◆ sdl_base_dir

char * sdl_base_dir = NULL

Definition at line 97 of file emutools.c.

◆ 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 113 of file emutools.c.

◆ sdl_inst_dir

char * sdl_inst_dir = NULL

Definition at line 97 of file emutools.c.

◆ sdl_on_wayland

int sdl_on_wayland = 0

Definition at line 81 of file emutools.c.

◆ sdl_on_x11

int sdl_on_x11 = 0

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_pixel_buffer

Uint32* sdl_pixel_buffer = NULL

Definition at line 92 of file emutools.c.

◆ sdl_pref_dir

char* sdl_pref_dir = NULL

Definition at line 97 of file emutools.c.

◆ sdl_ren

SDL_Renderer* sdl_ren = NULL

Definition at line 78 of file emutools.c.

◆ SDL_ShowMessageBox_custom

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

Definition at line 63 of file emutools.c.

◆ SDL_ShowSimpleMessageBox_custom

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

Definition at line 62 of file emutools.c.

◆ sdl_tex

SDL_Texture* sdl_tex = NULL

Definition at line 79 of file emutools.c.

◆ sdl_win

SDL_Window* sdl_win = NULL

Definition at line 77 of file emutools.c.

◆ sdl_window_title

char* sdl_window_title = (char*)default_window_title

Definition at line 89 of file emutools.c.

◆ sdl_winid

Uint32 sdl_winid

Definition at line 98 of file emutools.c.

◆ sdlver_compiled

SDL_version sdlver_compiled

Definition at line 102 of file emutools.c.

◆ sdlver_linked

SDL_version sdlver_linked

Definition at line 102 of file emutools.c.

◆ 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 = "Are you sure to exit Xemu?"

Definition at line 75 of file emutools.c.

◆ sysconsole_is_open

int sysconsole_is_open = 0

Definition at line 109 of file emutools.c.

◆ texture_x_size_in_bytes

int texture_x_size_in_bytes

Definition at line 94 of file emutools.c.

◆ window_title_custom_addon

char* window_title_custom_addon = NULL

Definition at line 90 of file emutools.c.

◆ window_title_info_addon

char* window_title_info_addon = NULL

Definition at line 91 of file emutools.c.

◆ xemu_app_name

char * xemu_app_name = NULL

Definition at line 85 of file emutools.c.

◆ xemu_app_org

char* xemu_app_org = NULL

Definition at line 85 of file emutools.c.

◆ xemu_frame_pixel_access_p

Uint32* xemu_frame_pixel_access_p = NULL

Definition at line 93 of file emutools.c.

◆ ZERO_INT

const int ZERO_INT = 0

Definition at line 58 of file emutools.c.