Fixed command line loading of roms.

This commit is contained in:
teuf
2001-04-28 17:17:17 +00:00
parent a6c411853c
commit 89169c29c8
6 changed files with 75 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ EXTSYM Create_File,Write_File,Close_File
%ifdef __LINUX__ %ifdef __LINUX__
; if TextFile==0, zlib functions aren't used ; if TextFile==0, zlib functions aren't used
; useful to save the config file ; useful to save the config file
EXTSYM TextFile EXTSYM TextFile, InitDir, InitDrive, Change_Dir
%endif %endif
NEWSYM CfgLoadAsmStart NEWSYM CfgLoadAsmStart
@@ -257,6 +257,11 @@ NEWSYM ConvertJoyMap2
NEWSYM DOScreatenewcfg NEWSYM DOScreatenewcfg
; make a new file ; make a new file
; copy .cfgfiledata to mode7tab, replacing each % ; copy .cfgfiledata to mode7tab, replacing each %
%ifdef __LINUX__
mov dl,[SRAMDrive]
mov ebx,SRAMDir
call Change_Dir
%endif
mov esi,.cfgfiledata mov esi,.cfgfiledata
mov edi,mode7tab mov edi,mode7tab
xor ecx,ecx xor ecx,ecx

View File

@@ -1454,6 +1454,8 @@ NEWSYM sramsave
NEWSYM statesaver NEWSYM statesaver
clim clim
sub dword[Curtableaddr],tableA sub dword[Curtableaddr],tableA
sub dword[spcPCRam],spcRam sub dword[spcPCRam],spcRam
sub dword[spcRamDP],spcRam sub dword[spcRamDP],spcRam
@@ -1462,6 +1464,11 @@ NEWSYM statesaver
call initrevst call initrevst
; jmp .skipsaves ; jmp .skipsaves
; Save State ; Save State
%ifdef __LINUX__
mov dl,[SRAMDrive]
mov ebx,SRAMDir
call Change_Dir
%endif
mov edx,fnamest+1 mov edx,fnamest+1
call Create_File call Create_File
jc near .nosavestuff jc near .nosavestuff
@@ -1820,6 +1827,12 @@ NEWSYM loadstate
mov byte[pressed+eax],2 mov byte[pressed+eax],2
mov byte[multchange],1 mov byte[multchange],1
clim clim
%ifdef __LINUX__
mov dl,[SRAMDrive]
mov ebx,SRAMDir
call Change_Dir
%endif
mov edx,fnamest+1 mov edx,fnamest+1
call Open_File call Open_File
jc near .nofile jc near .nofile

View File

@@ -3366,9 +3366,15 @@ NEWSYM loadfile
mov byte[TextFile], 0 mov byte[TextFile], 0
call GetCurDir call GetCurDir
mov byte[InGUI],0 mov byte[InGUI],0
%ifdef __LINUX__
mov dl,[InitDrive]
mov ebx,InitDir
call Change_Dir
%endif
jmp loadfileGUI.nogui jmp loadfileGUI.nogui
%ifndef __LINUX__
mov dword[MessageOn],0 mov dword[MessageOn],0
mov byte[loadedfromgui],0 mov byte[loadedfromgui],0
mov byte[yesoutofmemory],0 mov byte[yesoutofmemory],0
@@ -3564,7 +3570,7 @@ NEWSYM loadfile
mov ah,9 mov ah,9
call Output_Text call Output_Text
jmp DosExit jmp DosExit
%endif
SECTION .data SECTION .data
.multfound db 0 .multfound db 0
.first db 0 .first db 0

View File

