xoreos  0.0.5
probes.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/common/ustring.h"
26 #include "src/common/filelist.h"
27 
29 
31 #include "src/engines/jade/jade.h"
32 
33 namespace Engines {
34 
35 namespace Jade {
36 
38 private:
39  static const Common::UString kGameName;
40 
41 public:
44 
46  return Aurora::kGameIDJade;
47  }
48 
49  const Common::UString &getGameName() const {
50  return kGameName;
51  }
52 
53  bool probe(Common::SeekableReadStream &UNUSED(stream)) const {
54  return false;
55  }
56 
58  return new JadeEngine;
59  }
60 };
61 
62 const Common::UString EngineProbe::kGameName = "Jade Empire";
63 
64 
66 public:
69 
71 
72  bool probe(const Common::UString &UNUSED(directory), const Common::FileList &rootFiles) const {
73  // If the launcher binary is found, this should be a valid path
74  if (rootFiles.contains("/JadeEmpire.exe", true))
75  return true;
76 
77  return false;
78  }
79 
80 };
81 
82 class EngineProbeXbox : public EngineProbe {
83 public:
86 
88 
89  bool probe(const Common::UString &UNUSED(directory), const Common::FileList &rootFiles) const {
90  if (rootFiles.contains("/jadedirs.ini", true))
91  return true;
92 
93  return false;
94  }
95 
96 };
97 
99 public:
102 
104 
105  bool probe(const Common::UString &UNUSED(directory), const Common::FileList &rootFiles) const {
106  // TODO: Detect the unextracted OBBs? Doesn't work with how we index directories, though.
107 
108  if (rootFiles.contains("/jadeempire.par", true))
109  return true;
110 
111  return false;
112  }
113 
114 };
115 
116 
117 void createEngineProbes(std::list<const ::Engines::EngineProbe *> &probes) {
118  probes.push_back(new EngineProbeWindows);
119  probes.push_back(new EngineProbeXbox);
120  probes.push_back(new EngineProbeAndroid);
121 }
122 
123 } // End of namespace Jade
124 
125 } // End of namespace Engines
GameID
Definition: types.h:393
static const Common::UString kGameName
Definition: probes.cpp:39
Aurora::GameID getGameID() const
Get the GameID that the probe is able to detect.
Definition: probes.cpp:45
A class holding an UTF-8 string.
Definition: ustring.h:48
Probing for an installation of Jade Empire.
Engine class handling Jade Empire.
Aurora::Platform getPlatform() const
Get the Platform that the probe is able to detect.
Definition: probes.cpp:70
A probe that checks if an engine can handle game data found in a specific directory and creates an in...
Jade Empire.
Definition: types.h:399
Android mobile phones and tablets.
Definition: types.h:437
const Common::UString & getGameName() const
Return a string of the full game name.
Definition: probes.cpp:49
Aurora::Platform getPlatform() const
Get the Platform that the probe is able to detect.
Definition: probes.cpp:87
#define UNUSED(x)
Definition: system.h:170
Microsoft Xbox.
Definition: types.h:433
bool probe(const Common::UString &directory, const Common::FileList &rootFiles) const
Check for the game in that directory, containing these files.
Definition: probes.cpp:105
void createEngineProbes(std::list< const ::Engines::EngineProbe *> &probes)
Definition: probes.cpp:117
Unicode string handling.
The base class for an engine within BioWare&#39;s Aurora family.
Definition: engine.h:49
A probe able to detect one specific game.
Definition: engineprobe.h:44
bool probe(const Common::UString &directory, const Common::FileList &rootFiles) const
Check for the game in that directory, containing these files.
Definition: probes.cpp:72
A list of files.
Definition: filelist.h:35
Microsoft Windows.
Definition: types.h:430
Engines::Engine * createEngine() const
Create the respective engine for the GameID.
Definition: probes.cpp:57
A list of files.
bool probe(const Common::UString &directory, const Common::FileList &rootFiles) const
Check for the game in that directory, containing these files.
Definition: probes.cpp:89
bool probe(Common::SeekableReadStream &stream) const
Check for the game in that file.
Definition: probes.cpp:53
Interface for a seekable & readable data stream.
Definition: readstream.h:265
Platform
Definition: types.h:429
Aurora::Platform getPlatform() const
Get the Platform that the probe is able to detect.
Definition: probes.cpp:103
bool contains(const UString &str, bool caseInsensitive) const
Does the list contain at least one file ending with the given string?
Definition: filelist.cpp:185