Pārlūkot izejas kodu

Reformatting the entire tool

master
Gauvain Roussel-Tarbouriech 1 gadu atpakaļ
vecāks
revīzija
b2a696a176
3 mainītis faili ar 262 papildinājumiem un 200 dzēšanām
  1. 14
    0
      .clang-format
  2. 7
    1
      Makefile
  3. 241
    199
      obj2kh2v.cpp

+ 14
- 0
.clang-format Parādīt failu

@@ -0,0 +1,14 @@
1
+---
2
+BasedOnStyle: LLVM 
3
+AllowShortBlocksOnASingleLine: 'true'
4
+AlwaysBreakAfterDefinitionReturnType: None
5
+AlwaysBreakAfterReturnType: None
6
+Cpp11BracedListStyle: 'false'
7
+IndentWidth: '4'
8
+SortIncludes: 'true'
9
+SpacesInCStyleCastParentheses: 'false'
10
+SpacesInContainerLiterals: 'false'
11
+SpacesInParentheses: 'false'
12
+UseTab: Never
13
+
14
+...

+ 7
- 1
Makefile Parādīt failu

@@ -1,7 +1,13 @@
1 1
 WCXX = i686-w64-mingw32-g++
2 2
 CXX = g++
3
+CF = clang-format
4
+
5
+all: format linux
6
+
7
+format:
8
+	$(CF) -i obj2kh2v.cpp
3 9
 linux:
4
-	$(CXX) -std=c++11  obj2kh2v.cpp -o obj2kh2v 
10
+	$(CXX) -g -std=c++11  obj2kh2v.cpp -o obj2kh2v 
5 11
 clean:
6 12
 	rm -rf *.kh2v *.o *.dsm *.exe obj2kh2v
7 13
 windows:

+ 241
- 199
obj2kh2v.cpp Parādīt failu

@@ -1,50 +1,62 @@
1
-#include <stdio.h>
2
-#include <iostream>
3
-#include <string>
4 1
 #include <fstream>
2
+#include <iostream>
3
+#include <limits>
4
+#include <math.h>
5 5
 #include <sstream>
6
+#include <stdio.h>
7
+#include <string>
6 8
 #include <vector>
7
-#include <math.h>
8
-#include <limits>
9
-
10 9
 
11 10
 int max(int x, int y, int z) {
12
-	int flagx = x;
13
-	if (y > flagx) {flagx = y;}
14
-	if (z > flagx) {flagx = z;} 
15
-	return flagx;
11
+    int flagx = x;
12
+    if (y > flagx) {
13
+        flagx = y;
14
+    }
15
+    if (z > flagx) {
16
+        flagx = z;
17
+    }
18
+    return flagx;
16 19
 }
17 20
 
