From 60c1003845035ad4cd0e9ea50862bad7626faf0e Mon Sep 17 00:00:00 2001 From: Pixel Date: Sat, 21 Sep 2002 18:47:46 +0000 Subject: Added the Pcsx source. --- PcsxSrc/Linux/LnxMain.c | 197 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 PcsxSrc/Linux/LnxMain.c (limited to 'PcsxSrc/Linux/LnxMain.c') diff --git a/PcsxSrc/Linux/LnxMain.c b/PcsxSrc/Linux/LnxMain.c new file mode 100644 index 0000000..e0012f6 --- /dev/null +++ b/PcsxSrc/Linux/LnxMain.c @@ -0,0 +1,197 @@ +/* Pcsx - Pc Psx Emulator + * Copyright (C) 1999-2002 Pcsx Team + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Linux.h" +#include "Sio.h" + +static char PcsxHelp[] = { + "Pcsx " PCSX_VERSION "\n" + " pcsx [options] [file]\n" + "\toptions:\n" + "\t-runcd\t\tRuns CdRom\n" + "\t-runcdbios\tRuns CdRom Through Bios\n" + "\t-nogui\t\tDon't open GtkGui\n" + "\t-cfg FILE\tLoads desired configuration file (def:Pcsx.cfg)\n" + "\t-psxout\t\tEnable psx output\n" + "\t-load STATENUM\tLoads savestate STATENUM (1-5)\n" + "\t-h -help\tThis help\n" + "\tfile\t\tLoads file\n" +}; + +int UseGui = 1; + +int main(int argc, char *argv[]) { + char *file = NULL; + int runcd = 0; + int loadst = 0; + int i; + + strcpy(cfgfile, "Pcsx.cfg"); + + for (i=1; iExecute(); + + return 0; +} + +int SysInit() { + +#ifdef GTE_DUMP + gteLog = fopen("gteLog.txt","wb"); + setvbuf(gteLog, NULL, _IONBF, 0); +#endif + +#ifdef EMU_LOG +#ifndef LOG_STDOUT + emuLog = fopen("emuLog.txt","wb"); +#else + emuLog = stdout; +#endif + setvbuf(emuLog, NULL, _IONBF, 0); +#endif + + psxInit(); + + LoadPlugins(); + LoadMcds(Config.Mcd1, Config.Mcd2); + + return 0; +} + +void SysReset() { + psxReset(); +} + +void SysClose() { + psxShutdown(); + ReleasePlugins(); + + if (emuLog != NULL) fclose(emuLog); +} + +void SysPrintf(char *fmt, ...) { + va_list list; + char msg[512]; + + va_start(list, fmt); + vsprintf(msg, fmt, list); + va_end(list); + + if (Config.PsxOut) printf ("%s", msg); +#ifdef EMU_LOG + fprintf(emuLog, "%s", msg); +#endif +} + +void *SysLoadLibrary(char *lib) { + return dlopen(lib, RTLD_NOW); +} + +void *SysLoadSym(void *lib, char *sym) { + return dlsym(lib, sym); +} + +char *SysLibError() { + return dlerror(); +} + +void SysCloseLibrary(void *lib) { + dlclose(lib); +} + +void SysUpdate() { + PADhandleKey(PAD1_keypressed()); + PADhandleKey(PAD2_keypressed()); +} + +void SysRunGui() { + RunGui(); +} \ No newline at end of file -- cgit v1.2.3