Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -43,10 +43,12 @@ tests/Info.plist tests/PARAM.SFO tests/big_dictionary_msgpack_gz.m tests/gamecontroller/gamecontroller_tests tests/gamecontroller/gamecontroller_tests.3dsx +tests/gamecontroller/gamecontroller_tests.arm9 +tests/gamecontroller/gamecontroller_tests.nds tests/iOS.xcodeproj/*.pbxuser tests/iOS.xcodeproj/project.xcworkspace tests/iOS.xcodeproj/xcuserdata tests/objc_sync/objc_sync tests/plugin/Info.plist Index: tests/gamecontroller/GameControllerTests.m ================================================================== --- tests/gamecontroller/GameControllerTests.m +++ tests/gamecontroller/GameControllerTests.m @@ -25,10 +25,17 @@ #import "OFGameController.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFThread.h" + +#ifdef OF_NINTENDO_DS +# define asm __asm__ +# include +# undef asm +# define BUTTONS_PER_LINE 2 +#endif #ifdef OF_NINTENDO_3DS /* Newer versions of libctru started using id as a parameter name. */ # define id id_3ds # include <3ds.h> @@ -37,10 +44,16 @@ #endif #ifndef BUTTONS_PER_LINE # define BUTTONS_PER_LINE 5 #endif + +#if defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) +# define red maroon +# define yellow olive +# define gray silver +#endif @interface GameControllerTests: OFObject @end OF_APPLICATION_DELEGATE(GameControllerTests) @@ -48,11 +61,13 @@ @implementation GameControllerTests - (void)applicationDidFinishLaunching: (OFNotification *)notification { OFArray *controllers; -#if defined(OF_NINTENDO_3DS) +#if defined(OF_NINTENDO_DS) + consoleDemoInit(); +#elif defined(OF_NINTENDO_3DS) gfxInitDefault(); atexit(gfxExit); consoleInit(GFX_TOP, NULL); #endif @@ -60,10 +75,12 @@ controllers = [OFGameController controllers]; [OFStdOut clear]; for (;;) { + void *pool = objc_autoreleasePoolPush(); + [OFStdOut setCursorPosition: OFMakePoint(0, 0)]; for (OFGameController *controller in controllers) { OFArray OF_GENERIC(OFGameControllerButton) *buttons = controller.buttons.allObjects.sortedArray; @@ -120,8 +137,10 @@ } [OFStdOut writeString: @"\n"]; } [OFThread sleepForTimeInterval: 1.f / 60.f]; + + objc_autoreleasePoolPop(pool); } } @end Index: tests/gamecontroller/Makefile ================================================================== --- tests/gamecontroller/Makefile +++ tests/gamecontroller/Makefile @@ -93,10 +93,16 @@ ${PROG_NOINST}: ${LIBOBJFW_DEP_LVL2} ${LIBOBJFWRT_DEP_LVL2} \ ${LIBOBJFWHID_DEP_LVL2} ${PROG_NOINST}.3dsx: ${PROG_NOINST} 3dsxtool $< $@ + +${PROG_NOINST}.arm9: ${PROG_NOINST} + arm-none-eabi-objcopy -O binary $< $@ + +${PROG_NOINST}.nds: ${PROG_NOINST}.arm9 + ndstool -c $@ -9 ${PROG_NOINST} CPPFLAGS += -I../../src \ -I../../src/exceptions \ -I../../src/hid \ -I../../src/runtime \