18
-int main(int argc, char* argv[]){
19
-	long ap, vp, hp;
21
+int main(int argc, char *argv[]) {
22
+    long ap, vp, hp;
20 23
     // max uv buffer, should be enough for an entire set of obj vertices
21 24
     int uvs[8192];
22
-    int uv_count=0;
25
+    int uv_count = 0;
23 26
 
24
-    int vertex_count=0;
25
-    int face_count=0;
26
-    int vertices_arg=0;
27
-    int vertex_affiliation=0;
27
+    int vertex_count = 0;
28
+    int face_count = 0;
29
+    int vertices_arg = 0;
30
+    int vertex_affiliation = 0;
28 31
 
29
-	int junk=1;
30
-	printf("obj2kh2v\n-- If you don't know what a VIF packet be prepared to be driven to insanity\n\n");
31
-	if(argc<2){printf("Usage: obj2kh2v model.obj"); return -1;}
32
-	std::ifstream input(argv[1], std::ios::in);
33
-	std::string dsmname = std::string(argv[1]).substr(0,std::string(argv[1]).find_last_of('.'))+".dsm";
34
-	std::string kh2vname = std::string(argv[1]).substr(0,std::string(argv[1]).find_last_of('.'))+".kh2v";
35
-	std::ofstream dsm (dsmname);
32
+    int junk = 0;
33
+    printf("obj2kh2v\n-- If you don't know what a VIF packet be prepared to be "
34
+           "driven to insanity\n\n");
35
+    if (argc < 2) {
36
+        printf("Usage: obj2kh2v model.obj");
37
+        return -1;
38
+    }
39
+    std::ifstream input(argv[1], std::ios::in);
40
+    std::string dsmname =
41
+        std::string(argv[1]).substr(0, std::string(argv[1]).find_last_of('.')) +
42
+        ".dsm";
43
+    std::string kh2vname =
44
+        std::string(argv[1]).substr(0, std::string(argv[1]).find_last_of('.')) +
45
+        ".kh2v";
46
+    std::ofstream dsm(dsmname);
36 47
     std::string line;
37 48
 
38 49
     std::vector<std::string> dsm_mem;
39 50
     std::vector<int> bones;
40 51
     dsm_mem.push_back(".align 0");
41 52
     line = ";";
42
-    line+=argv[1];
53
+    line += argv[1];
43 54
     dsm_mem.push_back(line);
44 55
     dsm_mem.push_back(";Automatically generated by obj2kh2v");
45 56
     dsm_mem.push_back(";DO NOT EDIT IF YOU DON'T KNOW WHAT YOU ARE DOING");
46 57
     dsm_mem.push_back("");
47
-    dsm_mem.push_back("stcycl 01, 01; We write code to memory without skips/overwrite");
58
+    dsm_mem.push_back(
59
+        "stcycl 01, 01; We write code to memory without skips/overwrite");
48 60
     dsm_mem.push_back("");
49 61
     dsm_mem.push_back("unpack[r] V4_32, 0, * ;Model Part Header");
50 62
     dsm_mem.push_back(".int 1, 0, 0, 0 ;type 1 Model");
@@ -55,209 +67,239 @@ int main(int argc, char* argv[]){
55 67
     dsm_mem.push_back("");
56 68
     dsm_mem.push_back(".EndUnpack");
57 69
     dsm_mem.push_back("");
58
-    dsm_mem.push_back("stcycl 01, 01; We write code to memory without skips/overwrite");
70
+    dsm_mem.push_back(
71
+        "stcycl 01, 01; We write code to memory without skips/overwrite");
59 72
     dsm_mem.push_back("");
60 73
     dsm_mem.push_back("unpack[r] V2_16, 4, *; UV definition");
61 74
 
62
-
63
-	if (dsm.is_open()){
64
-    while (getline(input, line))
65
-    {
66
-        if (line.substr(0,2) == "v ")
67
-        {
68
-			vertex_count++;
75
+    if (dsm.is_open()) {
76
+        while (getline(input, line)) {
77
+            if (line.substr(0, 2) == "v ") {
78
+                vertex_count++;
79
+            }
69 80
         }
70
-    }
71
-    input.clear();
72
-    input.seekg(0, std::ios::beg);
73
-    while (getline(input, line))
74
-    {
75
-        if (line.substr(0,2) == "f ")
76
-        {
77
-			face_count++;
81
+        input.clear();
82
+        input.seekg(0, std::ios::beg);
83
+        while (getline(input, line)) {
84
+            if (line.substr(0, 2) == "f ") {
85
+                face_count++;
86
+            }
78 87
         }
79
-    }
80
-    input.clear();
81
-    input.seekg(0, std::ios::beg);
88
+        input.clear();
89
+        input.seekg(0, std::ios::beg);
82 90
 
83
-    while (getline(input, line))
84
-    {
85
-        if (line.substr(0,3) == "vt ")
86
-        {
87
-			std::istringstream s(line.substr(3));
88
-			float u, v;
89
-            s >> u; s >> v;
90
-			printf("tx= %f, ty= %f, txr= %d, tyr=%d\n", u, v, int(round(u*4095)), int(round(v*4095)));		
91
-            uvs[uv_count]=int(round(u*4095));
92
-            uvs[uv_count+1]=int(round(v*4095));
93
-            uv_count+=2;
94
-		}
95
-
96
-	}
97
-    input.clear();
98
-    input.seekg(0, std::ios::beg);
99
-
100
-    while (getline(input, line))
101
-    {
102
-        if (line.substr(0,3) == "vb ")
103
-        {
104
-			std::istringstream s(line.substr(2));
105
-			int v;
106
-            s >> v;
107
-            bones.push_back(v);
108
-			printf("bone= %d\n", v);		
109
-		}
91
+        while (getline(input, line)) {
92
+            if (line.substr(0, 3) == "vt ") {
93
+                std::istringstream s(line.substr(3));
94
+                float u, v;
95
+                s >> u;
96
+                s >> v;
97
+                printf("tx= %f, ty= %f, txr= %d, tyr=%d\n", u, v,
98
+                       int(round(u * 4095)), int(round(v * 4095)));
99
+                uvs[uv_count] = int(round(u * 4095));
100
+                uvs[uv_count + 1] = int(round(v * 4095));
101
+                uv_count += 2;
102
+            }
103
+        }
104
+        input.clear();
105
+        input.seekg(0, std::ios::beg);
110 106
 
111
-	}
112
-    if(bones.size()==0){
113
-        bones.push_back(vertex_count);
114
-    }
115
-    input.clear();
116
-    input.seekg(0, std::ios::beg);
107
+        while (getline(input, line)) {
108
+            if (line.substr(0, 3) == "vb ") {
109
+                std::istringstream s(line.substr(2));
110
+                int v;
111
+                s >> v;
112
+                bones.push_back(v);
113
+                printf("bone= %d\n", v);
114
+            }
115
+        }
116
+        if (bones.size() == 0) {
117
+            bones.push_back(vertex_count);
118
+        }
119
+        input.clear();
120
+        input.seekg(0, std::ios::beg);
117 121
 
122
+        // making temporary entries for uvs to insert later on
123
+        int uv_pos = dsm_mem.size();
124
+        for (int i = 0; i < face_count; i++) {
125
+            dsm_mem.push_back("");
126
+            dsm_mem.push_back("");
127
+            dsm_mem.push_back("");
128
+        }
118 129
 
119
-    // making temporary entries for uvs to insert later on
120
-    int uv_pos=dsm_mem.size();
121
-    for(int i=0; i<face_count;i++){
122
-        dsm_mem.push_back("");
130
+        dsm_mem.push_back(".EndUnpack");
123 131
         dsm_mem.push_back("");
132
+        dsm_mem.push_back(
133
+            "stmask 0xcfcfcfcf; Sets mask register(3303, check EEUSER_E)");
134
+        dsm_mem.push_back(
135
+            "stcycl 01, 01; We write code to memory without skips/overwrite");
124 136
         dsm_mem.push_back("");
125
-    }
137
+        dsm_mem.push_back("unpack[mr] S_8, 4, *; Vertex indices");
126 138
 
127
- 
128
-
129
-    dsm_mem.push_back(".EndUnpack");
130
-    dsm_mem.push_back("");
131
-    dsm_mem.push_back("stmask 0xcfcfcfcf; Sets mask register(3303, check EEUSER_E)");
132
-    dsm_mem.push_back("stcycl 01, 01; We write code to memory without skips/overwrite");
133
-    dsm_mem.push_back("");
134
-    dsm_mem.push_back("unpack[mr] S_8, 4, *; Vertex indices");
139
+        while (getline(input, line)) {
140
+            if (line.substr(0, 2) == "f ") {
141
+                long cur_pos = 0;
142
+                std::istringstream s(line.substr(2));
143
+                std::string i, n, u;
144
+                int ii, inn, iu;
145
+                s >> i;
146
+                s >> n;
147
+                s >> u;
148
+                ii = std::stoi(i.substr(0, i.find("/")));
149
+                inn = std::stoi(n.substr(0, n.find("/")));
150
+                iu = std::stoi(u.substr(0, u.find("/")));
151
+                // printf("i1: %d i2: %d i3: %d\n", ii, inn, iu);
135 152
 
136
-    while (getline(input, line))
137
-    {
138
-        if (line.substr(0,2) == "f ")
139
-        {
140
-            long cur_pos=0;
141
-	        std::istringstream s(line.substr(2));
142
-			std::string i, n, u;
143
-			int ii, inn, iu;
144
-            s >> i; s >> n; s >> u;
145
-			ii = std::stoi(i.substr(0, i.find("/"))); 			
146
-			inn = std::stoi(n.substr(0, n.find("/"))); 			
147
-			iu = std::stoi(u.substr(0, u.find("/"))); 			
148
-			printf("i1: %d i2: %d i3: %d\n", ii, inn, iu);		
149
-            
150
-            line=".byte " + std::to_string(ii-1);
151
-            dsm_mem.push_back(line);
152
-            line=".short " + std::to_string(uvs[(ii-1)*2]) + ", " + std::to_string(uvs[((ii-1)*2)+1]); 
153
-            dsm_mem[uv_pos]=line;
154
-            uv_pos++;
153
+                line = ".byte " + std::to_string(ii - 1);
154
+                dsm_mem.push_back(line);
155
+                line = ".short " + std::to_string(uvs[(ii - 1) * 2]) + ", " +
156
+                       std::to_string(uvs[((ii - 1) * 2) + 1]);
157
+                dsm_mem[uv_pos] = line;
158
+                uv_pos++;
155 159
 
156
-            line=".byte " + std::to_string(inn-1);
157
-            dsm_mem.push_back(line);
158
-            line=".short " + std::to_string(uvs[(inn-1)*2]) + ", " + std::to_string(uvs[((inn-1)*2)+1]); 
159
-            dsm_mem[uv_pos]=line;
160
-            uv_pos++;
160
+                line = ".byte " + std::to_string(inn - 1);
161
+                dsm_mem.push_back(line);
162
+                line = ".short " + std::to_string(uvs[(inn - 1) * 2]) + ", " +
163
+                       std::to_string(uvs[((inn - 1) * 2) + 1]);
164
+                dsm_mem[uv_pos] = line;
165
+                uv_pos++;
161 166
 
162
-            line=".byte " + std::to_string(iu-1);
163
-            dsm_mem.push_back(line);
164
-            line=".short " + std::to_string(uvs[(iu-1)*2]) + ", " + std::to_string(uvs[((iu-1)*2)+1]); 
165
-            dsm_mem[uv_pos]=line;
166
-            uv_pos++;
167
+                line = ".byte " + std::to_string(iu - 1);
168
+                dsm_mem.push_back(line);
169
+                line = ".short " + std::to_string(uvs[(iu - 1) * 2]) + ", " +
170
+                       std::to_string(uvs[((iu - 1) * 2) + 1]);
171
+                dsm_mem[uv_pos] = line;
172
+                uv_pos++;
167 173
 
168
-			printf("bis i1: %d i2: %d i3: %d\n", (ii-1)*2, (inn-1)*2, (iu-1)*2);		
174
+                // printf("bis i1: %d i2: %d i3: %d\n", (ii-1)*2, (inn-1)*2,
175
+                // (iu-1)*2);
176
+            }
169 177
         }
170
-    }
171
-    input.clear();
172
-    input.seekg(0, std::ios::beg);
178
+        input.clear();
179
+        input.seekg(0, std::ios::beg);
173 180
 
174
-    dsm_mem.push_back(".EndUnpack");
175
-    dsm_mem.push_back("");
176
-    dsm_mem.push_back("stmask 0x3f3f3f3f; Sets mask register(3330, check EEUSER_E)");
177
-    dsm_mem.push_back("stcycl 01, 01; We write code to memory without skips/overwrite");
178
-    dsm_mem.push_back("");
179
-    dsm_mem.push_back("unpack[mr] S_8, 4, *; Flags");
181
+        dsm_mem.push_back(".EndUnpack");
182
+        dsm_mem.push_back("");
183
+        dsm_mem.push_back(
184
+            "stmask 0x3f3f3f3f; Sets mask register(3330, check EEUSER_E)");
185
+        dsm_mem.push_back(
186
+            "stcycl 01, 01; We write code to memory without skips/overwrite");
187
+        dsm_mem.push_back("");
188
+        dsm_mem.push_back("unpack[mr] S_8, 4, *; Flags");
180 189
 
181
-    for(int i=0; i<face_count; i++){
182
-        dsm_mem.push_back(".byte 0x10; stock");
183
-        dsm_mem.push_back(".byte 0x10; stock");
184
-        dsm_mem.push_back(".byte 0x20; draw triangle");
185
-    }
186
-    dsm_mem.push_back(".EndUnpack");
187
-    dsm_mem.push_back("");
188
-    dsm_mem.push_back("stcol 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000; We set garbage data to 1(float) so even if nothing is referenced game doesn't go crazy");
189
-    dsm_mem.push_back("stmask 0x80808080; Sets mask register(0002, check EEUSER_E)");
190
-    dsm_mem.push_back("stcycl 01, 01; We write code to memory without skips/overwrite");
191
-    dsm_mem.push_back("");
192
-    dsm_mem.push_back("unpack[mr] V3_32, , *; Vertex definition");
193
-    vertices_arg = dsm_mem.size()-1;
190
+        for (int i = 0; i < face_count; i++) {
191
+            dsm_mem.push_back(".byte 0x10; stock");
192
+            dsm_mem.push_back(".byte 0x10; stock");
193
+            dsm_mem.push_back(".byte 0x20; draw triangle");
194
+        }
195
+        dsm_mem.push_back(".EndUnpack");
196
+        dsm_mem.push_back("");
197
+        dsm_mem.push_back("stcol 0x3f800000, 0x3f800000, 0x3f800000, "
198
+                          "0x3f800000; We set garbage data to 1(float) so even "
199
+                          "if nothing is referenced game doesn't go crazy");
200
+        dsm_mem.push_back(
201
+            "stmask 0x80808080; Sets mask register(0002, check EEUSER_E)");
202
+        dsm_mem.push_back(
203
+            "stcycl 01, 01; We write code to memory without skips/overwrite");
204
+        dsm_mem.push_back("");
205
+        dsm_mem.push_back("unpack[mr] V3_32, , *; Vertex definition");
206
+        vertices_arg = dsm_mem.size() - 1;
194 207
 
195
-    while (getline(input, line))
196
-    {
197
-            if (line.substr(0,2) == "v ")
198
-            {
208
+        while (getline(input, line)) {
209
+            if (line.substr(0, 2) == "v ") {
199 210
                 std::istringstream s(line.substr(2));
200 211
                 float x, y, z, w;
201
-                s >> x; s >> y; s >> z; w = 1.0f;
202
-                line=".float " + std::to_string(x) + ", " + std::to_string(y) + ", " + std::to_string(z);
212
+                s >> x;
213
+                s >> y;
214
+                s >> z;
215
+                w = 1.0f;
216
+                line = ".float " + std::to_string(x) + ", " +
217
+                       std::to_string(y) + ", " + std::to_string(z);
203 218
                 dsm_mem.push_back(line);
204 219
             }
205
-    }
206
-
207
-    dsm_mem.push_back(".EndUnpack");
208
-    dsm_mem.push_back("");
209
-    dsm_mem.push_back("stcycl 01, 01; We write code to memory without skips/overwrite");
210
-    dsm_mem.push_back("");
211
-    dsm_mem.push_back("unpack[r] V4_32, ,*; Vertex affiliation header");
212
-    printf("%lu", bones.size());
213
-    vertex_affiliation = dsm_mem.size()-1;
214
-    for(int i=0; i<ceil(float(bones.size())/4); i++){
215
-        line = ".int " + std::to_string(bones[(i*4)]);
216
-        int z=1;
217
-        while((i*4)+z<bones.size() && z < 4){
218
-        line+= ", " + std::to_string(bones[(i*4)+z]);
219
-        z++;
220 220
         }
221
-        for(z;z<4;z++){
222
-            line+=", 0";
221
+
222
+        dsm_mem.push_back(".EndUnpack");
223
+        dsm_mem.push_back("");
224
+        dsm_mem.push_back(
225
+            "stcycl 01, 01; We write code to memory without skips/overwrite");
226
+        dsm_mem.push_back("");
227
+        dsm_mem.push_back("unpack[r] V4_32, ,*; Vertex affiliation header");
228
+        // printf("%lu", bones.size());
229
+        vertex_affiliation = dsm_mem.size() - 1;
230
+        for (int i = 0; i < ceil(float(bones.size()) / 4); i++) {
231
+            line = ".int " + std::to_string(bones[(i * 4)]);
232
+            int z = 1;
233
+            while ((i * 4) + z < bones.size() && z < 4) {
234
+                line += ", " + std::to_string(bones[(i * 4) + z]);
235
+                z++;
236
+            }
237
+            for (z; z < 4; z++) {
238
+                line += ", 0";
239
+            }
240
+            dsm_mem.push_back(line);
223 241
         }
224
-        dsm_mem.push_back(line);
242
+        dsm_mem.push_back(".EndUnpack");
243
+        dsm_mem.push_back("vifnop");
244
+        dsm_mem.push_back("vifnop; We wait for data to be kicked in");
225 245
     }
226
-    dsm_mem.push_back(".EndUnpack");
227
-    dsm_mem.push_back("vifnop");
228
-    dsm_mem.push_back("vifnop; We wait for data to be kicked in");
246
+    printf("h1: %i, h2: 4, h3: %i, h4: %i\nj1: %i, j2: %i, j3: 0, j4: 1\n", 0,
247
+           4 + (face_count * 3) + vertex_count,
248
+           int(4 + (face_count * 3) + vertex_count +
249
+               ceil(float(bones.size()) / 4)),
250
+           4 + (face_count * 3), int(bones.size()));
251
+    // TODO: Stop hardcode Header size(5type-line exist) and Vert/Array
252
+    // h3: 1 not because 1 value but 1 array of 4, padding needs to be
253
+    // checked!
229 254
 
255
+    line = ".int " + std::to_string(face_count * 3) + ", 4, " +
256
+           std::to_string(4 + (face_count * 3) + vertex_count) + ", " +
257
+           std::to_string(int(4 + (face_count * 3) + vertex_count +
258
+                              ceil(float(bones.size()) / 4))) +
259
+           "; Number of u+v+flag+index, their offset, offset of vertex "
260
+           "affiliation header, offset of mat definition(end)";
261
+    dsm_mem[tmpheader] = line;
262
+    dsm_mem[tmpheader + 1] =
263
+        ".int 0, 0, 0, 0; Nobody care about vertices merging and colors";
264
+    line = ".int " + std::to_string(vertex_count) + ", " +
265
+           std::to_string(4 + (face_count * 3)) + ", 0, " +
266
+           std::to_string(bones.size()) +
267
+           "; Number of vertices, their offset, reserved and number of array "
268
+           "attribution";
269
+    dsm_mem[tmpheader + 2] = line;
270
+    line = "unpack[mr] V3_32, " + std::to_string(4 + (face_count * 3)) +
271
+           ", *; Vertex definition";
272
+    dsm_mem[vertices_arg] = line;
273
+    line = "unpack[r] V4_32, " +
274
+           std::to_string(4 + (face_count * 3) + vertex_count) +
275
+           " ,*; Vertex affiliation header";
276
+    dsm_mem[vertex_affiliation] = line;
230 277
 
278
+    for (int i = 0; i < dsm_mem.size(); i++) {
279
+        dsm << dsm_mem[i] << std::endl;
231 280
     }
232
-    printf("h1: %i, h2: 4, h3: %i, h4: %i\nj1: %i, j2: %i, j3: 0, j4: 1\n",0, 4+0+vertex_count, 4+0+vertex_count+1,vertex_count, 4+0);
233
-		//TODO: Stop hardcode Header size(5type-line exist) and Vert/Array
234
-		//h3: 1 not because 1 value but 1 array of 4, padding needs to be
235
-		//checked!
236
-        
281
+    dsm.close();
237 282
 
238
-        line=".int " + std::to_string(face_count*3) + ", 4, " + std::to_string(4+(face_count*3)+vertex_count) + ", " + std::to_string(int(4+(face_count*3)+vertex_count+ceil(float(bones.size())/4))) + "; Number of u+v+flag+index, their offset, offset of vertex affiliation header, offset of mat definition(end)";
239
-        dsm_mem[tmpheader]=line;
240
-        dsm_mem[tmpheader+1]=".int 0, 0, 0, 0; Nobody care about vertices merging and colors";
241
-        line=".int " + std::to_string(vertex_count) + ", " + std::to_string(4+(face_count*3)) + ", 0, " + std::to_string(bones.size()) + "; Number of vertices, their offset, reserved and number of array attribution";
242
-        dsm_mem[tmpheader+2]=line;
243
-        line="unpack[mr] V3_32, " + std::to_string(4+(face_count*3)) + ", *; Vertex definition";
244
-        dsm_mem[vertices_arg]=line;
245
-        line="unpack[r] V4_32, " + std::to_string(4+(face_count*3)+vertex_count) + " ,*; Vertex affiliation header";
246
-        dsm_mem[vertex_affiliation]=line;
247
-
248
-        for(int i=0; i<dsm_mem.size(); i++){
249
-            dsm << dsm_mem[i] << std::endl;
250
-        }
251
-        dsm.close();
252
-	    
253
-        if(system(("dvp-as \""+dsmname+"\" -o junk.o").c_str()) != 0){printf("Could not proceed, please install the homebrew ps2 sdk!\n"); return -1;}
254
-		if(system(("dvp-objcopy -O binary junk.o \""+kh2vname+"\"").c_str()) != 0){printf("Your homebrew ps2 sdk installation seems to be broken, please reinstall\n"); return -1;}
255
-		remove("junk.o");
256
-		if(!junk){remove(dsmname.c_str());}
283
+    if (system(("dvp-as \"" + dsmname + "\" -o junk.o").c_str()) != 0) {
284
+        printf("Could not proceed, please install the homebrew ps2 sdk!\n");
285
+        return -1;
286
+    }
287
+    if (system(("dvp-objcopy -O binary junk.o \"" + kh2vname + "\"").c_str()) !=
288
+        0) {
289
+        printf("Your homebrew ps2 sdk installation seems to be broken, please "
290
+               "reinstall\n");
291
+        return -1;
292
+    }
293
+    remove("junk.o");
294
+    if (!junk) {
295
+        remove(dsmname.c_str());
296
+    }
257 297
 
258
-        FILE * vifpkt = fopen(kh2vname.c_str(), "a");
259
-        char empty[] = {0x00};
260
-        while(ftell(vifpkt)%16!=0){fwrite(empty , 1 , sizeof(empty) , vifpkt);}
261
-        fclose(vifpkt);
262
-		return 1;
298
+    FILE *vifpkt = fopen(kh2vname.c_str(), "a");
299
+    char empty[] = { 0x00 };
300
+    while (ftell(vifpkt) % 16 != 0) {
301
+        fwrite(empty, 1, sizeof(empty), vifpkt);
302
+    }
303
+    fclose(vifpkt);
304
+    return 1;
263 305
 }

Notiek ielāde…
Atcelt
Saglabāt