Moved fs.c to fs-windows.c and added some dummy fs-linux.c
This commit is contained in:
parent
1c1aa297f2
commit
3de4593edf
|
@ -3,6 +3,12 @@ AC_INIT(desmume, 0.3.3)
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AC_CANONICAL_TARGET
|
AC_CANONICAL_TARGET
|
||||||
|
|
||||||
|
case $target in
|
||||||
|
*linux*) desmume_arch=linux;;
|
||||||
|
*mingw*) desmume_arch=windows;;
|
||||||
|
esac
|
||||||
|
AC_SUBST(desmume_arch)
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE(desmume, 0.3.3)
|
AM_INIT_AUTOMAKE(desmume, 0.3.3)
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
|
@ -9,4 +9,5 @@ libdesmume_a_SOURCES = \
|
||||||
GPU.cpp GPU.hpp debug.c debug.h \
|
GPU.cpp GPU.hpp debug.c debug.h \
|
||||||
MMU.cpp MMU.hpp NDSSystem.cpp NDSSystem.hpp \
|
MMU.cpp MMU.hpp NDSSystem.cpp NDSSystem.hpp \
|
||||||
thumb_instructions.cpp thumb_instructions.hpp \
|
thumb_instructions.cpp thumb_instructions.hpp \
|
||||||
windows/cflash.cpp windows/cflash.h fs.c fs.h
|
windows/cflash.cpp windows/cflash.h fs.h
|
||||||
|
libdesmume_a_LIBADD = fs-$(desmume_arch).$(OBJEXT)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#include "fs.h"
|
||||||
|
|
||||||
|
void * FsReadFirst(const char * path, FsEntry * entry) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FsReadNext(void * search, FsEntry * entry) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FsClose(void * search) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int FsError(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
#include "fs.h"
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
void * FsReadFirst(const char * path, FsEntry * entry) {
|
||||||
|
WIN32_FIND_DATA FindFileData;
|
||||||
|
HANDLE hFind;
|
||||||
|
HANDLE * ret;
|
||||||
|
|
||||||
|
hFind = FindFirstFile(path, &FindFileData);
|
||||||
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
strcpy(entry->cFileName, FindFileData.cFileName);
|
||||||
|
strcpy(entry->cAlternateFileName, FindFileData.cAlternateFileName);
|
||||||
|
entry->flags = 0;
|
||||||
|
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
entry->flags = FS_IS_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = malloc(sizeof(HANDLE));
|
||||||
|
*ret = hFind;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FsReadNext(void * search, FsEntry * entry) {
|
||||||
|
WIN32_FIND_DATA FindFileData;
|
||||||
|
HANDLE * h = (HANDLE *) search;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = FindNextFile(*h, &FindFileData);
|
||||||
|
|
||||||
|
strcpy(entry->cFileName, FindFileData.cFileName);
|
||||||
|
strcpy(entry->cAlternateFileName, FindFileData.cAlternateFileName);
|
||||||
|
entry->flags = 0;
|
||||||
|
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
entry->flags = FS_IS_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FsClose(void * search) {
|
||||||
|
FindClose(*((HANDLE *) search));
|
||||||
|
}
|
||||||
|
|
||||||
|
int FsError(void) {
|
||||||
|
if (GetLastError() == ERROR_NO_MORE_FILES)
|
||||||
|
return FS_ERR_NO_MORE_FILES;
|
||||||
|
}
|
Loading…
Reference in New Issue