adding linux stuff
This commit is contained in:
1528
zsnes/src/linux/copyvwin.asm
Normal file
1528
zsnes/src/linux/copyvwin.asm
Normal file
File diff suppressed because it is too large
Load Diff
206
zsnes/src/linux/protect.c
Normal file
206
zsnes/src/linux/protect.c
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||||
|
//
|
||||||
|
//This program is free software; you can redistribute it and/or
|
||||||
|
//modify it under the terms of the GNU General Public License
|
||||||
|
//as published by the Free Software Foundation; either
|
||||||
|
//version 2 of the License, or (at your option) any later
|
||||||
|
//version.
|
||||||
|
//
|
||||||
|
//This program is distributed in the hope that it will be useful,
|
||||||
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
//GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
//You should have received a copy of the GNU General Public License
|
||||||
|
//along with this program; if not, write to the Free Software
|
||||||
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern void GuiAsmStart();
|
||||||
|
extern void GuiAsmEnd();
|
||||||
|
extern void SfxProcAsmStart();
|
||||||
|
extern void SfxProcAsmEnd();
|
||||||
|
extern void FxEmu2AsmStart();
|
||||||
|
extern void FxEmu2AsmEnd();
|
||||||
|
extern void Dsp1ProcAsmStart();
|
||||||
|
extern void Dsp1ProcAsmEnd();
|
||||||
|
extern void FxEmu2BAsmStart();
|
||||||
|
extern void FxEmu2BAsmEnd();
|
||||||
|
extern void FxEmu2CAsmStart();
|
||||||
|
extern void FxEmu2CAsmEnd();
|
||||||
|
extern void FxTableAsmStart();
|
||||||
|
extern void FxTableAsmEnd();
|
||||||
|
extern void ExecuteAsmStart();
|
||||||
|
extern void ExecuteAsmEnd();
|
||||||
|
extern void Sa1ProcAsmStart();
|
||||||
|
extern void Sa1ProcAsmEnd();
|
||||||
|
extern void Sa1RegsAsmStart();
|
||||||
|
extern void Sa1RegsAsmEnd();
|
||||||
|
extern void WinIntRFAsmStart();
|
||||||
|
extern void WinIntRFAsmEnd();
|
||||||
|
extern void ProcVidAsmStart();
|
||||||
|
extern void ProcVidAsmEnd();
|
||||||
|
extern void CfgLoadAsmStart();
|
||||||
|
extern void CfgLoadAsmEnd();
|
||||||
|
extern void IrqAsmStart();
|
||||||
|
extern void IrqAsmEnd();
|
||||||
|
extern void MemoryAsmStart();
|
||||||
|
extern void MemoryAsmEnd();
|
||||||
|
extern void Spc700AsmStart();
|
||||||
|
extern void Spc700AsmEnd();
|
||||||
|
extern void StableAsmStart();
|
||||||
|
extern void StableAsmEnd();
|
||||||
|
extern void DspProcAsmStart();
|
||||||
|
extern void DspProcAsmEnd();
|
||||||
|
extern void DmaAsmStart();
|
||||||
|
extern void DmaAsmEnd();
|
||||||
|
extern void DspAsmStart();
|
||||||
|
extern void DspAsmEnd();
|
||||||
|
extern void TableAsmStart();
|
||||||
|
extern void TableAsmEnd();
|
||||||
|
extern void TableBAsmStart();
|
||||||
|
extern void TableBAsmEnd();
|
||||||
|
extern void TableCAsmStart();
|
||||||
|
extern void TableCAsmEnd();
|
||||||
|
extern void CopyVWinAsmStart();
|
||||||
|
extern void CopyVWinAsmEnd();
|
||||||
|
extern void DebugAsmStart();
|
||||||
|
extern void DebugAsmEnd();
|
||||||
|
extern void JoyAsmStart();
|
||||||
|
extern void JoyAsmEnd();
|
||||||
|
extern void InitAsmStart();
|
||||||
|
extern void InitAsmEnd();
|
||||||
|
extern void UIAsmStart();
|
||||||
|
extern void UIAsmEnd();
|
||||||
|
extern void DosModemRTNAsmStart();
|
||||||
|
extern void DosModemRTNAsmEnd();
|
||||||
|
extern void Vesa2AsmStart();
|
||||||
|
extern void Vesa2AsmEnd();
|
||||||
|
extern void InitVidAsmStart();
|
||||||
|
extern void InitVidAsmEnd();
|
||||||
|
extern void SWAsmStart();
|
||||||
|
extern void SWAsmEnd();
|
||||||
|
extern void GPProAsmStart();
|
||||||
|
extern void GPProAsmEnd();
|
||||||
|
extern void Vesa12AsmStart();
|
||||||
|
extern void Vesa12AsmEnd();
|
||||||
|
extern void MenuAsmStart();
|
||||||
|
extern void MenuAsmEnd();
|
||||||
|
extern void MakeV16BAsmStart();
|
||||||
|
extern void MakeV16BAsmEnd();
|
||||||
|
extern void MakeV16TAsmStart();
|
||||||
|
extern void MakeV16TAsmEnd();
|
||||||
|
extern void MakeVidAsmStart();
|
||||||
|
extern void MakeVidAsmEnd();
|
||||||
|
extern void Mode716AsmStart();
|
||||||
|
extern void Mode716AsmEnd();
|
||||||
|
extern void Mode716BAsmStart();
|
||||||
|
extern void Mode716BAsmEnd();
|
||||||
|
extern void Mode716DAsmStart();
|
||||||
|
extern void Mode716DAsmEnd();
|
||||||
|
extern void Mode716EAsmStart();
|
||||||
|
extern void Mode716EAsmEnd();
|
||||||
|
extern void Mode716TAsmStart();
|
||||||
|
extern void Mode716TAsmEnd();
|
||||||
|
extern void Mode7AsmStart();
|
||||||
|
extern void Mode7AsmEnd();
|
||||||
|
extern void Mode7ExtAsmStart();
|
||||||
|
extern void Mode7ExtAsmEnd();
|
||||||
|
extern void M716TExtAsmStart();
|
||||||
|
extern void M716TExtAsmEnd();
|
||||||
|
extern void TwoxSaiWAsmStart();
|
||||||
|
extern void TwoxSaiWAsmEnd();
|
||||||
|
extern void EndMemAsmStart();
|
||||||
|
extern void EndMemAsmEnd();
|
||||||
|
extern void MV16TMSAsmStart();
|
||||||
|
extern void MV16TMSAsmEnd();
|
||||||
|
extern void NewG162AsmStart();
|
||||||
|
extern void NewG162AsmEnd();
|
||||||
|
extern void NewGfx16AsmStart();
|
||||||
|
extern void NewGfx16AsmEnd();
|
||||||
|
extern void NewGfx2AsmStart();
|
||||||
|
extern void NewGfx2AsmEnd();
|
||||||
|
extern void NewGfxAsmStart();
|
||||||
|
extern void NewGfxAsmEnd();
|
||||||
|
extern void VCacheAsmStart();
|
||||||
|
extern void VCacheAsmEnd();
|
||||||
|
|
||||||
|
// Thanks QuakeForge
|
||||||
|
void MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
unsigned int addr;
|
||||||
|
int psize = getpagesize();
|
||||||
|
|
||||||
|
|
||||||
|
//fprintf(stderr, "Unprotecting 0x%x to 0x%x\n", startaddr, startaddr+length);
|
||||||
|
addr = (startaddr & ~(psize -1)) - psize;
|
||||||
|
|
||||||
|
r = mprotect ((char *) addr, length + startaddr - addr + psize, 7);
|
||||||
|
|
||||||
|
if (r < 0)
|
||||||
|
fprintf (stderr, "Error! Memory *NOT* unprotected.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnProtectMemory(void)
|
||||||
|
{
|
||||||
|
MakeCodeWriteable((long) SfxProcAsmStart, (long) SfxProcAsmEnd - (long) SfxProcAsmStart);
|
||||||
|
MakeCodeWriteable((long) FxEmu2AsmStart, (long) FxEmu2AsmEnd - (long) FxEmu2AsmStart);
|
||||||
|
MakeCodeWriteable((long) Dsp1ProcAsmStart, (long) Dsp1ProcAsmEnd - (long) Dsp1ProcAsmStart);
|
||||||
|
MakeCodeWriteable((long) FxEmu2BAsmStart, (long) FxEmu2BAsmEnd - (long) FxEmu2BAsmStart);
|
||||||
|
MakeCodeWriteable((long) FxEmu2CAsmStart, (long) FxEmu2CAsmEnd - (long) FxEmu2CAsmStart);
|
||||||
|
MakeCodeWriteable((long) FxTableAsmStart, (long) FxTableAsmEnd - (long) FxTableAsmStart);
|
||||||
|
MakeCodeWriteable((long) ExecuteAsmStart, (long) ExecuteAsmEnd - (long) ExecuteAsmStart);
|
||||||
|
MakeCodeWriteable((long) Sa1ProcAsmStart, (long) Sa1ProcAsmEnd - (long) Sa1ProcAsmStart);
|
||||||
|
MakeCodeWriteable((long) Sa1RegsAsmStart, (long) Sa1RegsAsmEnd - (long) Sa1RegsAsmStart);
|
||||||
|
MakeCodeWriteable((long) WinIntRFAsmStart, (long) WinIntRFAsmEnd - (long) WinIntRFAsmStart);
|
||||||
|
MakeCodeWriteable((long) GuiAsmStart, (long) GuiAsmEnd - (long) GuiAsmStart);
|
||||||
|
MakeCodeWriteable((long) ProcVidAsmStart, (long) ProcVidAsmEnd - (long) ProcVidAsmStart);
|
||||||
|
MakeCodeWriteable((long) CfgLoadAsmStart, (long) CfgLoadAsmEnd - (long) CfgLoadAsmStart);
|
||||||
|
MakeCodeWriteable((long) IrqAsmStart, (long) IrqAsmEnd - (long) IrqAsmStart);
|
||||||
|
MakeCodeWriteable((long) MemoryAsmStart, (long) MemoryAsmEnd - (long) MemoryAsmStart);
|
||||||
|
MakeCodeWriteable((long) Spc700AsmStart, (long) Spc700AsmEnd - (long) Spc700AsmStart);
|
||||||
|
MakeCodeWriteable((long) StableAsmStart, (long) StableAsmEnd - (long) StableAsmStart);
|
||||||
|
MakeCodeWriteable((long) DspProcAsmStart, (long) DspProcAsmEnd - (long) DspProcAsmStart);
|
||||||
|
MakeCodeWriteable((long) DmaAsmStart, (long) DmaAsmEnd - (long) DmaAsmStart);
|
||||||
|
MakeCodeWriteable((long) DspAsmStart, (long) DspAsmEnd - (long) DspAsmStart);
|
||||||
|
MakeCodeWriteable((long) TableAsmStart, (long) TableAsmEnd - (long) TableAsmStart);
|
||||||
|
MakeCodeWriteable((long) TableBAsmStart, (long) TableBAsmEnd - (long) TableBAsmStart);
|
||||||
|
MakeCodeWriteable((long) TableCAsmStart, (long) TableCAsmEnd - (long) TableCAsmStart);
|
||||||
|
MakeCodeWriteable((long) CopyVWinAsmStart, (long) CopyVWinAsmEnd - (long) CopyVWinAsmStart);
|
||||||
|
MakeCodeWriteable((long) DebugAsmStart, (long) DebugAsmEnd - (long) DebugAsmStart);
|
||||||
|
MakeCodeWriteable((long) JoyAsmStart, (long) JoyAsmEnd - (long) JoyAsmStart);
|
||||||
|
MakeCodeWriteable((long) InitAsmStart, (long) InitAsmEnd - (long) InitAsmStart);
|
||||||
|
MakeCodeWriteable((long) UIAsmStart, (long) UIAsmEnd - (long) UIAsmStart);
|
||||||
|
MakeCodeWriteable((long) DosModemRTNAsmStart, (long) DosModemRTNAsmEnd - (long) DosModemRTNAsmStart);
|
||||||
|
MakeCodeWriteable((long) Vesa2AsmStart, (long) Vesa2AsmEnd - (long) Vesa2AsmStart);
|
||||||
|
MakeCodeWriteable((long) InitVidAsmStart, (long) InitVidAsmEnd - (long) InitVidAsmStart);
|
||||||
|
MakeCodeWriteable((long) SWAsmStart, (long) SWAsmEnd - (long) SWAsmStart);
|
||||||
|
MakeCodeWriteable((long) GPProAsmStart, (long) GPProAsmEnd - (long) GPProAsmStart);
|
||||||
|
MakeCodeWriteable((long) Vesa12AsmStart, (long) Vesa12AsmEnd - (long) Vesa12AsmStart);
|
||||||
|
MakeCodeWriteable((long) MenuAsmStart, (long) MenuAsmEnd - (long) MenuAsmStart);
|
||||||
|
MakeCodeWriteable((long) MakeV16BAsmStart, (long) MakeV16BAsmEnd - (long) MakeV16BAsmStart);
|
||||||
|
MakeCodeWriteable((long) MakeV16TAsmStart, (long) MakeV16TAsmEnd - (long) MakeV16TAsmStart);
|
||||||
|
MakeCodeWriteable((long) MakeVidAsmStart, (long) MakeVidAsmEnd - (long) MakeVidAsmStart);
|
||||||
|
MakeCodeWriteable((long) Mode716AsmStart, (long) Mode716AsmEnd - (long) Mode716AsmStart);
|
||||||
|
|
||||||
|
MakeCodeWriteable((long) Mode716BAsmStart, (long) Mode716BAsmEnd - (long) Mode716BAsmStart);
|
||||||
|
MakeCodeWriteable((long) Mode716DAsmStart, (long) Mode716DAsmEnd - (long) Mode716DAsmStart);
|
||||||
|
MakeCodeWriteable((long) Mode716EAsmStart, (long) Mode716EAsmEnd - (long) Mode716EAsmStart);
|
||||||
|
MakeCodeWriteable((long) Mode716TAsmStart, (long) Mode716TAsmEnd - (long) Mode716TAsmStart);
|
||||||
|
MakeCodeWriteable((long) Mode7AsmStart, (long) Mode7AsmEnd - (long) Mode7AsmStart);
|
||||||
|
MakeCodeWriteable((long) Mode7ExtAsmStart, (long) Mode7ExtAsmEnd - (long) Mode7ExtAsmStart);
|
||||||
|
MakeCodeWriteable((long) M716TExtAsmStart, (long) M716TExtAsmEnd - (long) M716TExtAsmStart);
|
||||||
|
MakeCodeWriteable((long) TwoxSaiWAsmStart, (long) TwoxSaiWAsmEnd - (long) TwoxSaiWAsmStart);
|
||||||
|
MakeCodeWriteable((long) EndMemAsmStart, (long) EndMemAsmEnd - (long) EndMemAsmStart);
|
||||||
|
MakeCodeWriteable((long) MV16TMSAsmStart, (long) MV16TMSAsmEnd - (long) MV16TMSAsmStart);
|
||||||
|
MakeCodeWriteable((long) NewG162AsmStart, (long) NewG162AsmEnd - (long) NewG162AsmStart);
|
||||||
|
MakeCodeWriteable((long) NewGfx16AsmStart, (long) NewGfx16AsmEnd - (long) NewGfx16AsmStart);
|
||||||
|
MakeCodeWriteable((long) NewGfx2AsmStart, (long) NewGfx2AsmEnd - (long) NewGfx2AsmStart);
|
||||||
|
MakeCodeWriteable((long) NewGfxAsmStart, (long) NewGfxAsmEnd - (long) NewGfxAsmStart);
|
||||||
|
MakeCodeWriteable((long) VCacheAsmStart, (long) VCacheAsmEnd - (long) VCacheAsmStart);
|
||||||
|
}
|
||||||
34
zsnes/src/linux/resource.h
Normal file
34
zsnes/src/linux/resource.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||||
|
//
|
||||||
|
//This program is free software; you can redistribute it and/or
|
||||||
|
//modify it under the terms of the GNU General Public License
|
||||||
|
//as published by the Free Software Foundation; either
|
||||||
|
//version 2 of the License, or (at your option) any later
|
||||||
|
//version.
|
||||||
|
//
|
||||||
|
//This program is distributed in the hope that it will be useful,
|
||||||
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
//GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
//You should have received a copy of the GNU General Public License
|
||||||
|
//along with this program; if not, write to the Free Software
|
||||||
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Developer Studio generated include file.
|
||||||
|
// Used by zloader.rc
|
||||||
|
//
|
||||||
|
#define IDI_ICON1 101
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
2787
zsnes/src/linux/sdllink.c
Normal file
2787
zsnes/src/linux/sdllink.c
Normal file
File diff suppressed because it is too large
Load Diff
2108
zsnes/src/linux/winintrf.asm
Normal file
2108
zsnes/src/linux/winintrf.asm
Normal file
File diff suppressed because it is too large
Load Diff
328
zsnes/src/linux/zfilew.c
Normal file
328
zsnes/src/linux/zfilew.c
Normal file
@@ -0,0 +1,328 @@
|
|||||||
|
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||||
|
//
|
||||||
|
//This program is free software; you can redistribute it and/or
|
||||||
|
//modify it under the terms of the GNU General Public License
|
||||||
|
//as published by the Free Software Foundation; either
|
||||||
|
//version 2 of the License, or (at your option) any later
|
||||||
|
//version.
|
||||||
|
//
|
||||||
|
//This program is distributed in the hope that it will be useful,
|
||||||
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
//GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
//You should have received a copy of the GNU General Public License
|
||||||
|
//along with this program; if not, write to the Free Software
|
||||||
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifdef __LINUX__
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
#else
|
||||||
|
#include <time.h>
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DWORD unsigned int
|
||||||
|
#define BYTE unsigned char
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FILE *FILEHANDLE[16];
|
||||||
|
DWORD CurrentHandle=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ZFileSystemInit
|
||||||
|
// return 0
|
||||||
|
|
||||||
|
// ZOpenFile info :
|
||||||
|
BYTE * ZOpenFileName;
|
||||||
|
DWORD ZOpenMode;
|
||||||
|
// Open modes : 0 read/write in
|
||||||
|
// 1 write (create file, overwrite)
|
||||||
|
// return file handle if success, 0xFFFFFFFF if error
|
||||||
|
|
||||||
|
// ZCloseFile info :
|
||||||
|
DWORD ZCloseFileHandle;
|
||||||
|
// return 0
|
||||||
|
|
||||||
|
// ZFileSeek info :
|
||||||
|
DWORD ZFileSeekHandle;
|
||||||
|
DWORD ZFileSeekPos;
|
||||||
|
DWORD ZFileSeekMode; // 0 start, 1 end
|
||||||
|
// return 0
|
||||||
|
|
||||||
|
// ZFileReadBlock info :
|
||||||
|
BYTE * ZFileReadBlock;
|
||||||
|
DWORD ZFileReadSize;
|
||||||
|
DWORD ZFileReadHandle;
|
||||||
|
// return 0
|
||||||
|
|
||||||
|
// ZFileWriteBlock info :
|
||||||
|
BYTE * ZFileWriteBlock;
|
||||||
|
DWORD ZFileWriteSize;
|
||||||
|
DWORD ZFileWriteHandle;
|
||||||
|
// return 0
|
||||||
|
|
||||||
|
// ZFileTell
|
||||||
|
DWORD ZFileTellHandle;
|
||||||
|
|
||||||
|
// ZFileGetftime
|
||||||
|
BYTE * ZFFTimeFName;
|
||||||
|
DWORD ZFTimeHandle;
|
||||||
|
DWORD ZFDate;
|
||||||
|
DWORD ZFTime;
|
||||||
|
|
||||||
|
// MKDir/CHDir
|
||||||
|
BYTE * MKPath;
|
||||||
|
BYTE * CHPath;
|
||||||
|
BYTE * RMPath;
|
||||||
|
|
||||||
|
// GetDir
|
||||||
|
BYTE * DirName;
|
||||||
|
DWORD DriveNumber;
|
||||||
|
|
||||||
|
// ZFileDelete
|
||||||
|
BYTE * ZFileDelFName;
|
||||||
|
// return current position
|
||||||
|
|
||||||
|
DWORD ZFileSystemInit()
|
||||||
|
{
|
||||||
|
CurrentHandle=0;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZOpenFile()
|
||||||
|
{
|
||||||
|
if(ZOpenMode==0)
|
||||||
|
{
|
||||||
|
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"))!=NULL)
|
||||||
|
{
|
||||||
|
CurrentHandle+=1;
|
||||||
|
return(CurrentHandle-1);
|
||||||
|
}
|
||||||
|
return(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
if(ZOpenMode==1)
|
||||||
|
{
|
||||||
|
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"))!=NULL)
|
||||||
|
{
|
||||||
|
CurrentHandle+=1;
|
||||||
|
return(CurrentHandle-1);
|
||||||
|
}
|
||||||
|
return(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
if(ZOpenMode==2)
|
||||||
|
{
|
||||||
|
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"))!=NULL)
|
||||||
|
{
|
||||||
|
CurrentHandle+=1;
|
||||||
|
return(CurrentHandle-1);
|
||||||
|
}
|
||||||
|
return(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
return(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZCloseFile()
|
||||||
|
{
|
||||||
|
fclose(FILEHANDLE[ZCloseFileHandle]);
|
||||||
|
CurrentHandle-=1;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileSeek()
|
||||||
|
{
|
||||||
|
if(ZFileSeekMode==0)
|
||||||
|
{
|
||||||
|
fseek(FILEHANDLE[ZFileSeekHandle],ZFileSeekPos,SEEK_SET);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(ZFileSeekMode==1)
|
||||||
|
{
|
||||||
|
fseek(FILEHANDLE[ZFileSeekHandle],ZFileSeekPos,SEEK_END);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileRead()
|
||||||
|
{
|
||||||
|
return(fread(ZFileReadBlock,1,ZFileReadSize,FILEHANDLE[ZFileReadHandle]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD ZFileWrite()
|
||||||
|
{
|
||||||
|
if((fwrite(ZFileWriteBlock,1,ZFileWriteSize,FILEHANDLE[ZFileWriteHandle]))!=ZFileWriteSize) return(0xFFFFFFFF);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileTell()
|
||||||
|
{
|
||||||
|
return(ftell(FILEHANDLE[ZFileTellHandle]));
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileDelete()
|
||||||
|
{
|
||||||
|
return(remove(ZFileDelFName));
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileGetFTime()
|
||||||
|
{
|
||||||
|
ZFDate=0;
|
||||||
|
ZFTime=0;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileMKDir()
|
||||||
|
{
|
||||||
|
return(mkdir(MKPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileCHDir()
|
||||||
|
{
|
||||||
|
return(chdir(CHPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileRMDir()
|
||||||
|
{
|
||||||
|
return(rmdir(RMPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ZFileGetDir()
|
||||||
|
{
|
||||||
|
return(getcwd(DirName,128));
|
||||||
|
}
|
||||||
|
|
||||||
|
BYTE * ZFileFindPATH;
|
||||||
|
DWORD ZFileFindATTRIB;
|
||||||
|
DWORD DTALocPos;
|
||||||
|
|
||||||
|
//struct _find_t {
|
||||||
|
// char reserved[21] __attribute__((packed));
|
||||||
|
// unsigned char attrib __attribute__((packed));
|
||||||
|
// unsigned short wr_time __attribute__((packed));
|
||||||
|
// unsigned short wr_date __attribute__((packed));
|
||||||
|
// unsigned long size __attribute__((packed));
|
||||||
|
// char name[256] __attribute__((packed));
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
int FindFirstHandle;
|
||||||
|
int TempFind;
|
||||||
|
#ifndef __LINUX__
|
||||||
|
struct _finddata_t FindDataStruct;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DWORD ZFileFindNext()
|
||||||
|
{
|
||||||
|
#ifdef __LINUX__
|
||||||
|
STUB_FUNCTION;
|
||||||
|
#else
|
||||||
|
TempFind=_findnext(FindFirstHandle,&FindDataStruct);
|
||||||
|
if(TempFind==-1) return(-1);
|
||||||
|
|
||||||
|
*(char *)(DTALocPos+0x15)=0;
|
||||||
|
|
||||||
|
if(ZFileFindATTRIB&0x10 && (FindDataStruct.attrib&0x10)==0) return(ZFileFindNext());
|
||||||
|
if((ZFileFindATTRIB&0x10==0) && FindDataStruct.attrib&0x10) return(ZFileFindNext());
|
||||||
|
|
||||||
|
if(FindDataStruct.attrib&_A_SUBDIR) *(char *)(DTALocPos+0x15)=0x10;
|
||||||
|
strcpy((char *)DTALocPos+0x1E,FindDataStruct.name);
|
||||||
|
if(TempFind==-1) return(-1);
|
||||||
|
return(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ZFileFindFirst()
|
||||||
|
{
|
||||||
|
#ifdef __LINUX__
|
||||||
|
STUB_FUNCTION;
|
||||||
|
#else
|
||||||
|
FindFirstHandle=_findfirst(ZFileFindPATH,&FindDataStruct);
|
||||||
|
*(char *)(DTALocPos+0x15)=0;
|
||||||
|
TempFind=0;
|
||||||
|
if(FindFirstHandle==-1) return(-1);
|
||||||
|
if(ZFileFindATTRIB&0x10 && (FindDataStruct.attrib&0x10)==0) return(ZFileFindNext());
|
||||||
|
if((ZFileFindATTRIB&0x10==0) && FindDataStruct.attrib&0x10) return(ZFileFindNext());
|
||||||
|
|
||||||
|
if(FindDataStruct.attrib&_A_SUBDIR) *(char *)(DTALocPos+0x15)=0x10;
|
||||||
|
strcpy((char *) DTALocPos+0x1E,FindDataStruct.name);
|
||||||
|
if(FindFirstHandle==-1) return(-1);
|
||||||
|
return(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD ZFileFindEnd() // for compatibility with windows later
|
||||||
|
{
|
||||||
|
#ifdef __LINUX__
|
||||||
|
STUB_FUNCTION;
|
||||||
|
#else
|
||||||
|
_findclose(FindFirstHandle);
|
||||||
|
return(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//BYTE * DirName;
|
||||||
|
//DWORD DriveNumber;
|
||||||
|
|
||||||
|
//unsigned int _dos_findfirst(char *_name, unsigned int _attr, struct _find_t *_result);
|
||||||
|
//unsigned int _dos_findnext(struct _find_t *_result);
|
||||||
|
|
||||||
|
|
||||||
|
DWORD GetTime()
|
||||||
|
{
|
||||||
|
|
||||||
|
DWORD value;
|
||||||
|
struct tm *newtime;
|
||||||
|
time_t long_time;
|
||||||
|
|
||||||
|
time( &long_time );
|
||||||
|
newtime = localtime( &long_time );
|
||||||
|
|
||||||
|
value = ((newtime->tm_sec) % 10)+((newtime->tm_sec)/10)*16
|
||||||
|
+((((newtime->tm_min) % 10)+((newtime->tm_min)/10)*16) << 8)
|
||||||
|
+((((newtime->tm_hour) % 10)+((newtime->tm_hour)/10)*16) << 16);
|
||||||
|
return(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD GetDate()
|
||||||
|
{
|
||||||
|
|
||||||
|
DWORD value;
|
||||||
|
struct tm *newtime;
|
||||||
|
time_t long_time;
|
||||||
|
|
||||||
|
time( &long_time );
|
||||||
|
newtime = localtime( &long_time );
|
||||||
|
value = ((newtime->tm_mday) % 10)+((newtime->tm_mday)/10)*16
|
||||||
|
+(((newtime->tm_mon)+1) << 8)
|
||||||
|
+((((newtime->tm_year) % 10)+((newtime->tm_year)/10)*16) << 16);
|
||||||
|
+((newtime->tm_wday) << 28);
|
||||||
|
|
||||||
|
return(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
int _chdrive( int drive )
|
||||||
|
{
|
||||||
|
STUB_FUNCTION;
|
||||||
|
}
|
||||||
|
int _getdrive( void )
|
||||||
|
{
|
||||||
|
STUB_FUNCTION;
|
||||||
|
}
|
||||||
|
void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext )
|
||||||
|
{
|
||||||
|
STUB_FUNCTION;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
57
zsnes/src/linux/zipxw.c
Normal file
57
zsnes/src/linux/zipxw.c
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||||
|
//
|
||||||
|
//This program is free software; you can redistribute it and/or
|
||||||
|
//modify it under the terms of the GNU General Public License
|
||||||
|
//as published by the Free Software Foundation; either
|
||||||
|
//version 2 of the License, or (at your option) any later
|
||||||
|
//version.
|
||||||
|
//
|
||||||
|
//This program is distributed in the hope that it will be useful,
|
||||||
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
//GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
//You should have received a copy of the GNU General Public License
|
||||||
|
//along with this program; if not, write to the Free Software
|
||||||
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
#ifndef __LINUX__
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ipx_init(){};
|
||||||
|
void sendpacket(){};
|
||||||
|
void checkpacket(){};
|
||||||
|
void read_packet(){};
|
||||||
|
void ipx_deinit(){};
|
||||||
|
void deinitipx(){};
|
||||||
|
void initipx(){};
|
||||||
|
void ipxgetchar(){};
|
||||||
|
void ipxsendchar(){};
|
||||||
|
void ipxlookforconnect(){};
|
||||||
|
void PreparePacketIPX(){};
|
||||||
|
void SendPacketIPX(){};
|
||||||
|
|
||||||
|
unsigned char IPXSearchval;
|
||||||
|
unsigned short ipx_initcode;
|
||||||
|
unsigned int ipx_packet;
|
||||||
|
unsigned int ipx_packet_size;
|
||||||
|
unsigned char ipx_packet_ready;
|
||||||
|
unsigned int ipx_read_packet;
|
||||||
|
|
||||||
|
/*
|
||||||
|
EXTSYM _ipx_init ; To init ipx
|
||||||
|
EXTSYM _ipx_initcode ; return 0 if everything is ok (int)
|
||||||
|
|
||||||
|
EXTSYM _ipx_packet ; 80 bytes buffer to send
|
||||||
|
EXTSYM _ipx_packet_size ; size to send (max 80 bytes) (dword)
|
||||||
|
EXTSYM _sendpacket ; to send a packet
|
||||||
|
|
||||||
|
EXTSYM _checkpacket ; check if a packet is ready to receive
|
||||||
|
EXTSYM _ipx_packet_ready ; return 1 if there is a packet ready (byte)
|
||||||
|
|
||||||
|
EXTSYM _read_packet ; to read an incoming packet
|
||||||
|
EXTSYM _ipx_read_packet ; 80 bytes buffer of received packet
|
||||||
|
|
||||||
|
EXTSYM _ipx_deinit ; to deinit the ipx
|
||||||
|
*/
|
||||||
577
zsnes/src/linux/zloaderw.c
Normal file
577
zsnes/src/linux/zloaderw.c
Normal file
@@ -0,0 +1,577 @@
|
|||||||
|
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
|
||||||
|
//
|
||||||
|
//This program is free software; you can redistribute it and/or
|
||||||
|
//modify it under the terms of the GNU General Public License
|
||||||
|
//as published by the Free Software Foundation; either
|
||||||
|
//version 2 of the License, or (at your option) any later
|
||||||
|
//version.
|
||||||
|
//
|
||||||
|
//This program is distributed in the hope that it will be useful,
|
||||||
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
//GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
//You should have received a copy of the GNU General Public License
|
||||||
|
//along with this program; if not, write to the Free Software
|
||||||
|
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
#include <stdio.h>
|
||||||
|
#else
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#endif // __LINUX__
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
|
||||||
|
#define DWORD unsigned long
|
||||||
|
#define _MAX_PATH 80
|
||||||
|
#define _MAX_DRIVE 80
|
||||||
|
#define _MAX_DIR 80
|
||||||
|
#define _MAX_FNAME 80
|
||||||
|
#define _MAX_EXT 80
|
||||||
|
#endif // __LINUX__
|
||||||
|
|
||||||
|
extern void zstart(void);
|
||||||
|
extern void DosExit(void);
|
||||||
|
extern void ConvertJoyMap1(void);
|
||||||
|
extern void ConvertJoyMap2(void);
|
||||||
|
extern void displayparams(void);
|
||||||
|
extern void makeextension(void);
|
||||||
|
|
||||||
|
extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
|
||||||
|
FPUCopy, Force8b, ForcePal, GUIClick, MouseDis,
|
||||||
|
MusicRelVol, ScreenScale, SoundCompD, SoundQuality,
|
||||||
|
StereoSound, V8Mode, antienab, cvidmode, debugdisble,
|
||||||
|
debugger, enterpress, finterleave, frameskip,
|
||||||
|
gammalevel, guioff, per2exec, pl1contrl, pl2contrl,
|
||||||
|
romtype, scanlines, showallext, smallscreenon, soundon,
|
||||||
|
spcon, vsyncon, DisplayS, fname, filefound, SnowOn,
|
||||||
|
NetChatFirst,NetServer,NetNewNick,
|
||||||
|
NetFilename,GUINetTextk2,NetQuitAfter,UDPConfig;
|
||||||
|
|
||||||
|
void ccmdline(void);
|
||||||
|
|
||||||
|
char *ers[] =
|
||||||
|
{
|
||||||
|
"Frame Skip must be a value of 0 to 9!\n",
|
||||||
|
"Gamma Correction Level must be a value of 0 to 5!\n",
|
||||||
|
"Sound Sampling Rate must be a value of 0 to 5!\n",
|
||||||
|
"Invalid Video Mode!\n",
|
||||||
|
"Percentage of instructions to execute must be a number from 50 to 150!\n",
|
||||||
|
"Player Input must be a value from 0 to 6!\n",
|
||||||
|
"Volume must be a number from 0 to 100!\n"
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
|
||||||
|
char ucase(char ch){
|
||||||
|
if ((ch>='a') && (ch<='z')) ch-='a'-'A';
|
||||||
|
return(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
int main (int argc, char *argv[])
|
||||||
|
#else
|
||||||
|
extern HINSTANCE hInst;
|
||||||
|
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
|
||||||
|
#endif // __LINUX__
|
||||||
|
{
|
||||||
|
int longueur;
|
||||||
|
|
||||||
|
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
||||||
|
char fname2[_MAX_FNAME],ext[_MAX_EXT], File[_MAX_PATH];
|
||||||
|
DWORD dwRead;
|
||||||
|
|
||||||
|
char * strp;
|
||||||
|
|
||||||
|
char ExtA[4][512];
|
||||||
|
int charptr,strptr,strcharptr,dquotes;
|
||||||
|
int i,j,nofile;
|
||||||
|
|
||||||
|
#ifndef __LINUX__
|
||||||
|
hInst=hInstance;
|
||||||
|
#else
|
||||||
|
UnProtectMemory();
|
||||||
|
#endif // !__LINUX__
|
||||||
|
|
||||||
|
// Commandline: /ABCDE <nickname> <fname> <IP Addy>
|
||||||
|
// nickname = user nickname
|
||||||
|
// fname = filename w/ full path (if L) or path name (if C)
|
||||||
|
// <IP Addy> = IP Address (Client Only)
|
||||||
|
// A = U (UDP - Recommended if works), T (TCP/IP)
|
||||||
|
// B = S (Server), C (Client)
|
||||||
|
// C = C (Chat first), L (load game first)
|
||||||
|
// D = N (Stay in ZSNESw after disconnect), Q (Quit after disconnect)
|
||||||
|
// E = # of connections (Keep it 2 for now)
|
||||||
|
// eg: ZSNESW /UCCN2 nickname d:\snesroms 202.36.124.28
|
||||||
|
|
||||||
|
strptr=0;
|
||||||
|
charptr=0;
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
STUB_FUNCTION;
|
||||||
|
#else
|
||||||
|
while (szCmdLine[charptr]!=0){
|
||||||
|
while (szCmdLine[charptr]==' ') charptr++;
|
||||||
|
dquotes=0;
|
||||||
|
if (szCmdLine[charptr]=='"'){
|
||||||
|
dquotes=1;
|
||||||
|
charptr++;
|
||||||
|
}
|
||||||
|
strcharptr=0;
|
||||||
|
while (((szCmdLine[charptr]!=' ') || (dquotes)) && (szCmdLine[charptr]!=0)) {
|
||||||
|
if (szCmdLine[charptr]=='"'){
|
||||||
|
dquotes=0;
|
||||||
|
} else {
|
||||||
|
if (strptr<4){
|
||||||
|
ExtA[strptr][strcharptr]=szCmdLine[charptr];
|
||||||
|
if (strcharptr<511)
|
||||||
|
strcharptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
charptr++;
|
||||||
|
}
|
||||||
|
ExtA[strptr][strcharptr]=0;
|
||||||
|
if (strcharptr) strptr++;
|
||||||
|
charptr++;
|
||||||
|
}
|
||||||
|
#endif // __LINUX__
|
||||||
|
|
||||||
|
NetServer=0;
|
||||||
|
NetChatFirst=0;
|
||||||
|
NetQuitAfter=0;
|
||||||
|
nofile=0;
|
||||||
|
if ((strptr>2) && (ExtA[0][0]=='/') && (strlen(ExtA[0])>=5)){
|
||||||
|
nofile=1;
|
||||||
|
if (ucase(ExtA[0][1])=='T') UDPConfig=0;
|
||||||
|
if (ucase(ExtA[0][2])=='S') NetServer=1;
|
||||||
|
if (ucase(ExtA[0][2])=='C') NetServer=2;
|
||||||
|
if (ucase(ExtA[0][3])=='C') NetChatFirst=0;
|
||||||
|
if (ucase(ExtA[0][3])=='L') NetChatFirst=1;
|
||||||
|
if (ucase(ExtA[0][4])=='N') NetQuitAfter=0;
|
||||||
|
if (ucase(ExtA[0][4])=='Q') NetQuitAfter=1;
|
||||||
|
strp=&NetNewNick;
|
||||||
|
i=0; j=0;
|
||||||
|
while (ExtA[1][i]!=0){
|
||||||
|
switch (ExtA[1][i]){
|
||||||
|
case '_':
|
||||||
|
case '-':
|
||||||
|
case '^':
|
||||||
|
case '=':
|
||||||
|
case '+':
|
||||||
|
case '[':
|
||||||
|
case ']':
|
||||||
|
if (j<10){
|
||||||
|
strp[j]=ExtA[1][i];
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (((ucase(ExtA[1][i])>='A') && (ucase(ExtA[1][i])<='Z'))
|
||||||
|
|| ((ExtA[1][i]>='0') && (ExtA[1][i]<='9'))){
|
||||||
|
if (j<10){
|
||||||
|
strp[j]=ExtA[1][i];
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
strp[j]=0;
|
||||||
|
strp=&NetFilename;
|
||||||
|
strncpy(strp,ExtA[2],512);
|
||||||
|
strp[511]=0;
|
||||||
|
if (NetServer==2){
|
||||||
|
if (strptr<4) {
|
||||||
|
NetServer=0;
|
||||||
|
} else {
|
||||||
|
strp=&GUINetTextk2;
|
||||||
|
strncpy(strp,ExtA[3],28);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
STUB_FUNCTION;
|
||||||
|
#else
|
||||||
|
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
|
||||||
|
_splitpath( path_buffer, drive, dir, fname2, ext );
|
||||||
|
_chdrive(drive[0]-'A'+1);
|
||||||
|
chdir(dir+1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//argc=0;
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
STUB_FUNCTION;
|
||||||
|
#else
|
||||||
|
longueur=strlen(szCmdLine);
|
||||||
|
|
||||||
|
if((longueur!=0) && (!nofile))
|
||||||
|
{
|
||||||
|
char *fvar;
|
||||||
|
fvar=&fname;
|
||||||
|
|
||||||
|
fvar[0] = longueur;
|
||||||
|
if(szCmdLine[0]=='"')
|
||||||
|
{
|
||||||
|
strncpy(&fvar[1],&szCmdLine[1],127);
|
||||||
|
fvar[longueur-1]=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy(&fvar[1],szCmdLine,127);
|
||||||
|
}
|
||||||
|
makeextension();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if ( argc > 1) {
|
||||||
|
char *fvar;
|
||||||
|
fvar=&fname;
|
||||||
|
fvar[0] = 10;
|
||||||
|
strcpy(&fvar[1], argv[1]);
|
||||||
|
makeextension();
|
||||||
|
}
|
||||||
|
zstart();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int my_atoi(char *nptr)
|
||||||
|
{
|
||||||
|
int p,c;
|
||||||
|
c=0;
|
||||||
|
for(p=0;nptr[p];p++)
|
||||||
|
{
|
||||||
|
if( !isdigit(nptr[p]) ) c+=1;
|
||||||
|
}
|
||||||
|
if(c) return -1;
|
||||||
|
else return atoi(nptr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ccmdline(void)
|
||||||
|
{
|
||||||
|
int p=0;
|
||||||
|
p=pccmdline();
|
||||||
|
if(p == 0) return;
|
||||||
|
|
||||||
|
if(p == 9)
|
||||||
|
{
|
||||||
|
displayparams();
|
||||||
|
}
|
||||||
|
if(p == 4)
|
||||||
|
{
|
||||||
|
// printf("Mangled command line, did you forget a parm?\n");
|
||||||
|
printf("Invalid Commandline!\n");
|
||||||
|
DosExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if((p > 9) && (p < 17))
|
||||||
|
{
|
||||||
|
printf(ers[p-10]);
|
||||||
|
DosExit();
|
||||||
|
}
|
||||||
|
if(p == 2)
|
||||||
|
{
|
||||||
|
DosExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf("cmdline returned %i\n",p);
|
||||||
|
DosExit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int pccmdline(void)
|
||||||
|
{
|
||||||
|
int p;
|
||||||
|
int gfnm=0;
|
||||||
|
|
||||||
|
for(p=1;p<argc;p++)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
printf("(%i/%i): %s\n",p,argc,argv[p]);
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(argv[p][0] == '-')
|
||||||
|
{
|
||||||
|
int hasroom=0;
|
||||||
|
int pp=1;
|
||||||
|
int cp=p;
|
||||||
|
int nn='_';
|
||||||
|
for(pp=1;argv[cp][pp];pp++)
|
||||||
|
{
|
||||||
|
if( (p+1) < argc) hasroom=1;
|
||||||
|
nn=tolower(argv[cp][pp+1]);
|
||||||
|
switch(tolower(argv[cp][pp]))
|
||||||
|
{
|
||||||
|
case '1': /* Player 1 Input */
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
pl1contrl=my_atoi(argv[p+1]);
|
||||||
|
if(pl1contrl > 6) return 15;
|
||||||
|
p++;
|
||||||
|
ConvertJoyMap1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '2': /* Player 2 Input */
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
pl2contrl=my_atoi(argv[p+1]);
|
||||||
|
if(pl2contrl > 6) return 15;
|
||||||
|
p++;
|
||||||
|
ConvertJoyMap2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'f':
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
frameskip=my_atoi(argv[p+1]);
|
||||||
|
if(frameskip > 9) return 10;
|
||||||
|
p++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'g':
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
gammalevel=my_atoi(argv[p+1]);
|
||||||
|
if(gammalevel > 5) return 11;
|
||||||
|
p++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'p':
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
per2exec=my_atoi(argv[p+1]);
|
||||||
|
if(per2exec > 150) return 14;
|
||||||
|
if(per2exec < 50) return 14;
|
||||||
|
p++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'r':
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
SoundQuality=my_atoi(argv[p+1]);
|
||||||
|
if(SoundQuality > 5) return 12;
|
||||||
|
p++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'v':
|
||||||
|
{
|
||||||
|
if(nn == '8')
|
||||||
|
{
|
||||||
|
V8Mode=1;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
cvidmode=my_atoi(argv[p+1]);
|
||||||
|
if(cvidmode > 10) return 13;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'k':
|
||||||
|
{
|
||||||
|
if(!hasroom) return 4;
|
||||||
|
MusicRelVol=my_atoi(argv[p+1]);
|
||||||
|
if(MusicRelVol > 100) return 16;
|
||||||
|
p++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '8':
|
||||||
|
{
|
||||||
|
Force8b=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '0': /* Palette 0 disable */
|
||||||
|
{
|
||||||
|
Palette0=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '7': /* SPC700 speed hack disable */
|
||||||
|
{
|
||||||
|
SPC700sh=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '9': /* Off by 1 line */
|
||||||
|
{
|
||||||
|
OffBy1Line=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'e':
|
||||||
|
{
|
||||||
|
enterpress=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'h':
|
||||||
|
{
|
||||||
|
romtype=2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'l':
|
||||||
|
{
|
||||||
|
romtype=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'm':
|
||||||
|
{
|
||||||
|
guioff=1; /* disables GUI */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'n':
|
||||||
|
{
|
||||||
|
scanlines=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 's':
|
||||||
|
{
|
||||||
|
if(nn == 'p')
|
||||||
|
{
|
||||||
|
DisplayS=1;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(nn == 'a')
|
||||||
|
{
|
||||||
|
showallext=1;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(nn == 'n')
|
||||||
|
{
|
||||||
|
SnowOn=1;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spcon=1;
|
||||||
|
soundon=1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 't':
|
||||||
|
{
|
||||||
|
ForcePal=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'u':
|
||||||
|
{
|
||||||
|
ForcePal=2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'w':
|
||||||
|
{
|
||||||
|
vsyncon=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'z':
|
||||||
|
{
|
||||||
|
StereoSound=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'd':
|
||||||
|
{
|
||||||
|
if(nn == 'd')
|
||||||
|
{
|
||||||
|
DSPDisable=1;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debugger=1;
|
||||||
|
debugdisble=0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'b':
|
||||||
|
{
|
||||||
|
SoundCompD=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
{
|
||||||
|
if(nn == 'c')
|
||||||
|
{
|
||||||
|
smallscreenon=1;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScreenScale=1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'y':
|
||||||
|
{
|
||||||
|
antienab=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'o':
|
||||||
|
{
|
||||||
|
if(nn == 'm')
|
||||||
|
{
|
||||||
|
FPUCopy=2;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FPUCopy=0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'i':
|
||||||
|
{
|
||||||
|
finterleave=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'j':
|
||||||
|
{
|
||||||
|
GUIClick=0;
|
||||||
|
MouseDis=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '?':
|
||||||
|
{
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(gfnm > 0)
|
||||||
|
{
|
||||||
|
printf("Limit yourself to one filename\n");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *fvar;
|
||||||
|
fvar=&fname;
|
||||||
|
fvar[0] = strlen(argv[p]);
|
||||||
|
strncpy(&fvar[1],argv[p],127);
|
||||||
|
gfnm++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(gfnm == 1)
|
||||||
|
{
|
||||||
|
filefound=0;
|
||||||
|
makeextension();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1
zsnes/src/linux/zsnes.rc
Normal file
1
zsnes/src/linux/zsnes.rc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
IDR_MAINFRAME ICON DISCARDABLE "ZSNES.ICO"
|
||||||
1277
zsnes/src/linux/ztcp.c
Normal file
1277
zsnes/src/linux/ztcp.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user