This commit is contained in:
twinaphex 2015-09-21 11:19:00 +02:00
parent 6039e44567
commit dc69e46514
5 changed files with 33 additions and 3 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.o

View file

@ -41,6 +41,7 @@
#include <windows.h>
#endif
#elif defined(VITA)
#define SCE_ERROR_ERRNO_EEXIST 0x80010011
#include <psp2/io/fcntl.h>
#include <psp2/io/dirent.h>
#include <psp2/io/stat.h>
@ -566,8 +567,13 @@ static bool path_mkdir_norecurse(const char *dir)
ret = mkdir(dir, 0750);
#endif
/* Don't treat this as an error. */
#if defined(VITA)
if ((ret == SCE_ERROR_ERRNO_EEXIST) && path_is_directory(dir))
ret = 0;
#else
if (ret < 0 && errno == EEXIST && path_is_directory(dir))
ret = 0;
#endif
if (ret < 0)
printf("mkdir(%s) error: %s.\n", dir, strerror(errno));
return ret == 0;

View file

@ -22,6 +22,12 @@
#elif defined(VITA)
# include <psp2/io/fcntl.h>
# include <psp2/io/dirent.h>
#define PSP_O_RDONLY PSP2_O_RDONLY
#define PSP_O_RDWR PSP2_O_RDWR
#define PSP_O_CREAT PSP2_O_CREAT
#define PSP_O_WRONLY PSP2_O_WRONLY
#define PSP_O_TRUNC PSP2_O_TRUNC
#else
# if defined(PSP)
# include <pspiofilemgr.h>
@ -89,7 +95,7 @@ RFILE *retro_fopen(const char *path, unsigned mode, ssize_t len)
case RFILE_MODE_READ:
#if defined(VITA) || defined(PSP)
mode_int = 0777;
flags = O_RDONLY;
flags = PSP_O_RDONLY;
#elif defined(HAVE_BUFFERED_IO)
mode_str = "rb";
#else
@ -99,7 +105,7 @@ RFILE *retro_fopen(const char *path, unsigned mode, ssize_t len)
case RFILE_MODE_WRITE:
#if defined(VITA) || defined(PSP)
mode_int = 0777;
flags = O_WRONLY | O_CREAT;
flags = PSP_O_CREAT | PSP_O_WRONLY | PSP_O_TRUNC;
#elif defined(HAVE_BUFFERED_IO)
mode_str = "wb";
#else
@ -109,7 +115,7 @@ RFILE *retro_fopen(const char *path, unsigned mode, ssize_t len)
case RFILE_MODE_READ_WRITE:
#if defined(VITA) || defined(PSP)
mode_int = 0777;
flags = O_RDWR;
flags = PSP_O_RDWR;
#elif defined(HAVE_BUFFERED_IO)
mode_str = "w+";
#else

View file

@ -34,24 +34,39 @@ static bool write_header_bmp(RFILE *file, unsigned width, unsigned height)
/* Generic BMP stuff. */
const uint8_t header[] = {
/* signature */
'B', 'M',
/* file size */
(uint8_t)(size >> 0), (uint8_t)(size >> 8),
(uint8_t)(size >> 16), (uint8_t)(size >> 24),
/* reserved */
0, 0, 0, 0,
/* offset */
54, 0, 0, 0,
/* DIB size */
40, 0, 0, 0,
/* width */
(uint8_t)(width >> 0), (uint8_t)(width >> 8),
(uint8_t)(width >> 16), (uint8_t)(width >> 24),
/* height */
(uint8_t)(height >> 0), (uint8_t)(height >> 8),
(uint8_t)(height >> 16), (uint8_t)(height >> 24),
/* color planes */
1, 0,
/* bits per pixel */
24, 0,
/* compression method */
0, 0, 0, 0,
/* image data size */
(uint8_t)(size_array >> 0), (uint8_t)(size_array >> 8),
(uint8_t)(size_array >> 16), (uint8_t)(size_array >> 24),
/* horizontal resolution */
19, 11, 0, 0,
/* vertical resolution */
19, 11, 0, 0,
/* palette size */
0, 0, 0, 0,
/* important color count */
0, 0, 0, 0
};

View file

@ -50,7 +50,9 @@
#include <limits.h>
#ifdef _MSC_VER
#include <compat/msvc.h>
#endif
#include <retro_inline.h>
#ifndef PATH_MAX_LENGTH