wip:libdragon

This commit is contained in:
lif 2023-12-12 20:08:12 -08:00
parent 895fb075c3
commit 6218568cc5
2 changed files with 47 additions and 3 deletions

View File

@ -434,6 +434,20 @@ else ifeq ($(platform), ps2)
CPU_ARCH := mips
STATIC_LINKING = 1
# Nintendo 64
else ifeq ($(platform), n64)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(N64_INST)/bin/mips64-elf-gcc$(EXE_EXT)
CXX = $(N64_INST)/bin/mips64-elf-g++$(EXE_EXT)
AR = $(N64_INST)/bin/mips64-elf-ar$(EXE_EXT)
CFLAGS += -fomit-frame-pointer -ffast-math
CFLAGS += -DNINTENDO64 -DUSE_XBGR1555_FORMAT -DSMALL_TRANSLATION_CACHE -DROM_BUFFER_SIZE=4
CFLAGS += -I$(N64_INST)/include/
HAVE_DYNAREC = 1
CPU_ARCH := mips
STATIC_LINKING = 1
FRONTEND_SUPPORTS_RGB565 = 0
# emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc

View File

@ -51,9 +51,12 @@
# if defined(PSP)
# include <pspiofilemgr.h>
# endif
# if defined(NINTENDO64)
# include <libdragon.h>
# endif
# include <sys/types.h>
# include <sys/stat.h>
# if !defined(VITA)
# if !defined(VITA) && !defined(NINTENDO64)
# include <dirent.h>
# endif
# include <unistd.h>
@ -75,7 +78,9 @@
# endif
# include <sys/types.h>
# include <sys/stat.h>
# include <dirent.h>
# if !defined(NINTENDO64)
# include <dirent.h>
# endif
# include <unistd.h>
#endif
@ -615,7 +620,7 @@ int64_t retro_vfs_file_truncate_impl(libretro_vfs_implementation_file *stream, i
stream->size = length;
return 0;
}
#elif !defined(VITA) && !defined(PSP) && !defined(PS2) && !defined(ORBIS) && (!defined(SWITCH) || defined(HAVE_LIBNX))
#elif !defined(VITA) && !defined(PSP) && !defined(PS2) && !defined(ORBIS) && (!defined(SWITCH) || defined(HAVE_LIBNX)) && !defined(NINTENDO64)
if (stream && ftruncate(fileno(stream->fp), (off_t)length) == 0)
{
stream->size = length;
@ -1021,6 +1026,9 @@ int retro_vfs_mkdir_impl(const char *dir)
free(dir_buf);
}
}
#elif defined(NINTENDO64)
int ret = 0;
return -1;
#else
int ret = mkdir(dir, 0750);
#endif
@ -1053,6 +1061,10 @@ struct libretro_vfs_implementation_dir
int error;
int directory;
sysFSDirent entry;
#elif defined(NINTENDO64)
bool directory;
unsigned flags;
char path[1024];
#else
DIR *directory;
const struct dirent *entry;
@ -1128,6 +1140,11 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
rdir->entry = NULL;
#elif defined(__PSL1GHT__) || defined(__PS3__)
rdir->error = sysFsOpendir(name, &rdir->directory);
#elif defined(NINTENDO64)
if (dfs_chdir(name) != DFS_ESUCCESS) return NULL;
rdir->flags = 0xff;
rdir->directory = true;
rdir->path[0] = 0;
#else
rdir->directory = opendir(name);
rdir->entry = NULL;
@ -1165,6 +1182,13 @@ bool retro_vfs_readdir_impl(libretro_vfs_implementation_dir *rdir)
uint64_t nread;
rdir->error = sysFsReaddir(rdir->directory, &rdir->entry, &nread);
return (nread != 0);
#elif defined(NINTENDO64)
if (rdir->flags == 0xff) {
rdir->flags = dfs_dir_findfirst(".", rdir->path);
} else {
rdir->flags = dfs_dir_findnext(rdir->path);
}
return rdir->flags != FLAGS_EOF;
#else
return ((rdir->entry = readdir(rdir->directory)) != NULL);
#endif
@ -1185,6 +1209,8 @@ const char *retro_vfs_dirent_get_name_impl(libretro_vfs_implementation_dir *rdir
return (char*)rdir->entry.cFileName;
#elif defined(VITA) || defined(__PSL1GHT__) || defined(__PS3__)
return rdir->entry.d_name;
#elif defined(NINTENDO64)
return rdir->path;
#else
if (!rdir || !rdir->entry)
return NULL;
@ -1203,6 +1229,8 @@ bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *rdir)
#elif defined(__PSL1GHT__) || defined(__PS3__)
sysFSDirent *entry = (sysFSDirent*)&rdir->entry;
return (entry->d_type == FS_TYPE_DIR);
#elif defined(NINTENDO64)
return rdir->flags & FLAGS_DIR;
#else
struct stat buf;
char path[PATH_MAX_LENGTH];
@ -1234,6 +1262,8 @@ int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *rdir)
sceIoDclose(rdir->directory);
#elif defined(__PSL1GHT__) || defined(__PS3__)
rdir->error = sysFsClosedir(rdir->directory);
#elif defined(NINTENDO64)
#else
if (rdir->directory)
closedir(rdir->directory);