src/demo.cpp

Sun, 11 Aug 2013 03:02:50 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 11 Aug 2013 03:02:50 +0300
changeset 11
3ddebf76105e
parent 10
bc1414343e19
child 13
9bdddd2ccde6
permissions
-rw-r--r--

made style more consistent

6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 #include <QFile>
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 #include <QDataStream>
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 #include <QMessageBox>
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 #include <QProcess>
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 #include "demo.h"
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 #include "bytestream.h"
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 #include "misc.h"
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
8 #include "ui_demoprompt.h"
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
9 #include "prompts.h"
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
11 static const uint32 g_demoSignature = makeByteID ('Z', 'C', 'L', 'D');
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 // =============================================================================
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 // -----------------------------------------------------------------------------
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
15 str uncolorize (const str& in) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
16 str out;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
17 int skip = 0;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
18
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
19 for (const qchar& c : in) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
20 if (skip-- > 0)
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
21 continue;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
22
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
23 if (c.toAscii() == '\034') {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
24 skip = 1;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
25 continue;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
26 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
27
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
28 out += c;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
29 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
30
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
31 return out;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 // =============================================================================
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 // -----------------------------------------------------------------------------
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
36 static str tr (const char* msg) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
37 return QObject::tr (msg);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 // =============================================================================
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 // -----------------------------------------------------------------------------
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
42 static void error (str msg) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
43 QMessageBox::critical (null, "Error", msg);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // =============================================================================
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 // -----------------------------------------------------------------------------
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
48 static bool isKnownVersion (str ver) {
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 QSettings cfg;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
50 list<var> versions = getVersionsList();
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
51
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
52 for (const var& it : versions)
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
53 if (it.toString() == ver || it.toString() + 'M' == ver)
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
54 return true;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
56 return false;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
57 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
58
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
59 // =============================================================================
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
60 // -----------------------------------------------------------------------------
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
61 static str findWAD (str name) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
62 QSettings cfg;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
63 list<var> paths = cfg.value ("wads/paths", list<var>()).toList();
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
64
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
65 if (paths.size() == 0) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
66 error (tr ("No WAD paths configured!"));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
67
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
68 // Cannot just return an empty string here since that'd trigger
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
69 // another error prompt - skip ahead and exit.
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
70 exit (9);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
73 for (const var& it : paths) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
74 str fullpath = fmt ("%1/%2", it.toString(), name);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
75 QFile f (fullpath);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
77 if (f.exists())
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 return fullpath;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 return "";
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 // =============================================================================
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 // -----------------------------------------------------------------------------
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
86 int launchDemo (str path) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
87 FILE* fp = fopen (path.toStdString().c_str(), "r");
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
89 if (!fp) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
90 error (fmt (tr ("Couldn't open '%1' for reading: %2"), path, strerror (errno)));
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 return 1;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
94 fseek (fp, 0, SEEK_END);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
95 const size_t fsize = ftell (fp);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
96 rewind (fp);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 char* buf = new char[fsize];
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
100 if (fread (buf, 1, fsize, fp) != fsize) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
101 error (tr ("I/O error"));
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 delete[] buf;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 return 2;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 }
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
105
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
106 Bytestream s (buf, fsize);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 delete[] buf;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 uint8 offset;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 uint32 length;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 struct {
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 str netname, skin, className;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 uint8 gender, handicap, unlagged, respawnOnFire, ticsPerUpdate, connectionType;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 uint32 color, aimdist, railcolor;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 } userinfo;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 // Check signature
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 {
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 uint32 sig;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
122 if (!s.readLong (sig) || sig != g_demoSignature) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
123 error (fmt (tr ("'%1' is not a Zandronum demo file!"), path));
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 return 3;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 // Zandronum stores CLD_DEMOLENGTH after the signature. This is also the
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 // first demo enumerator, so we can determine the offset (which is variable!)
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 // from this byte
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
131 s.readByte (offset);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
132 s.readLong (length);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
133
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 uint16 zanversionID, numWads;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 uint32 longSink;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 str zanversion;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 list<str> wads;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 bool ready = false;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
139 uint8 buildID;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
141 // Read the demo header and get data
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
142 for (;;) {
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
143 uint8 header;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
144
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
145 if (!s.readByte (header))
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146 break;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
148 if (header == DemoBodyStart + offset) {
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149 ready = true;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150 break;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
151 } elif (header == DemoVersion + offset) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
152 s.readShort (zanversionID);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
153 s.readString (zanversion);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
154
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
155 if (zanversion.left (4) != "1.1-" && zanversion.left (6) != "1.1.1-")
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
156 s.readByte (buildID);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
157 else
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
158 buildID = 1;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
159
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
160 s.readLong (longSink); // rng seed - we don't need it
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
161 } elif (header == DemoUserInfo + offset) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
162 s.readString (userinfo.netname);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
163 s.readByte (userinfo.gender);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
164 s.readLong (userinfo.color);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
165 s.readLong (userinfo.aimdist);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
166 s.readString (userinfo.skin);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
167 s.readLong (userinfo.railcolor);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
168 s.readByte (userinfo.handicap);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
169 s.readByte (userinfo.unlagged);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
170 s.readByte (userinfo.respawnOnFire);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
171 s.readByte (userinfo.ticsPerUpdate);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
172 s.readByte (userinfo.connectionType);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
173 s.readString (userinfo.className);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
174 } elif (header == DemoWads + offset) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
175 str sink;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
176 s.readShort (numWads);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
177
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
178 for (uint8 i = 0; i < numWads; ++i) {
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
179 str wad;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
180 s.readString (wad);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
181 wads << wad;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
183
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
184 // The demo has two checksum strings. We're not interested
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 // in them though.
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
186 for (int i = 0; i < 2; ++i)
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
187 s.readString (sink);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
188 } else {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
189 error (fmt (tr ("Unknown header %1!\n"), (int) header));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
190 return 3;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
191 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
192 }
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
193
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
194 if (!ready) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
195 error (fmt (tr ("Incomplete demo header in '%s'!"), path));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
196 return 3;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
199 if (!isKnownVersion (zanversion)) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
200 UnknownVersionPrompt* prompt = new UnknownVersionPrompt (path, zanversion, (buildID == 1));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
201 if (!prompt->exec())
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
202 return 6;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
203
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
204 if (!isKnownVersion (zanversion)) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
205 error (tr ("Failure in configuration! This shouldn't happen."));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
206 return 6;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
207 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
208 }
11
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
209
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
210 QSettings cfg;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
211 str binarypath = cfg.value (binaryConfigName (zanversion)).toString();
11
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
212
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
213 if (binarypath.isEmpty()) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
214 error (fmt (tr ("No binary path specified for Zandronum version %1!"), zanversion));
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
215 return 7;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
216 }
11
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
217
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
218 str iwadpath;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
219 list<str> pwadpaths;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
220
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221 // Find the WADs
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
222 for (const str& wad : wads) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
223 str path = findWAD (wad);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
224
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
225 // IWAD names can appear in uppercase too. Linux is case-sensitive, so..
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
226 if (&wad == &wads[0] && path.isEmpty())
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
227 path = findWAD (wad.toUpper());
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
228
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
229 if (path.isEmpty()) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
230 error (fmt (tr ("Couldn't find %1!"), wad));
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
231 return 8;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
232 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
233
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
234 if (&wad == &wads[0])
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235 iwadpath = path;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
236 else
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
237 pwadpaths << path;
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
238 }
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
239
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
240 if (!cfg.value ("nodemoprompt", false).toBool()) {
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
241 str pwadtext;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
242
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
243 for (const str& pwad : wads) {
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
244 if (&pwad == &wads[0])
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
245 continue; // skip the IWAD
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
246
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
247 if (!pwadtext.isEmpty())
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
248 pwadtext += "<br />";
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
249
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
250 pwadtext += pwad;
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
251 }
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
252
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
253 QDialog* dlg = new QDialog;
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
254 Ui_DemoPrompt ui;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
255 ui.setupUi (dlg);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
256 ui.demoNameLabel->setText (basename (path));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
257 ui.demoRecorder->setText (uncolorize (userinfo.netname));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
258 ui.versionLabel->setText (zanversion);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
259 ui.iwadLabel->setText (wads[0]);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
260 ui.pwadsLabel->setText (pwadtext);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
261 dlg->setWindowTitle (fmt (APPNAME " %1", versionString()));
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
262
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
263 if (!dlg->exec())
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
264 return 1;
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
265 }
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
266
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
267 QStringList cmdlineList ( {
8
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
268 "-playdemo", path,
e8f645d9f28f Added a prompt for demo information
Teemu Piippo <crimsondusk64@gmail.com>
parents: 6
diff changeset
269 "-iwad", iwadpath,
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
270 });
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
271
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
272 if (pwadpaths.size() > 0) {
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
273 cmdlineList << "-file";
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
274 cmdlineList << pwadpaths;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
275 }
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
276
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
277 print ("Executing: %1 %2\n", binarypath, cmdlineList.join (" "));
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
278 QProcess* proc = new QProcess;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
279 proc->start (binarypath, cmdlineList);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
280 proc->waitForFinished (-1);
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
281 return 0;
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
282 }

mercurial