diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2010-02-12 15:40:11 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2010-02-12 15:40:11 +0000 |
commit | 0a6b13608da1cff0d1be55dad5ae3b53e111e5f8 (patch) | |
tree | c915daeb2337183dc75ce485438e88cf7147a6da /src/osd/osdcore.h | |
parent | 76d0a58a18f1f9be36777fd55e7ad259426d5165 (diff) |
- Moved natural keyboard support from MESS to MAME
- Moved OSD file functions and clipboard access functions into OSD core
Diffstat (limited to 'src/osd/osdcore.h')
-rw-r--r-- | src/osd/osdcore.h | 233 |
1 files changed, 231 insertions, 2 deletions
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index 67bfda407e2..795b30a5fed 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -50,8 +50,6 @@ #include "osdcomm.h" - - /*************************************************************************** FILE I/O INTERFACES ***************************************************************************/ @@ -86,6 +84,17 @@ typedef enum _file_error file_error; /* osd_file is an opaque type which represents an open file */ typedef struct _osd_file osd_file; +enum +{ + OSD_FOPEN_READ, + OSD_FOPEN_WRITE, + OSD_FOPEN_RW, + OSD_FOPEN_RW_CREATE +}; + + +struct _mame_file; + /*----------------------------------------------------------------------------- osd_open: open a new file. @@ -810,5 +819,225 @@ void osd_free_executable(void *ptr, size_t size); -----------------------------------------------------------------------------*/ void osd_break_into_debugger(const char *message); +/*************************************************************************** + FILE I/O INTERFACES +***************************************************************************/ + +/*----------------------------------------------------------------------------- + osd_copyfile: copies a file + + Parameters: + + destfile - path to destination + + srcfile - path to source file + + Return value: + + a file_error describing any error that occurred while copying + the file, or FILERR_NONE if no error occurred +-----------------------------------------------------------------------------*/ +file_error osd_copyfile(const char *destfile, const char *srcfile); + + +/*----------------------------------------------------------------------------- + osd_get_temp_filename: given a filename, return a full path with that + filename but in a temporary directory + + Parameters: + + buffer - pointer to buffer + + buffer_len - length of buffer + + basename - basename of file to create + + Return value: + + a file_error describing any error that occurred while copying + the file, or FILERR_NONE if no error occurred +-----------------------------------------------------------------------------*/ +file_error osd_get_temp_filename(char *buffer, size_t buffer_len, const char *basename); + + +/*************************************************************************** + DIRECTORY INTERFACES +***************************************************************************/ + +/*----------------------------------------------------------------------------- + osd_stat: return a directory entry for a path + + Parameters: + + path - path in question + + Return value: + + an allocated pointer to an osd_directory_entry representing + info on the path; even if the file does not exist + +-----------------------------------------------------------------------------*/ +osd_directory_entry *osd_stat(const char *path); + + +/*----------------------------------------------------------------------------- + osd_mkdir: creates a directory + + Parameters: + + dir - path to directory to create + + Return value: + + a file_error describing any error that occurred while creating + the directory, or FILERR_NONE if no error occurred +-----------------------------------------------------------------------------*/ +file_error osd_mkdir(const char *dir); + + +/*----------------------------------------------------------------------------- + osd_rmdir: removes a directory + + Parameters: + + dir - path to directory to removes + + Return value: + + a file_error describing any error that occurred while deleting + the directory, or FILERR_NONE if no error occurred +-----------------------------------------------------------------------------*/ +file_error osd_rmdir(const char *dir); + + +/*----------------------------------------------------------------------------- + osd_getcurdir: retrieves the current working directory + + Parameters: + + buffer - place to store current working directory + + buffer_len - length of buffer + + Return value: + + a file_error describing any error that occurred while deleting + the directory, or FILERR_NONE if no error occurred +-----------------------------------------------------------------------------*/ +file_error osd_getcurdir(char *buffer, size_t buffer_len); + + +/*----------------------------------------------------------------------------- + osd_setcurdir: sets the current working directory + + Parameters: + + dir - path to directory to which to change + + Return value: + + a file_error describing any error that occurred while deleting + the directory, or FILERR_NONE if no error occurred +-----------------------------------------------------------------------------*/ +file_error osd_setcurdir(const char *dir); + + +/*************************************************************************** + PATH INTERFACES +***************************************************************************/ + +/*----------------------------------------------------------------------------- + osd_get_emulator_directory: returns the path containing the emulator + + Parameters: + + dir - space to output directory + dir_size - size of path + +-----------------------------------------------------------------------------*/ + +void osd_get_emulator_directory(char *dir, size_t dir_size); + +/*----------------------------------------------------------------------------- + osd_is_path_separator: returns whether a character is a path separator + + Parameters: + + c - the character in question + + Return value: + + non-zero if the character is a path separator, zero otherwise + +-----------------------------------------------------------------------------*/ +int osd_is_path_separator(char c); + + +/*----------------------------------------------------------------------------- + osd_dirname: returns the base directory of a file path + + Parameters: + + filename - the path in question + + Return value: + + an allocated path to the directory containing this file + +-----------------------------------------------------------------------------*/ +char *osd_dirname(const char *filename); + + +/*----------------------------------------------------------------------------- + osd_basename: returns the file or directory name from a full path + + Parameters: + + filename - the path in question + + Return value: + + a pointer to the base name of the file + +-----------------------------------------------------------------------------*/ +char *osd_basename(char *filename); + + +/*----------------------------------------------------------------------------- + osd_get_full_path: retrieves the full path + + Parameters: + + path - the path in question + dst - pointer to receive new path; the returned string needs to be free()-ed! + + Return value: + + file error + +-----------------------------------------------------------------------------*/ +file_error osd_get_full_path(char **dst, const char *path); + + + +/*************************************************************************** + UNCATEGORIZED INTERFACES +***************************************************************************/ + + +/* reads text from the clipboard - the returned string needs to be free()-ed! */ +char *osd_get_clipboard_text(void); + + + +/****************************************************************************** + + Device and file browsing + +******************************************************************************/ + +int osd_num_devices(void); +const char *osd_get_device_name(int idx); + #endif /* __OSDEPEND_H__ */ |