40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# define asm __asm__
# include <gccore.h>
# include <wiiuse/wpad.h>
# undef BOOL
# undef asm
#endif
enum {
NO_COLOR,
RED,
GREEN,
YELLOW
};
|
>
>
>
>
>
>
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# define asm __asm__
# include <gccore.h>
# include <wiiuse/wpad.h>
# undef BOOL
# undef asm
#endif
#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm
#endif
enum {
NO_COLOR,
RED,
GREEN,
YELLOW
};
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
if ((tid = sceKernelCreateThread("update_thread", callback_thread,
0x11, 0xFA0, 0, 0)) >= 0)
sceKernelStartThread(tid, 0, 0);
#endif
#if defined(__wii__) || defined(_PSP)
@try {
return of_application_main(&argc, &argv,
[TestsAppDelegate class]);
} @catch (id e) {
TestsAppDelegate *delegate =
[[OFApplication sharedApplication] delegate];
OFString *string = [OFString stringWithFormat:
@"\nRuntime error: Unhandled exception:\n%@\n", e];
OFString *backtrace = [OFString stringWithFormat:
@"\nBacktrace:\n %@\n\n",
[[e backtrace] componentsJoinedByString: @"\n "]];
[delegate outputString: string
inColor: RED];
[delegate outputString: backtrace
inColor: RED];
# if defined(__wii__)
[delegate outputString: @"Press home button to exit!\n"
inColor: NO_COLOR];
for (;;) {
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
[OFApplication terminateWithStatus: 1];
VIDEO_WaitVSync();
}
# elif defined(_PSP)
sceKernelSleepThreadCB();
# else
abort();
# endif
}
#else
return of_application_main(&argc, &argv, [TestsAppDelegate class]);
#endif
|
>
>
>
>
|
<
>
>
>
>
>
>
>
>
>
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
if ((tid = sceKernelCreateThread("update_thread", callback_thread,
0x11, 0xFA0, 0, 0)) >= 0)
sceKernelStartThread(tid, 0, 0);
#endif
#ifdef OF_NINTENDO_DS
consoleDemoInit();
#endif
#if defined(__wii__) || defined(_PSP) || defined(OF_NINTENDO_DS)
@try {
return of_application_main(&argc, &argv,
[TestsAppDelegate class]);
} @catch (id e) {
TestsAppDelegate *delegate =
[[OFApplication sharedApplication] delegate];
OFString *string = [OFString stringWithFormat:
@"\nRuntime error: Unhandled exception:\n%@\n", e];
OFString *backtrace = [OFString stringWithFormat:
@"\nBacktrace:\n %@\n\n",
[[e backtrace] componentsJoinedByString: @"\n "]];
[delegate outputString: string
inColor: RED];
[delegate outputString: backtrace
inColor: RED];
# if defined(__wii__)
[delegate outputString: @"Press home button to exit!\n"
inColor: NO_COLOR];
for (;;) {
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
[OFApplication terminateWithStatus: 1];
VIDEO_WaitVSync();
}
# elif defined(_PSP)
sceKernelSleepThreadCB();
# elif defined(OF_NINTENDO_DS)
[delegate outputString: @"Press start button to exit!"
inColor: NO_COLOR];
for (;;) {
swiWaitForVBlank();
scanKeys();
if (keysDown() & KEY_START)
[OFApplication terminateWithStatus: 1];
}
# else
abort();
# endif
}
#else
return of_application_main(&argc, &argv, [TestsAppDelegate class]);
#endif
|
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
pspDebugScreenSetXY(0, y);
pspDebugScreenPrintData([str UTF8String], [str UTF8StringLength]);
#elif defined(STDOUT)
switch (color) {
case NO_COLOR:
[of_stdout writeString: @"\r\033[K"];
# ifdef __wii__
[of_stdout writeString: @"\033[37m"];
# endif
break;
case RED:
[of_stdout writeString: @"\r\033[K\033[31;1m"];
break;
case GREEN:
|
|
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
pspDebugScreenSetXY(0, y);
pspDebugScreenPrintData([str UTF8String], [str UTF8StringLength]);
#elif defined(STDOUT)
switch (color) {
case NO_COLOR:
[of_stdout writeString: @"\r\033[K"];
# if defined(__wii__) || defined(OF_NINTENDO_DS)
[of_stdout writeString: @"\033[37m"];
# endif
break;
case RED:
[of_stdout writeString: @"\r\033[K\033[31;1m"];
break;
case GREEN:
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
for (;;) {
sceCtrlReadBufferPositive(&pad, 1);
if (!(pad.Buttons & PSP_CTRL_CROSS))
return;
}
}
}
# endif
#else
[self outputString: @"failed\n"
inColor: RED];
#endif
}
|
>
>
>
>
>
>
>
>
>
>
|
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
for (;;) {
sceCtrlReadBufferPositive(&pad, 1);
if (!(pad.Buttons & PSP_CTRL_CROSS))
return;
}
}
}
# endif
# ifdef OF_NINTENDO_DS
[self outputString: @"Press A to continue!"
inColor: NO_COLOR];
for (;;) {
swiWaitForVBlank();
scanKeys();
if (keysDown() & KEY_A)
break;
}
# endif
#else
[self outputString: @"failed\n"
inColor: RED];
#endif
}
|
353
354
355
356
357
358
359
360
361
362
363
364
|
VIDEO_WaitVSync();
}
#elif defined(_PSP)
[self outputString: [OFString stringWithFormat: @"%d tests failed!",
_fails]
inColor: NO_COLOR];
sceKernelSleepThreadCB();
#else
[OFApplication terminateWithStatus: _fails];
#endif
}
@end
|
>
>
>
>
>
>
>
>
>
|
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
VIDEO_WaitVSync();
}
#elif defined(_PSP)
[self outputString: [OFString stringWithFormat: @"%d tests failed!",
_fails]
inColor: NO_COLOR];
sceKernelSleepThreadCB();
#elif defined(OF_NINTENDO_DS)
[self outputString: @"Press start button to exit!"
inColor: NO_COLOR];
for (;;) {
swiWaitForVBlank();
scanKeys();
if (keysDown() & KEY_START)
[OFApplication terminateWithStatus: _fails];
}
#else
[OFApplication terminateWithStatus: _fails];
#endif
}
@end
|