Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -42,10 +42,11 @@ tests/EBOOT.PBP tests/Info.plist tests/PARAM.SFO tests/big_dictionary_msgpack_gz.m tests/gamecontroller/gamecontroller_tests +tests/gamecontroller/gamecontroller_tests.3dsx 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,20 +25,41 @@ #import "OFGameController.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFThread.h" + +#ifdef OF_NINTENDO_3DS +/* Newer versions of libctru started using id as a parameter name. */ +# define id id_3ds +# include <3ds.h> +# undef id +# define BUTTONS_PER_LINE 3 +#endif + +#ifndef BUTTONS_PER_LINE +# define BUTTONS_PER_LINE 5 +#endif @interface GameControllerTests: OFObject @end OF_APPLICATION_DELEGATE(GameControllerTests) @implementation GameControllerTests - (void)applicationDidFinishLaunching: (OFNotification *)notification { - OFArray *controllers = [OFGameController controllers]; + OFArray *controllers; + +#if defined(OF_NINTENDO_3DS) + gfxInitDefault(); + atexit(gfxExit); + + consoleInit(GFX_TOP, NULL); +#endif + + controllers = [OFGameController controllers]; [OFStdOut clear]; for (;;) { [OFStdOut setCursorPosition: OFMakePoint(0, 0)]; @@ -47,16 +68,21 @@ OFArray OF_GENERIC(OFGameControllerButton) *buttons = controller.buttons.allObjects.sortedArray; size_t i = 0; [OFStdOut setForegroundColor: [OFColor green]]; - [OFStdOut writeLine: controller.description]; + [OFStdOut writeString: controller.description]; [controller retrieveState]; for (OFGameControllerButton button in buttons) { - float pressure = + float pressure; + + if (i == 0) + [OFStdOut writeString: @"\n"]; + + pressure = [controller pressureForButton: button]; if (pressure == 1) [OFStdOut setForegroundColor: [OFColor red]]; @@ -70,12 +96,11 @@ [OFStdOut setForegroundColor: [OFColor gray]]; [OFStdOut writeFormat: @"[%@]", button]; - if (++i == 5) { - [OFStdOut writeString: @"\n"]; + if (++i == BUTTONS_PER_LINE) { i = 0; } else [OFStdOut writeString: @" "]; } [OFStdOut setForegroundColor: [OFColor gray]]; Index: tests/gamecontroller/Makefile ================================================================== --- tests/gamecontroller/Makefile +++ tests/gamecontroller/Makefile @@ -90,10 +90,13 @@ rm -f libobjfwhid.${OBJFWHID_LIB_MAJOR}.dylib; \ exit $$EXIT ${PROG_NOINST}: ${LIBOBJFW_DEP_LVL2} ${LIBOBJFWRT_DEP_LVL2} \ ${LIBOBJFWHID_DEP_LVL2} + +${PROG_NOINST}.3dsx: ${PROG_NOINST} + 3dsxtool $< $@ CPPFLAGS += -I../../src \ -I../../src/exceptions \ -I../../src/hid \ -I../../src/runtime \