diff --git a/zsnes/linux/AUTHORS b/zsnes/linux/AUTHORS new file mode 100644 index 00000000..c58d79cc --- /dev/null +++ b/zsnes/linux/AUTHORS @@ -0,0 +1,6 @@ +This is a list of people primarily responsible for the Linux port. + +Dan "theoddone33" Olson +Steven "relnev" Fuller +EvilTypeGuy +Andrew "prometheus" Henderson diff --git a/zsnes/src/gui/guiload.inc b/zsnes/src/gui/guiload.inc index 909cad68..b564dfc8 100644 --- a/zsnes/src/gui/guiload.inc +++ b/zsnes/src/gui/guiload.inc @@ -1380,20 +1380,40 @@ GUIdirStartLoc dd 0 GUInumentries dd 0 GUIdirentries dd 0 GUIfileentries dd 0 +%ifdef __LINUX__ +NEWSYM GUIsmcfind, db '*.smc',0 +NEWSYM GUIsfcfind, db '*.sfc',0 +NEWSYM GUIswcfind, db '*.swc',0 +NEWSYM GUIfigfind, db '*.fig',0 +%else NEWSYM GUIsmcfind, db '*.SMC',0 NEWSYM GUIsfcfind, db '*.SFC',0 NEWSYM GUIswcfind, db '*.SWC',0 NEWSYM GUIfigfind, db '*.FIG',0 +%endif NEWSYM GUIfind058, db '*.058',0 NEWSYM GUIfind078, db '*.078',0 +%ifdef __LINUX__ +NEWSYM GUIfindUSA, db '*.usa',0 +NEWSYM GUIfindJAP, db '*.jap',0 +NEWSYM GUIfindBIN, db '*.bin',0 +NEWSYM GUIfindZIP, db '*.zip',0 +NEWSYM GUIfindGZIP, db '*.gz',0 +%else NEWSYM GUIfindUSA, db '*.USA',0 NEWSYM GUIfindJAP, db '*.JAP',0 NEWSYM GUIfindBIN, db '*.BIN',0 NEWSYM GUIfindZIP, db '*.ZIP',0 NEWSYM GUIfindGZIP, db '*.GZ',0 +%endif NEWSYM GUIfind1, db '*.1',0 +%ifdef __LINUX__ +GUIfindDIR db '*',0 +NEWSYM GUIfindall, db '*',0 +%else GUIfindDIR db '*.*',0 NEWSYM GUIfindall, db '*.*',0 +%endif NEWSYM DTALoc, times 2048+32 db 0 ; Routines to load from the Quick Menu diff --git a/zsnes/src/linux/zfilew.c b/zsnes/src/linux/zfilew.c index d14bb214..1d8ce7bb 100644 --- a/zsnes/src/linux/zfilew.c +++ b/zsnes/src/linux/zfilew.c @@ -18,7 +18,10 @@ #include #ifdef __LINUX__ +#include +#include #include +#include #include #include #else @@ -182,7 +185,11 @@ DWORD ZFileGetFTime() DWORD ZFileMKDir() { +#ifdef __LINUX__ + return(mkdir(MKPath, 0xff)); +#else return(mkdir(MKPath)); +#endif } DWORD ZFileCHDir() @@ -214,16 +221,33 @@ DWORD DTALocPos; //}; -int FindFirstHandle; int TempFind; #ifndef __LINUX__ +int FindFirstHandle; struct _finddata_t FindDataStruct; +#else +struct dirent *next; +DIR *FindFirstHandle; +int ignoredirs=0; #endif DWORD ZFileFindNext() { #ifdef __LINUX__ - STUB_FUNCTION; + //STUB_FUNCTION; + struct stat filetype; + + next = readdir (FindFirstHandle ); + if ( next == NULL ) return -1; + + *(char *)(DTALocPos + 0x15) = 0; + + stat ( next->d_name, &filetype ); + if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); + if((ZFileFindATTRIB&0x10==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); + if ( S_ISDIR ( filetype.st_mode )) + *(char *)(DTALocPos + 0x15) = 0x10; + strcpy((char *)DTALocPos + 0x1E, next->d_name); #else TempFind=_findnext(FindFirstHandle,&FindDataStruct); if(TempFind==-1) return(-1); @@ -236,14 +260,37 @@ DWORD ZFileFindNext() if(FindDataStruct.attrib&_A_SUBDIR) *(char *)(DTALocPos+0x15)=0x10; strcpy((char *)DTALocPos+0x1E,FindDataStruct.name); if(TempFind==-1) return(-1); - return(0); #endif + return(0); } DWORD ZFileFindFirst() { #ifdef __LINUX__ - STUB_FUNCTION; + //STUB_FUNCTION; + struct stat filetype; + + FindFirstHandle = opendir ( ZFileFindPATH ); + + *(char *)(DTALocPos + 0x15) = 0; + + TempFind = 0; + + if ( FindFirstHandle==NULL ) return -1; + + next = readdir ( FindFirstHandle ); + if (next == NULL) return -1; + + stat ( next->d_name, &filetype ); + + if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); + if((ZFileFindATTRIB&0x10==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext()); + + if ( S_ISDIR ( filetype.st_mode )) + *(char *)(DTALocPos + 0x15) = 0x10; + + strcpy ((char *) DTALocPos + 0x1E, next->d_name); + #else FindFirstHandle=_findfirst(ZFileFindPATH,&FindDataStruct); *(char *)(DTALocPos+0x15)=0; @@ -255,19 +302,20 @@ DWORD ZFileFindFirst() if(FindDataStruct.attrib&_A_SUBDIR) *(char *)(DTALocPos+0x15)=0x10; strcpy((char *) DTALocPos+0x1E,FindDataStruct.name); if(FindFirstHandle==-1) return(-1); - return(0); #endif + return(0); } DWORD ZFileFindEnd() // for compatibility with windows later { #ifdef __LINUX__ - STUB_FUNCTION; + //STUB_FUNCTION; + closedir(FindFirstHandle); #else _findclose(FindFirstHandle); - return(0); #endif + return(0); }