ObjFW  Diff

Differences From Artifact [c99ef75558]:

To Artifact [c350ebfc99]:


24
25
26
27
28
29
30


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50







+
+











-







#import "OFDictionary.h"
#import "OFMethodSignature.h"
#import "OFSet.h"
#import "OFStdIOStream.h"
#import "OFValue.h"

#import "OTTestCase.h"

#import "OFGameController.h"

#import "OTAssertionFailedException.h"
#import "OTTestSkippedException.h"

#ifdef OF_IOS
# include <CoreFoundation/CoreFoundation.h>
#endif

#ifdef OF_WII
# define asm __asm__
# include <gccore.h>
# include <wiiuse/wpad.h>
# undef asm
#endif

#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
119
120
121
122
123
124
125

126
127
128
129
130
131
132







-








	CFRelease(resourcesURL);
#elif defined(OF_WII)
	GXRModeObj *mode;
	void *nextFB;

	VIDEO_Init();
	WPAD_Init();

	mode = VIDEO_GetPreferredMode(NULL);
	nextFB = MEM_K0_TO_K1(SYS_AllocateFramebuffer(mode));
	VIDEO_Configure(mode);
	VIDEO_SetNextFramebuffer(nextFB);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
307
308
309
310
311
312
313
314

315
316
317
318



319


320

321

322
323

324
325
326

327
328
329
330
331
332
333
334
335
336
337

338
339
340
341
342
343
344
345
346
347


348
349
350
351
352
353
354
307
308
309
310
311
312
313

314
315
316
317
318
319
320
321

322
323
324
325

326
327
328
329
330


331




332






333









334
335
336
337
338
339
340
341
342
343







-
+




+
+
+
-
+
+

+
-
+


+

-
-
+
-
-
-
-

-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-

+
+







		if (description != nil)
			[OFStdOut writeLine: description];

		break;
	}

	if (status == StatusFailed) {
#if defined(OF_WII)
#if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS)
		[OFStdOut setForegroundColor: [OFColor silver]];
		[OFStdOut writeLine: @"Press A to continue"];

		for (;;) {
			void *pool = objc_autoreleasePoolPush();
			OFGameController *controller =
			    [[OFGameController controllers] objectAtIndex: 0];
			WPAD_ScanPads();

			[controller retrieveState];

			if ([controller.pressedButtons containsObject:
			if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A)
			    OFGameControllerEastButton])
				break;

# if defined(OF_WII)
			VIDEO_WaitVSync();
		}
#elif defined(OF_NINTENDO_DS)
# elif defined(OF_NINTENDO_DS)
		[OFStdOut setForegroundColor: [OFColor silver]];
		[OFStdOut writeLine: @"Press A to continue"];

		for (;;) {
			swiWaitForVBlank();
			scanKeys();

			if (keysDown() & KEY_A)
				break;
		}
#elif defined(OF_NINTENDO_3DS)
# elif defined(OF_NINTENDO_3DS)
		[OFStdOut setForegroundColor: [OFColor silver]];
		[OFStdOut writeLine: @"Press A to continue"];

		for (;;) {
			hidScanInput();

			if (hidKeysDown() & KEY_A)
				break;

			gspWaitForVBlank();
# endif
			objc_autoreleasePoolPop(pool);
		}
#elif defined(OF_NINTENDO_SWITCH)
		[OFStdOut setForegroundColor: [OFColor silver]];
		[OFStdOut writeLine: @"Press A to continue"];

		while (appletMainLoop()) {
			PadState pad;
595
596
597
598
599
600
601
602

603

604




605
606



607


608


609





610
611

612
613
614

615
616
617
618
619
620
621
622
623
624
625

626
627
628
629
630
631
632
633
634
635


636
637
638
639
640
641
642
643
644
645
646
584
585
586
587
588
589
590

591
592
593

594
595
596
597
598
599
600
601
602

603
604
605
606
607

608
609
610
611
612
613
614
615
616


617




618






619









620
621
622
623
624
625
626
627
628
629
630
631
632
633







-
+

+
-
+
+
+
+


+
+
+
-
+
+

+
+
-
+
+
+
+
+


+

-
-
+
-
-
-
-

-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-

+
+











#endif
	[OFStdOut writeFormat: @"%zu", numSkipped];
	[OFStdOut setForegroundColor: [OFColor purple]];
	[OFStdOut writeFormat: @" test%s skipped\n",
			       (numSkipped != 1 ? "s" : "")];
	[OFStdOut reset];

#if defined(OF_WII)
#if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS)
	[OFStdOut setForegroundColor: [OFColor silver]];
# ifdef OF_WII
	[OFStdOut writeLine: @"Press home button to exit"];
	[OFStdOut writeLine: @"Press Home button to exit"];
# else
	[OFStdOut writeLine: @"Press Start button to exit"];
# endif

	for (;;) {
		void *pool = objc_autoreleasePoolPush();
		OFGameController *controller =
		    [[OFGameController controllers] objectAtIndex: 0];
		WPAD_ScanPads();

		[controller retrieveState];

# ifdef OF_WII
		if ([controller.pressedButtons containsObject:
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
		    OFGameControllerHomeButton])
# else
		if ([controller.pressedButtons containsObject:
		    OFGameControllerStartButton])
# endif
			break;

# if defined(OF_WII)
		VIDEO_WaitVSync();
	}
#elif defined(OF_NINTENDO_DS)
# elif defined(OF_NINTENDO_DS)
	[OFStdOut setForegroundColor: [OFColor silver]];
	[OFStdOut writeLine: @"Press start button to exit"];

	for (;;) {
		swiWaitForVBlank();
		scanKeys();

		if (keysDown() & KEY_START)
			break;
	}
#elif defined(OF_NINTENDO_3DS)
# elif defined(OF_NINTENDO_3DS)
	[OFStdOut setForegroundColor: [OFColor silver]];
	[OFStdOut writeLine: @"Press start button to exit"];

	for (;;) {
		hidScanInput();

		if (hidKeysDown() & KEY_START)
			break;

		gspWaitForVBlank();
# endif
		objc_autoreleasePoolPop(pool);
	}
#elif defined(OF_NINTENDO_SWITCH)
	while (appletMainLoop())
		updateConsole(true);

	consoleExit(NULL);
#endif

	[OFApplication terminateWithStatus: (int)numFailed];
}
@end