summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PcsxSrc/Makefile5
-rw-r--r--generic/Main.cpp45
-rw-r--r--includes/Main.h24
-rw-r--r--includes/cdabstract.h8
-rw-r--r--lib/cdabstract.cpp11
5 files changed, 93 insertions, 0 deletions
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);
+ }
+}