From 75d6916ec69878af6649dd41ccdc41b5df807230 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 27 Sep 2002 20:36:49 +0000 Subject: Adding missing files --- PcsxSrc/Makefile | 5 +++++ generic/Main.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ includes/Main.h | 24 ++++++++++++++++++++++++ includes/cdabstract.h | 8 ++++++++ lib/cdabstract.cpp | 11 +++++++++++ 5 files changed, 93 insertions(+) create mode 100644 PcsxSrc/Makefile create mode 100644 generic/Main.cpp create mode 100644 includes/Main.h create mode 100644 includes/cdabstract.h create mode 100644 lib/cdabstract.cpp diff --git a/PcsxSrc/Makefile b/PcsxSrc/Makefile new file mode 100644 index 0000000..25f8d79 --- /dev/null +++ b/PcsxSrc/Makefile @@ -0,0 +1,5 @@ +all: + make -C Linux + +clean: + make -C Linux clean diff --git a/generic/Main.cpp b/generic/Main.cpp new file mode 100644 index 0000000..774cf08 --- /dev/null +++ b/generic/Main.cpp @@ -0,0 +1,45 @@ +#include "Main.h" +#include "generic.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +Main::Main() : setted(false) {} + +Main::~Main() {} + +extern Main * Application; + +void Main::set_args(int a_argc, char ** a_argv, char ** a_enve) { + if (setted) { + return; + } + argc = a_argc; + argv = a_argv; + enve = a_enve; + setted = true; +} + +int main(int argc, char ** argv, char ** enve) { + int r; + + try { + Application->set_args(argc, argv, enve); + r = Application->startup(); + } + catch (Exit e) { + r = e.GetCode(); + } + catch (GeneralException e) { + printm(M_ERROR, "The application caused an exception: %s\n", e.GetMsg()); + delete Application; + exit(-1); + } + catch (...) { + printm(M_ERROR, "The application caused an unknow exception\n"); + delete Application; + exit(-1); + } + delete Application; + exit(r); +} diff --git a/includes/Main.h b/includes/Main.h new file mode 100644 index 0000000..4a81b3e --- /dev/null +++ b/includes/Main.h @@ -0,0 +1,24 @@ +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#include "Exceptions.h" + +class Main : public Base { + public: + Main(); + virtual ~Main(); + virtual int startup() throw (GeneralException) = 0; + protected: + void set_args(int, char **, char **); + int argc; + char ** argv; + char ** enve; + bool setted; + + friend int main(int, char **, char **); +}; + +#define CODE_BEGINS class Appli : public Main { +#define CODE_ENDS } * Application = new Appli(); + +#endif diff --git a/includes/cdabstract.h b/includes/cdabstract.h new file mode 100644 index 0000000..66aa909 --- /dev/null +++ b/includes/cdabstract.h @@ -0,0 +1,8 @@ +#ifndef __CD_ABSTRACT_H__ +#define __CD_ABSTRACT_H__ + +#include "Handle.h" + +Handle * open_iso(const String &); + +#endif diff --git a/lib/cdabstract.cpp b/lib/cdabstract.cpp new file mode 100644 index 0000000..083aa4d --- /dev/null +++ b/lib/cdabstract.cpp @@ -0,0 +1,11 @@ +#include "cdabstract.h" +#include "Input.h" +#include "cdreader.h" + +Handle * open_iso(const String & nom) { + if (nom.extract(0, 2).toupper() == "CD:") { + return new cdreader(nom.extract(3)); + } else { + return new Input(nom); + } +} -- cgit v1.2.3