@@ -39,7 +39,7 @@ EXTSYM pl1Bk
EXTSYM pl1Rk EXTSYM pl1Rk
EXTSYM cfgcvidmode EXTSYM cfgcvidmode
EXTSYM pl1contrl,pl2contrl EXTSYM pl1contrl,pl2contrl
EXTSYM InitDir,InitDrive EXTSYM InitDir,InitDrive, SRAMDir, SRAMDrive
EXTSYM DOScreatenewcfg,ExecGUISaveVars EXTSYM DOScreatenewcfg,ExecGUISaveVars
EXTSYM allocptr EXTSYM allocptr
EXTSYM putchar EXTSYM putchar
@@ -252,14 +252,22 @@ NEWSYM SystemInit
; Get and set the initial directory ; Get and set the initial directory
%ifdef __LINUX__ %ifdef __LINUX__
call obtaindir call obtaindir
mov ebx,InitDir
mov edx,InitDrive
call Get_Dir
mov dl,[SRAMDrive]
mov ebx,SRAMDir
call Change_Dir
%else %else
mov ebx,InitDir mov ebx,InitDir
mov edx,InitDrive mov edx,InitDrive
call Get_Dir call Get_Dir
%endif
mov dl,[InitDrive] mov dl,[InitDrive]
mov ebx,InitDir mov ebx,InitDir
call Change_Dir call Change_Dir
%endif
call GUIRestoreVars ; Load GUI stuff call GUIRestoreVars ; Load GUI stuff

View File

@@ -256,6 +256,11 @@ DWORD ZFileMKDir()
#endif #endif
} }
extern char SRAMDir;
extern char InitDir;
extern char LoadDir;
DWORD ZFileCHDir() DWORD ZFileCHDir()
{ {
return(chdir(CHPath)); return(chdir(CHPath));
@@ -443,9 +448,6 @@ DWORD GetDate()
#ifdef __LINUX__ #ifdef __LINUX__
extern char SRAMDir;
extern char InitDir;
extern char LoadDir;
void obtaindir() void obtaindir()
{ {
@@ -467,7 +469,8 @@ void obtaindir()
} else { } else {
closedir(tmp); closedir(tmp);
} }
strcpy(&InitDir, cfgdir); // strcpy(&InitDir, cfgdir);
// getcwd(&InitDir, 128);
if (SRAMDir == 0){ if (SRAMDir == 0){
strcpy(&SRAMDir, cfgdir); strcpy(&SRAMDir, cfgdir);
} }
@@ -476,4 +479,29 @@ void obtaindir()
getcwd(&LoadDir, 128); getcwd(&LoadDir, 128);
} }
} }
extern char fnamest, fnames;
void GetFilename()
{
char *tmp = &fnamest;
char size;
*tmp = '/';
while (*tmp!=0) tmp++;
while (*tmp!='/') tmp--;
size = (strlen(tmp)-1) & 0xFF;
strcpy(&fnamest, tmp);
fnamest = size;
tmp = &fnames;
*tmp = '/';
while (*tmp!=0) tmp++;
while (*tmp!='/') tmp--;
size = (strlen(tmp)-1) & 0xFF;
strcpy(&fnames, tmp);
fnames = size;
}
#endif #endif

View File

@@ -35,9 +35,9 @@ EXTSYM Open_File, Get_File_Date, Close_File, Change_Dir, Get_Dir
EXTSYM romloadskip EXTSYM romloadskip
EXTSYM cfgloadgdir,cfgloadsdir EXTSYM cfgloadgdir,cfgloadsdir
EXTSYM init18_2hz EXTSYM init18_2hz
%ifdef __LINUX__ %ifdef __LINUX__
EXTSYM LinuxExit EXTSYM LinuxExit
EXTSYM GetFilename
%endif %endif
NEWSYM UIAsmStart NEWSYM UIAsmStart
@@ -1204,6 +1204,11 @@ NEWSYM makeextension
add ah,4 add ah,4
mov [fnames],ah mov [fnames],ah
mov [fnamest],ah mov [fnamest],ah
%ifdef __LINUX__
pushad
call GetFilename
popad
%endif
cmp byte[LatestSave],1 cmp byte[LatestSave],1
je .latestsave je .latestsave
ret ret