Code cleanup. Save location can now be edited in GUI. *nix can now correctly save in a location other than ~/.zsnes
This commit is contained in:
@@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#include "gblhdr.h"
|
||||
#else
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define StringA "FRAMESKIP"
|
||||
@@ -48,8 +49,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#define StringI "VIDEOMODEDOS"
|
||||
#endif
|
||||
#define StringJ "EXECUTE"
|
||||
/* StringK is unused */
|
||||
#define StringK "SOUNDBUFDISABLE"
|
||||
#define StringM "STEREO"
|
||||
#define StringN "GUIDISABLE"
|
||||
#define StringO "SCANLINES"
|
||||
@@ -120,7 +119,6 @@ extern unsigned char cvidmode;
|
||||
extern unsigned char antienab;
|
||||
extern unsigned char StereoSound;
|
||||
extern unsigned int SoundQuality;
|
||||
extern char SRAMDir[512];
|
||||
extern unsigned char MusicRelVol;
|
||||
extern unsigned char Force8b;
|
||||
extern unsigned char scanlines;
|
||||
@@ -143,13 +141,11 @@ extern unsigned int ZOpenFile(); //Create_File. Open_File
|
||||
extern unsigned int ZFileWrite(); //Write_File();
|
||||
extern unsigned int ZCloseFile(); //Close_File
|
||||
#ifdef __LINUX__
|
||||
/* if TextFile==0, zlib functions aren't used
|
||||
useful to save the config file*/
|
||||
|
||||
extern char *InitDir; /* 512 unsigned chars */
|
||||
extern char *InitDrive; /* 2 unsigned chars */
|
||||
extern char zcfgdir[1024];
|
||||
#endif
|
||||
|
||||
char SRAMDir[1024];
|
||||
|
||||
char LoadDriveB[2];
|
||||
char LoadDirB[128];
|
||||
|
||||
@@ -375,7 +371,7 @@ void DOScreatenewcfg()
|
||||
}
|
||||
|
||||
#ifdef __LINUX__
|
||||
chdir(SRAMDir);
|
||||
chdir(zcfgdir);
|
||||
#endif
|
||||
|
||||
ZOpenFileName = CMDLineStr;
|
||||
@@ -571,18 +567,7 @@ void DOScreatenewcfg()
|
||||
WRITE_LINE("; Savefile directory. Leave it blank if you want the save files to be in the\r\n");
|
||||
WRITE_LINE("; same directory as the games. It should be in a format like : C:\\dir\\dir\r\n\r\n");
|
||||
|
||||
if (cfgloadsdir == 1)
|
||||
{
|
||||
#ifdef __LINUX__
|
||||
sprintf(buffer, "SaveDirectory = %s\r\n\r\n", SRAMDir);
|
||||
#else
|
||||
sprintf(buffer, "SaveDirectory = %c:\\%s\r\n\r\n", (char) (*SRAMDrive + 65), SRAMDir);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buffer, "SaveDirectory = \r\n\r\n");
|
||||
}
|
||||
sprintf(buffer, "SaveDirectory = %s\r\n\r\n", SRAMDir);
|
||||
SAVE_LINE(buffer);
|
||||
|
||||
WRITE_LINE("; Game directory. This is the directory where the GUI starts at.\r\n");
|
||||
@@ -1250,22 +1235,11 @@ void getcfg()
|
||||
{
|
||||
if (!strcmp(_stringa, StringS))
|
||||
{
|
||||
if (_strlenb >= 3)
|
||||
if (_strlenb >= 1)
|
||||
{
|
||||
#ifndef __LINUX__
|
||||
if (_stringb[1] == ':' && _stringb[2] == '\\')
|
||||
{
|
||||
cfgloadsdir = 1;
|
||||
SRAMDrive[0] = _stringb[0] - 65;
|
||||
strncpy(SRAMDir, _stringb + 3, _strlenb - 3);
|
||||
SRAMDir[_strlenb - 3] = '\0';
|
||||
}
|
||||
#else
|
||||
cfgloadsdir = 1;
|
||||
strncpy(SRAMDir, _stringb, _strlenb);
|
||||
SRAMDir[_strlenb]='\0';
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1515,3 +1489,23 @@ void getcfg()
|
||||
DOScreatenewcfg();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char SRAMChdirFail = 0;
|
||||
|
||||
void SRAMChdir()
|
||||
{
|
||||
if (!chdir(SRAMDir))
|
||||
{
|
||||
SRAMChdirFail = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SRAMChdirFail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void SRAMDirCurDir()
|
||||
{
|
||||
getcwd(SRAMDir,1024);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ EXTSYM nextmenupopup
|
||||
EXTSYM MovieProcessing
|
||||
EXTSYM MovieFileHand, PrintStr
|
||||
EXTSYM OSExit,DosExit,InitDir,InitDrive,createnewcfg,fnames,gotoroot,previdmode
|
||||
EXTSYM ramsize,sfxramdata,setaramdata,SETAEnable,sram,SRAMDrive,SRAMDir,welcome
|
||||
EXTSYM ramsize,sfxramdata,setaramdata,SETAEnable,sram,SRAMChdir,welcome
|
||||
; EXTSYM tempstore
|
||||
EXTSYM printhex
|
||||
%ifdef __MSDOS__
|
||||
@@ -1429,9 +1429,9 @@ NEWSYM statesaver
|
||||
; jmp .skipsaves
|
||||
; Save State
|
||||
%ifdef __LINUX__
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
%endif
|
||||
mov edx,fnamest+1
|
||||
call Create_File
|
||||
@@ -1831,9 +1831,9 @@ NEWSYM loadstate
|
||||
mov byte[multchange],1
|
||||
clim
|
||||
%ifdef __LINUX__
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
%endif
|
||||
; Get the state number
|
||||
mov ebx,[statefileloc]
|
||||
|
||||
@@ -463,10 +463,6 @@ NEWSYM Get_Key
|
||||
int 21h
|
||||
ret
|
||||
|
||||
; mov dl,[SRAMDrive]
|
||||
; mov ebx,SRAMDir
|
||||
; call Change_Dir
|
||||
|
||||
NEWSYM Change_Drive
|
||||
; change to drive in dl (0 = A, 1 = B, etc.)
|
||||
mov ah,0Eh
|
||||
|
||||
@@ -73,7 +73,7 @@ EXTSYM curblank, vidpastecopyscr, frameskip, newengen, vsyncon
|
||||
EXTSYM cvidmode, antienab, smallscreenon, smallscreence,NetQuit
|
||||
EXTSYM soundon, StereoSound, SoundQuality, MusicRelVol
|
||||
EXTSYM endprog, continueprog, spcBuffera, spcRamcmp, cbitmode, makepal
|
||||
EXTSYM t1cc, LoadDir, SRAMDir, LoadDrive,SRAMDrive, initsnes, romloadskip
|
||||
EXTSYM t1cc, LoadDir, LoadDrive, SRAMDir, SRAMChdir, SRAMDirCurDir, initsnes, romloadskip
|
||||
EXTSYM fname, makeextension, sram, loadfileGUI, GUIloadfailed
|
||||
EXTSYM SetupROM,CheckROMType, romdata, ForcePal, ramsize, ramsizeand, curromsize
|
||||
EXTSYM romispal, totlines, cfgloadsdir, init65816, procexecloop
|
||||
@@ -630,7 +630,6 @@ NEWSYM hqFilter, db 0
|
||||
NEWSYM reserved, db 0
|
||||
NEWSYM scale2xFilter, db 0
|
||||
NEWSYM st010difficulty, db 0 ; place holder till we commit the other Seta 10 file
|
||||
NEWSYM SRAMPath, times 1024 db 0
|
||||
NEWSYM SnapPath, times 1024 db 0
|
||||
NEWSYM SPCPath, times 1024 db 0
|
||||
NEWSYM BSXPath, times 1024 db 0
|
||||
@@ -1473,9 +1472,9 @@ SECTION .text
|
||||
|
||||
NEWSYM SaveSramData
|
||||
; change to sram dir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
|
||||
cmp byte[sramsavedis],1
|
||||
je .savesramdone
|
||||
@@ -1834,9 +1833,9 @@ NEWSYM StartGUI
|
||||
call SaveSramData
|
||||
|
||||
; change to sram dir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
|
||||
call GUIQuickLoadUpdate
|
||||
call LoadDetermine
|
||||
@@ -2060,9 +2059,9 @@ NEWSYM StartGUI
|
||||
cmp byte[CheatWinMode],0
|
||||
je near .csskip
|
||||
; change to sram dir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
|
||||
; Load Cheat Search File
|
||||
mov edx,cstempfname
|
||||
@@ -2488,9 +2487,9 @@ NEWSYM StartGUI
|
||||
call GUISaveVars
|
||||
|
||||
; change dir to SRAMDrive/SRAMDir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
|
||||
mov byte[MousePRClick],1
|
||||
mov byte[prevbright],0
|
||||
@@ -2587,9 +2586,9 @@ SRAMDirc:
|
||||
mov edx,LoadDrive
|
||||
call Get_Dir
|
||||
; change to sram dir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
ret
|
||||
|
||||
LOADDir:
|
||||
@@ -3123,7 +3122,9 @@ MoviePlay:
|
||||
mov dword[fnamest+ebx-3],'.zmv'
|
||||
mov al,[CMovieExt]
|
||||
mov byte[fnamest+ebx],al
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov dword[Totalbyteloaded],0
|
||||
call loadstate2
|
||||
mov edx,fnamest+1
|
||||
@@ -3644,14 +3645,6 @@ DisplayBoxes:
|
||||
.nomore
|
||||
ret
|
||||
|
||||
|
||||
|
||||
ChangetoSRAMdir:
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
ret
|
||||
|
||||
ChangetoLOADdir:
|
||||
mov dl,[LoadDrive]
|
||||
mov ebx,LoadDir
|
||||
@@ -3671,8 +3664,9 @@ GUIProcStates:
|
||||
ret
|
||||
.yesstate
|
||||
mov byte[GUICBHold],0
|
||||
; change dir to SRAMDrive/SRAMDir
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
cmp byte[GUIStatesText5],1
|
||||
je .loadstate
|
||||
call statesaver
|
||||
@@ -3690,8 +3684,9 @@ GUIProcStates:
|
||||
ret
|
||||
|
||||
SaveSecondState:
|
||||
; change dir to SRAMDrive/SRAMDir
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov ebx,[statefileloc]
|
||||
mov al,[fnamest+ebx]
|
||||
mov byte[fnamest+ebx],'s'
|
||||
@@ -3704,7 +3699,9 @@ SaveSecondState:
|
||||
ret
|
||||
|
||||
LoadSecondState:
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov ebx,[statefileloc]
|
||||
mov al,[fnamest+ebx]
|
||||
mov byte[fnamest+ebx],'s'
|
||||
|
||||
@@ -1651,7 +1651,7 @@ GUIPathKeys:
|
||||
|
||||
cmp dword[GUIInputBox],1
|
||||
jne .notBox1
|
||||
mov eax,SRAMPath
|
||||
mov eax,SRAMDir
|
||||
jmp .boxselected
|
||||
.notBox1
|
||||
cmp dword[GUIInputBox],2
|
||||
|
||||
@@ -248,9 +248,9 @@ GUIloadfilename:
|
||||
%ifndef __LINUX__
|
||||
cmp byte[cfgloadsdir],0
|
||||
jne .nosdrive
|
||||
mov ebx,SRAMDir
|
||||
mov edx,SRAMDrive
|
||||
call Get_Dir
|
||||
pushad
|
||||
call SRAMDirCurDir
|
||||
popad
|
||||
%endif
|
||||
.nosdrive
|
||||
|
||||
|
||||
@@ -58,7 +58,9 @@ MovieRecord:
|
||||
mov dword[CFWriteStart],64
|
||||
.nocheckit
|
||||
mov byte[MovieRecordWinVal],0
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov byte[NoPictureSave],1
|
||||
cmp byte[MovieProcessing],0
|
||||
jne .nostatesaver
|
||||
|
||||
@@ -3241,7 +3241,7 @@ DisplayGUIChipClick
|
||||
ret
|
||||
|
||||
DisplayGUIPathsClick
|
||||
GUITextBoxInputNach 75,15,230,25,1,1024 ;SRAMPath
|
||||
GUITextBoxInputNach 75,15,230,25,1,1024 ;SRAMDir
|
||||
GUITextBoxInputNach 75,35,230,45,2,1024 ;SnapPath
|
||||
GUITextBoxInputNach 75,55,230,65,3,1024 ;SPCPath
|
||||
GUITextBoxInputNach 8,95,100,105,4,1024 ;BSXPath
|
||||
|
||||
@@ -1661,7 +1661,9 @@ NetLoadStuff:
|
||||
mov al,[NetStateSize+2]
|
||||
call RemoteSendChar
|
||||
call SendPacket
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov edx,fnamest+1
|
||||
call Open_File
|
||||
mov [NetLoadHandle],ax
|
||||
@@ -1690,7 +1692,9 @@ loadstaterecvinit:
|
||||
cmp dh,0
|
||||
je .noreceive2
|
||||
mov [NetStateSize+2],dl
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov edx,Netfname
|
||||
call Create_File
|
||||
mov edx,[NetStateSize]
|
||||
@@ -1827,7 +1831,9 @@ loadstaterecv:
|
||||
pushad
|
||||
mov bx,[NetLoadHandle]
|
||||
call Close_File
|
||||
call ChangetoSRAMdir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov edx,Netfname
|
||||
mov byte[RestoreValues],0
|
||||
call loadstate3
|
||||
|
||||
@@ -6322,7 +6322,7 @@ BlinkCursorCheck:
|
||||
.checkboxes
|
||||
cmp dword[GUIInputBox],1
|
||||
jne .notBox1
|
||||
mov ebx,SRAMPath
|
||||
mov ebx,SRAMDir
|
||||
ret
|
||||
.notBox1
|
||||
cmp dword[GUIInputBox],2
|
||||
@@ -6380,7 +6380,7 @@ BlinkCursorCheck:
|
||||
DisplayGUIPaths:
|
||||
GUIDrawWindowBox 19,GUIPathsDisp
|
||||
sub byte[GUItextcolor],15
|
||||
;GUIOuttextwin2 19,8,18,GUIPathsText1
|
||||
GUIOuttextwin2 19,8,18,GUIPathsText1
|
||||
GUIOuttextwin2 19,8,38,GUIPathsText2
|
||||
GUIOuttextwin2 19,8,58,GUIPathsText3
|
||||
GUIOuttextwin2 19,60,78,GUIPathsText4
|
||||
@@ -6395,7 +6395,7 @@ DisplayGUIPaths:
|
||||
GUIOuttextwin2 19,135,173,GUIPathsTextD
|
||||
|
||||
add byte[GUItextcolor],15
|
||||
;GUIOuttextwin2 19,7,17,GUIPathsText1
|
||||
GUIOuttextwin2 19,7,17,GUIPathsText1
|
||||
GUIOuttextwin2 19,7,37,GUIPathsText2
|
||||
GUIOuttextwin2 19,7,57,GUIPathsText3
|
||||
GUIOuttextwin2 19,59,77,GUIPathsText4
|
||||
@@ -6410,7 +6410,7 @@ DisplayGUIPaths:
|
||||
GUIOuttextwin2 19,134,172,GUIPathsTextD
|
||||
|
||||
;Input boxes - alternate color
|
||||
;DrawGUIWinBox 19,74,14,232,26,177
|
||||
DrawGUIWinBox 19,74,14,232,26,177
|
||||
DrawGUIWinBox 19,74,34,232,46,177
|
||||
DrawGUIWinBox 19,74,54,232,66,177
|
||||
DrawGUIWinBox 19,7,94,107,106,177
|
||||
@@ -6423,7 +6423,7 @@ DisplayGUIPaths:
|
||||
DrawGUIWinBox 19,134,179,236,191,177
|
||||
|
||||
;Input boxes
|
||||
;DrawGUIWinBox 19,75,15,231,25,167
|
||||
DrawGUIWinBox 19,75,15,231,25,167
|
||||
DrawGUIWinBox 19,75,35,231,45,167
|
||||
DrawGUIWinBox 19,75,55,231,65,167
|
||||
DrawGUIWinBox 19,8,95,106,105,167
|
||||
@@ -6435,7 +6435,7 @@ DisplayGUIPaths:
|
||||
DrawGUIWinBox 19,135,155,235,165,167
|
||||
DrawGUIWinBox 19,135,180,235,190,167
|
||||
|
||||
;GUIOuttextwin2d 19,77,19,SRAMPath,25
|
||||
GUIOuttextwin2d 19,77,19,SRAMDir,25
|
||||
GUIOuttextwin2d 19,77,39,SnapPath,25
|
||||
GUIOuttextwin2d 19,77,59,SPCPath,25
|
||||
GUIOuttextwin2d 19,10,99,BSXPath,15
|
||||
|
||||
@@ -38,7 +38,7 @@ EXTSYM Clear2xSaIBuffer
|
||||
EXTSYM romdata,romtype,ScreenShotFormat
|
||||
EXTSYM Voice0Disable,Voice1Disable,Voice2Disable,Voice3Disable
|
||||
EXTSYM Voice4Disable,Voice5Disable,Voice6Disable,Voice7Disable
|
||||
EXTSYM SRAMDrive, SRAMDir, SPCPath, SnapPath, Change_Dir, CHPath, ZFileCHDir
|
||||
EXTSYM SRAMChdir, SPCPath, SnapPath, Change_Dir, CHPath, ZFileCHDir
|
||||
%ifndef NO_PNG
|
||||
EXTSYM Grab_PNG_Data
|
||||
%endif
|
||||
@@ -56,9 +56,7 @@ EXTSYM Grab_PNG_Data
|
||||
|
||||
%macro ChangeDirSRAM 0
|
||||
pushad
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
call SRAMChdir
|
||||
popad
|
||||
%endmacro
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ EXTSYM MovieFileHand,filefound,inittable,SA1inittable
|
||||
EXTSYM MessageOn,Msgptr,MsgCount,sndrot,GenerateBank0Table,SnowTimer
|
||||
EXTSYM inittableb,inittablec,newgfx16b,cfgreinittime,EndMessage
|
||||
EXTSYM Open_File,Read_File,Write_File,Close_File,Output_Text,Get_Key,CNetType
|
||||
EXTSYM Delete_File,Get_First_Entry,Get_Next_Entry,Change_Dir,Get_Dir,InitDSP
|
||||
EXTSYM Delete_File,Get_First_Entry,Get_Next_Entry,Change_Dir,InitDSP
|
||||
EXTSYM Remove_Dir,Change_Single_Dir,Create_Dir,Get_Memfree,Create_File
|
||||
EXTSYM SPCDisable,osm2dis,CurRecv,BackupSystemVars
|
||||
EXTSYM SnowData,SnowVelDist
|
||||
@@ -93,7 +93,7 @@ EXTSYM GUIcurrentdir,PrintStr
|
||||
;EXTSYM GUIcurrentdir, PrintStr
|
||||
EXTSYM DTALoc
|
||||
EXTSYM spc7110romptr,allocspc7110
|
||||
EXTSYM SRAMDir,SRAMDrive,cfgloadsdir,fnamest,statefileloc
|
||||
EXTSYM SRAMChdir,cfgloadsdir,fnamest,statefileloc
|
||||
EXTSYM ForcePal,ForceROMTiming,ForceHiLoROM,InitDir,InitDrive,enterpress,frameskip
|
||||
EXTSYM maxromspace,curromspace,infoloc, patchfile
|
||||
EXTSYM gotoroot,headdata,printnum,romispal
|
||||
@@ -2722,9 +2722,9 @@ NEWSYM loadfileGUI
|
||||
mov byte[SramExists],0
|
||||
|
||||
; change to sram dir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
|
||||
; open .srm file
|
||||
mov edx,fnames+1
|
||||
@@ -2880,9 +2880,9 @@ NEWSYM convertsram
|
||||
jne .next2b
|
||||
.nocutoffb
|
||||
; change to sram directory
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
ret
|
||||
|
||||
SECTION .data
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
|
||||
EXTSYM DosExit,ZFileSystemInit
|
||||
EXTSYM getcmdline,GUIRestoreVars,getcfg,obtaindir,ConvertJoyMap,tparms
|
||||
EXTSYM preparedir,SBHDMA
|
||||
EXTSYM SBHDMA
|
||||
EXTSYM ccmdline
|
||||
EXTSYM FilenameStart
|
||||
EXTSYM spcon
|
||||
EXTSYM cfgsoundon
|
||||
EXTSYM cfgcvidmode
|
||||
EXTSYM pl1contrl,pl2contrl
|
||||
EXTSYM InitDir,InitDrive, SRAMDir, SRAMDrive
|
||||
EXTSYM InitDir,InitDrive,SRAMChdir
|
||||
EXTSYM DOScreatenewcfg,ExecGUISaveVars
|
||||
EXTSYM allocptr
|
||||
EXTSYM putchar
|
||||
@@ -182,9 +182,9 @@ NEWSYM SystemInit
|
||||
mov edx,InitDrive
|
||||
call Get_Dir
|
||||
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
%else
|
||||
mov ebx,InitDir
|
||||
mov edx,InitDrive
|
||||
@@ -205,17 +205,10 @@ NEWSYM SystemInit
|
||||
call ConvertJoyMap ; Mini joystick init
|
||||
call ccmdline
|
||||
call tparms
|
||||
%ifndef __LINUX__
|
||||
call preparedir
|
||||
%else
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
%endif
|
||||
; call getblaster ; get set blaster environment
|
||||
; cmp byte[Force8b],1
|
||||
; jne .noforce8b
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
mov byte[SBHDMA],1
|
||||
;.noforce8b
|
||||
pop es
|
||||
ret
|
||||
|
||||
|
||||
@@ -269,10 +269,6 @@ DWORD ZFileMKDir()
|
||||
#endif
|
||||
}
|
||||
|
||||
extern char SRAMDir;
|
||||
extern char InitDir;
|
||||
extern char LoadDir;
|
||||
|
||||
|
||||
DWORD ZFileCHDir()
|
||||
{
|
||||
@@ -464,39 +460,46 @@ DWORD GetDate()
|
||||
return(value);
|
||||
}
|
||||
|
||||
extern char SRAMDir[1024];
|
||||
extern char LoadDir[512];
|
||||
|
||||
#ifdef __LINUX__
|
||||
|
||||
char zcfgdir[1024];
|
||||
#define ZCFG_DIR "/.zsnes"
|
||||
#define ZCFG_DIR_LEN (1023-strlen(ZCFG_DIR))
|
||||
|
||||
void obtaindir()
|
||||
{
|
||||
char *cfgdir = NULL;
|
||||
char *homedir = NULL;
|
||||
DIR *tmp;
|
||||
char *homedir = 0;
|
||||
DIR *tmp;
|
||||
|
||||
if ((homedir = (char *)getenv("HOME"))==NULL) {
|
||||
homedir = (char *)malloc(128);
|
||||
getcwd(homedir, 128);
|
||||
}
|
||||
cfgdir = (char *)malloc(strlen(homedir)+strlen("/.zsnes")+1);
|
||||
strcpy(cfgdir, homedir);
|
||||
free(homedir);
|
||||
strcat(cfgdir, "/.zsnes");
|
||||
tmp = opendir(cfgdir);
|
||||
if (tmp == NULL) {
|
||||
MKPath = cfgdir;
|
||||
ZFileMKDir();
|
||||
} else {
|
||||
closedir(tmp);
|
||||
}
|
||||
// strcpy(&InitDir, cfgdir);
|
||||
// getcwd(&InitDir, 128);
|
||||
if (SRAMDir == 0){
|
||||
strcpy(&SRAMDir, cfgdir);
|
||||
}
|
||||
free(cfgdir);
|
||||
if (LoadDir == 0) {
|
||||
getcwd(&LoadDir, 128);
|
||||
}
|
||||
if ((homedir = (char *)getenv("HOME")) == 0)
|
||||
{
|
||||
homedir = (char *)malloc(ZCFG_DIR_LEN);
|
||||
getcwd(homedir, ZCFG_DIR_LEN);
|
||||
}
|
||||
strcpy(zcfgdir, homedir);
|
||||
free(homedir);
|
||||
strcat(zcfgdir, ZCFG_DIR);
|
||||
tmp = opendir(zcfgdir);
|
||||
if (tmp == NULL)
|
||||
{
|
||||
MKPath = zcfgdir;
|
||||
ZFileMKDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
closedir(tmp);
|
||||
}
|
||||
if (*SRAMDir == 0)
|
||||
{
|
||||
strcpy(SRAMDir, zcfgdir);
|
||||
}
|
||||
if (*LoadDir == 0)
|
||||
{
|
||||
getcwd(LoadDir, 512);
|
||||
}
|
||||
}
|
||||
|
||||
extern char fnamest, fnames;
|
||||
|
||||
@@ -40,6 +40,8 @@ EXTSYM romloadskip
|
||||
EXTSYM cfgloadgdir,cfgloadsdir
|
||||
EXTSYM init18_2hz
|
||||
EXTSYM OSExit,GUIOn2
|
||||
EXTSYM SRAMDirCurDir,SRAMChdir,SRAMChdirFail
|
||||
|
||||
%ifdef __LINUX__
|
||||
EXTSYM LinuxExit
|
||||
EXTSYM GetFilename
|
||||
@@ -921,9 +923,9 @@ NEWSYM makeextension
|
||||
ret
|
||||
.latestsave
|
||||
; change dir to Save Dir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
|
||||
call DetermineNewest
|
||||
|
||||
@@ -1157,9 +1159,9 @@ SECTION .text
|
||||
NEWSYM obtaindir
|
||||
cmp byte[cfgloadsdir],1
|
||||
je .nosdriveb
|
||||
mov ebx,SRAMDir
|
||||
mov edx,SRAMDrive
|
||||
call Get_Dir
|
||||
pushad
|
||||
call SRAMDirCurDir
|
||||
popad
|
||||
.nosdriveb
|
||||
cmp byte[cfgloadgdir],1
|
||||
je .noldriveb
|
||||
@@ -1185,21 +1187,21 @@ NEWSYM preparedir
|
||||
je near .nosdrivec
|
||||
; verify sram drive/directory exists
|
||||
; change dir to SRAMDrive/SRAMDir
|
||||
mov dl,[SRAMDrive]
|
||||
mov ebx,SRAMDir
|
||||
call Change_Dir
|
||||
jc .sramerror
|
||||
jmp .yessdrive
|
||||
.sramerror
|
||||
pushad
|
||||
call SRAMChdir
|
||||
popad
|
||||
cmp byte[SRAMChdirFail],0
|
||||
je .yessdrive
|
||||
|
||||
mov dl,[InitDrive]
|
||||
mov ebx,InitDir
|
||||
call Change_Dir
|
||||
|
||||
mov byte[cfgloadsdir],0
|
||||
; Get drive/dir
|
||||
mov ebx,SRAMDir
|
||||
mov edx,SRAMDrive
|
||||
call Get_Dir
|
||||
pushad
|
||||
call SRAMDirCurDir
|
||||
popad
|
||||
|
||||
mov edx,.sramerrorm
|
||||
call PrintStr
|
||||
@@ -1227,7 +1229,6 @@ SECTION .data
|
||||
.enter db 13,10,0
|
||||
|
||||
NEWSYM InitDrive, db 2
|
||||
NEWSYM SRAMDrive, db 2
|
||||
NEWSYM LoadDrive, db 2
|
||||
|
||||
%ifdef __LINUX__
|
||||
@@ -1238,7 +1239,6 @@ NEWSYM gotoroot, db '\',0
|
||||
|
||||
SECTION .bss
|
||||
NEWSYM InitDir, resb 512
|
||||
NEWSYM SRAMDir, resb 512
|
||||
NEWSYM LoadDir, resb 512
|
||||
|
||||
SECTION .text
|
||||
|
||||
@@ -688,10 +688,6 @@ KeyConvTableS
|
||||
db 208,209,210,211,255,255,255,255 ; 50h
|
||||
SECTION .text
|
||||
|
||||
; mov dl,[SRAMDrive]
|
||||
; mov ebx,SRAMDir
|
||||
; call Change_Dir
|
||||
|
||||
NEWSYM Change_Drive
|
||||
; change to drive in dl (0 = A, 1 = B, etc.)
|
||||
and edx,0FFh
|
||||
|
||||
Reference in New Issue
Block a user