Config files and save states are now stored in ~/.zsnes

This commit is contained in:
teuf
2001-04-22 17:49:49 +00:00
parent 23742cd694
commit 26dc931297
5 changed files with 116 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
EXTSYM dssel, selcA000, selcB800, selc0040, previdmode, DosExit, ZFileSystemInit
EXTSYM getcmdline,GUIRestoreVars,getcfg,obtaindir,ConvertJoyMap,tparms
EXTSYM preparedir,getblaster,Force8b,SBHDMA
EXTSYM SRAMDir
EXTSYM ccmdline
EXTSYM FilenameStart
EXTSYM spcon
@@ -249,20 +250,33 @@ NEWSYM SystemInit
mov byte[cfgsoundon],1
; Get and set the initial directory
%ifdef __LINUX__
call obtaindir
%else
mov ebx,InitDir
mov edx,InitDrive
call Get_Dir
%endif
mov dl,[InitDrive]
mov ebx,InitDir
call Change_Dir
call GUIRestoreVars ; Load GUI stuff
call getcfg ; Load cfg stuff
call obtaindir ; Get Save/Init Directories
call ConvertJoyMap ; Mini joystick init
call ccmdline
call tparms
%ifndef __LINUX__
call preparedir
%else
mov ebx,SRAMDir
call Change_Dir
%endif
mov byte[soundon],0
; call getblaster ; get set blaster environment
; cmp byte[Force8b],1

View File

@@ -451,4 +451,38 @@ int _getdrive( void )
{
// STUB_FUNCTION;
}
extern char SRAMDir;
extern char InitDir;
extern char LoadDir;
void obtaindir()
{
char *cfgdir = NULL;
char *homedir = NULL;
DIR *tmp;
if ((homedir = (char *)getenv("HOME"))==NULL) {
homedir = (char *)malloc(128);
getcwd(homedir, 128);
}
cfgdir = (char *)malloc(strlen(homedir)+strlen("/.zsnes"));
strcpy(cfgdir, homedir);
strcat(cfgdir, "/.zsnes");
tmp = opendir(cfgdir);
if (tmp == NULL) {
MKPath = cfgdir;
ZFileMKDir();
} else {
closedir(tmp);
}
strcpy(&InitDir, cfgdir);
if (SRAMDir == 0){
strcpy(&SRAMDir, cfgdir);
}
free(cfgdir);
if (LoadDir == 0) {
getcwd(&LoadDir, 128);
}
}
#endif