ObjFW  Check-in [6a6c86237d]

Overview
Comment:ObjFWHID: Restore Nintendo DS support
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6a6c86237de4495494ada588a5c2d885d8f6a8b0727fa8905bcb888069d2369f
User & Date: js on 2024-06-08 21:25:32
Other Links: manifest | tags
Context
2024-06-08
22:16
OHEvdevGamepad: Filter buttons/axes check-in: 48e6a99f7b user: js tags: trunk
21:25
ObjFWHID: Restore Nintendo DS support check-in: 6a6c86237d user: js tags: trunk
20:21
ObjFWHID: Restore Nintendo 3DS support check-in: 663320ba4d user: js tags: trunk
Changes

Modified configure.ac from [bf1fe49627] to [074a738523].

228
229
230
231
232
233
234

235
236
237
238
239
240
241
	LIBS="$LIBS -L$DEVKITPRO/libnds/lib -lfilesystem -lfat -lnds9"
	enable_shared="no"
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_DS, 1, [Whether we are compiling for Nintendo DS])

	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])

AC_ARG_WITH(3ds,
	AS_HELP_STRING([--with-3ds], [build for Nintendo 3DS]))
AS_IF([test x"$with_3ds" = x"yes"], [
	AS_IF([test x"$DEVKITPRO" = x""], [







>







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
	LIBS="$LIBS -L$DEVKITPRO/libnds/lib -lfilesystem -lfat -lnds9"
	enable_shared="no"
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_DS, 1, [Whether we are compiling for Nintendo DS])
	AC_SUBST(USE_SRCS_NINTENDO_DS, '${SRCS_NINTENDO_DS}')
	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])

AC_ARG_WITH(3ds,
	AS_HELP_STRING([--with-3ds], [build for Nintendo 3DS]))
AS_IF([test x"$with_3ds" = x"yes"], [
	AS_IF([test x"$DEVKITPRO" = x""], [

Modified extra.mk.in from [5b1cf80650] to [5c1c95c165].

97
98
99
100
101
102
103

104
105
106
107
108
109
110
UNICODE_M = @UNICODE_M@
USE_INCLUDES_ATOMIC = @USE_INCLUDES_ATOMIC@
USE_SRCS_APPLETALK = @USE_SRCS_APPLETALK@
USE_SRCS_EVDEV = @USE_SRCS_EVDEV@
USE_SRCS_FILES = @USE_SRCS_FILES@
USE_SRCS_IPX = @USE_SRCS_IPX@
USE_SRCS_NINTENDO_3DS = @USE_SRCS_NINTENDO_3DS@

USE_SRCS_PLUGINS = @USE_SRCS_PLUGINS@
USE_SRCS_SCTP = @USE_SRCS_SCTP@
USE_SRCS_SOCKETS = @USE_SRCS_SOCKETS@
USE_SRCS_SUBPROCESSES = @USE_SRCS_SUBPROCESSES@
USE_SRCS_TAGGED_POINTERS = @USE_SRCS_TAGGED_POINTERS@
USE_SRCS_THREADS = @USE_SRCS_THREADS@
USE_SRCS_UNIX_SOCKETS = @USE_SRCS_UNIX_SOCKETS@







>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
UNICODE_M = @UNICODE_M@
USE_INCLUDES_ATOMIC = @USE_INCLUDES_ATOMIC@
USE_SRCS_APPLETALK = @USE_SRCS_APPLETALK@
USE_SRCS_EVDEV = @USE_SRCS_EVDEV@
USE_SRCS_FILES = @USE_SRCS_FILES@
USE_SRCS_IPX = @USE_SRCS_IPX@
USE_SRCS_NINTENDO_3DS = @USE_SRCS_NINTENDO_3DS@
USE_SRCS_NINTENDO_DS = @USE_SRCS_NINTENDO_DS@
USE_SRCS_PLUGINS = @USE_SRCS_PLUGINS@
USE_SRCS_SCTP = @USE_SRCS_SCTP@
USE_SRCS_SOCKETS = @USE_SRCS_SOCKETS@
USE_SRCS_SUBPROCESSES = @USE_SRCS_SUBPROCESSES@
USE_SRCS_TAGGED_POINTERS = @USE_SRCS_TAGGED_POINTERS@
USE_SRCS_THREADS = @USE_SRCS_THREADS@
USE_SRCS_UNIX_SOCKETS = @USE_SRCS_UNIX_SOCKETS@

Modified src/hid/Makefile from [6270b55dc0] to [8549234aa0].

14
15
16
17
18
19
20

21
22
23
24
25

26
27
28
29
30
31
32
       OHGameControllerButton.m		\
       OHGameControllerDirectionalPad.m	\
       OHGameControllerElement.m	\
       OHGameControllerProfile.m	\
       OHGamepad.m			\
       ${USE_SRCS_EVDEV}		\
       ${USE_SRCS_NINTENDO_3DS}		\

       ${USE_SRCS_XINPUT}
SRCS_EVDEV = OHEvdevGameController.m	\
	     OHEvdevGamepad.m
SRCS_NINTENDO_3DS = OHNintendo3DSGameController.m	\
		    OHNintendo3DSGamepad.m

SRCS_XINPUT = OHXInputGameController.m	\
	      OHXInputGamepad.m

INCLUDES := ${SRCS:.m=.h}	\
	    ObjFWHID.h

SRCS += OHGameControllerEmulatedAxis.m		\







>





>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
       OHGameControllerButton.m		\
       OHGameControllerDirectionalPad.m	\
       OHGameControllerElement.m	\
       OHGameControllerProfile.m	\
       OHGamepad.m			\
       ${USE_SRCS_EVDEV}		\
       ${USE_SRCS_NINTENDO_3DS}		\
       ${USE_SRCS_NINTENDO_DS}		\
       ${USE_SRCS_XINPUT}
SRCS_EVDEV = OHEvdevGameController.m	\
	     OHEvdevGamepad.m
SRCS_NINTENDO_3DS = OHNintendo3DSGameController.m	\
		    OHNintendo3DSGamepad.m
SRCS_NINTENDO_DS = OHNintendoDSGameController.m
SRCS_XINPUT = OHXInputGameController.m	\
	      OHXInputGamepad.m

INCLUDES := ${SRCS:.m=.h}	\
	    ObjFWHID.h

SRCS += OHGameControllerEmulatedAxis.m		\

Modified src/hid/OHGameController.m from [1e979f93f1] to [5de26d2df5].

27
28
29
30
31
32
33



34
35
36
37
38
39
40
41
42
43
44
45
46


47
48
49
50
51
52
53

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# import "OHEvdevGameController.h"
#endif
#ifdef OF_WINDOWS
# import "OHXInputGameController.h"
#endif



#ifdef OF_NINTENDO_3DS
# import "OHNintendo3DSGameController.h"
#endif

@implementation OHGameController
@dynamic name, rawProfile;

+ (OFArray OF_GENERIC(OHGameController *) *)controllers
{
#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
	return [OHEvdevGameController controllers];
#elif defined(OF_WINDOWS)
	return [OHXInputGameController controllers];


#elif defined(OF_NINTENDO_3DS)
	return [OHNintendo3DSGameController controllers];
#else
	return [OFArray array];
#endif
}








>
>
>













>
>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# import "OHEvdevGameController.h"
#endif
#ifdef OF_WINDOWS
# import "OHXInputGameController.h"
#endif
#ifdef OF_NINTENDO_DS
# import "OHNintendoDSGameController.h"
#endif
#ifdef OF_NINTENDO_3DS
# import "OHNintendo3DSGameController.h"
#endif

@implementation OHGameController
@dynamic name, rawProfile;

+ (OFArray OF_GENERIC(OHGameController *) *)controllers
{
#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
	return [OHEvdevGameController controllers];
#elif defined(OF_WINDOWS)
	return [OHXInputGameController controllers];
#elif defined(OF_NINTENDO_DS)
	return [OHNintendoDSGameController controllers];
#elif defined(OF_NINTENDO_3DS)
	return [OHNintendo3DSGameController controllers];
#else
	return [OFArray array];
#endif
}

Modified src/hid/OHNintendo3DSGameController.m from [9e8e34de00] to [4800c3c390].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

#define id id_3ds
#include <3ds.h>
#undef id

static OFArray OF_GENERIC(OHGameController *) *controllers;

/* Work around for the compiler getting confused. */
static float
keyValue(u32 keys, u32 key)
{
	if (keys & key)
		return 1;
	else
		return 0;
}

@implementation OHNintendo3DSGameController
@synthesize gamepad = _gamepad;

+ (void)initialize
{
	void *pool;








<
<
<
<
<
<
<
<
<
<







33
34
35
36
37
38
39










40
41
42
43
44
45
46

#define id id_3ds
#include <3ds.h>
#undef id

static OFArray OF_GENERIC(OHGameController *) *controllers;











@implementation OHNintendo3DSGameController
@synthesize gamepad = _gamepad;

+ (void)initialize
{
	void *pool;

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

	hidScanInput();

	keys = hidKeysHeld();
	hidCircleRead(&leftPos);
	hidCstickRead(&rightPos);

	_gamepad.northButton.value = keyValue(keys, KEY_X);
	_gamepad.southButton.value = keyValue(keys, KEY_B);
	_gamepad.westButton.value = keyValue(keys, KEY_Y);
	_gamepad.eastButton.value = keyValue(keys, KEY_A);
	_gamepad.leftShoulderButton.value = keyValue(keys, KEY_L);
	_gamepad.rightShoulderButton.value = keyValue(keys, KEY_R);
	_gamepad.leftTriggerButton.value = keyValue(keys, KEY_ZL);
	_gamepad.rightTriggerButton.value = keyValue(keys, KEY_ZR);
	_gamepad.menuButton.value = keyValue(keys, KEY_START);
	_gamepad.optionsButton.value = keyValue(keys, KEY_SELECT);

	if (leftPos.dx > 150)
		leftPos.dx = 150;
	if (leftPos.dx < -150)
		leftPos.dx = -150;
	if (leftPos.dy > 150)
		leftPos.dy = 150;







|
|
|
|
|
|
|
|
|
|







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

	hidScanInput();

	keys = hidKeysHeld();
	hidCircleRead(&leftPos);
	hidCstickRead(&rightPos);

	[_gamepad.northButton setValue: !!(keys & KEY_X)];
	[_gamepad.southButton setValue: !!(keys & KEY_B)];
	[_gamepad.westButton setValue: !!(keys & KEY_Y)];
	[_gamepad.eastButton setValue: !!(keys & KEY_A)];
	[_gamepad.leftShoulderButton setValue: !!(keys & KEY_L)];
	[_gamepad.rightShoulderButton setValue: !!(keys & KEY_R)];
	[_gamepad.leftTriggerButton setValue: !!(keys & KEY_ZL)];
	[_gamepad.rightTriggerButton setValue: !!(keys & KEY_ZR)];
	[_gamepad.menuButton setValue: !!(keys & KEY_START)];
	[_gamepad.optionsButton setValue: !!(keys & KEY_SELECT)];

	if (leftPos.dx > 150)
		leftPos.dx = 150;
	if (leftPos.dx < -150)
		leftPos.dx = -150;
	if (leftPos.dy > 150)
		leftPos.dy = 150;
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
		rightPos.dy = -150;

	_gamepad.leftThumbstick.xAxis.value = (float)leftPos.dx / 150;
	_gamepad.leftThumbstick.yAxis.value = -(float)leftPos.dy / 150;
	_gamepad.rightThumbstick.xAxis.value = (float)rightPos.dx / 150;
	_gamepad.rightThumbstick.yAxis.value = -(float)rightPos.dy / 150;

	_gamepad.dPad.up.value = keyValue(keys, KEY_DUP);
	_gamepad.dPad.down.value = keyValue(keys, KEY_DDOWN);
	_gamepad.dPad.left.value = keyValue(keys, KEY_DLEFT);
	_gamepad.dPad.right.value = keyValue(keys, KEY_DRIGHT);
}

- (OFString *)name
{
	return @"Nintendo 3DS";
}

- (OHGameControllerProfile *)rawProfile
{
	return _gamepad;
}
@end







|
|
|
|












122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
		rightPos.dy = -150;

	_gamepad.leftThumbstick.xAxis.value = (float)leftPos.dx / 150;
	_gamepad.leftThumbstick.yAxis.value = -(float)leftPos.dy / 150;
	_gamepad.rightThumbstick.xAxis.value = (float)rightPos.dx / 150;
	_gamepad.rightThumbstick.yAxis.value = -(float)rightPos.dy / 150;

	[_gamepad.dPad.up setValue: !!(keys & KEY_DUP)];
	[_gamepad.dPad.down setValue: !!(keys & KEY_DDOWN)];
	[_gamepad.dPad.left setValue: !!(keys & KEY_DLEFT)];
	[_gamepad.dPad.right setValue: !!(keys & KEY_DRIGHT)];
}

- (OFString *)name
{
	return @"Nintendo 3DS";
}

- (OHGameControllerProfile *)rawProfile
{
	return _gamepad;
}
@end

Modified src/hid/OHNintendo3DSGamepad.m from [f89e0b995b] to [1b3ca013dd].

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
		    [OFMutableDictionary dictionaryWithCapacity: numButtons];
		OFMutableDictionary *directionalPads;
		OHGameControllerAxis *xAxis, *yAxis;
		OHGameControllerDirectionalPad *directionalPad;
		OHGameControllerButton *up, *down, *left, *right;

		for (size_t i = 0; i < numButtons; i++) {
			OHGameControllerButton *button;

			button = [[OHGameControllerButton alloc]
			    initWithName: buttonNames[i]];
			@try {
				[buttons setObject: button
					    forKey: buttonNames[i]];
			} @finally {
				[button release];
			}
		}
		[buttons makeImmutable];
		_buttons = [buttons retain];

		_axes = [[OFDictionary alloc] init];

		directionalPads =







|
<
|
|
<
|
<
<
<
<







41
42
43
44
45
46
47
48

49
50

51




52
53
54
55
56
57
58
		    [OFMutableDictionary dictionaryWithCapacity: numButtons];
		OFMutableDictionary *directionalPads;
		OHGameControllerAxis *xAxis, *yAxis;
		OHGameControllerDirectionalPad *directionalPad;
		OHGameControllerButton *up, *down, *left, *right;

		for (size_t i = 0; i < numButtons; i++) {
			OHGameControllerButton *button =

			    [[[OHGameControllerButton alloc]
			    initWithName: buttonNames[i]] autorelease];

			[buttons setObject: button forKey: buttonNames[i]];




		}
		[buttons makeImmutable];
		_buttons = [buttons retain];

		_axes = [[OFDictionary alloc] init];

		directionalPads =

Added src/hid/OHNintendoDSGameController.h version [ba9c705bcc].

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3.0 only,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * version 3.0 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3.0 along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
 */

#import "OHGameController.h"

OF_ASSUME_NONNULL_BEGIN

@class OHNintendoDSGameControllerProfile;

@interface OHNintendoDSGameController: OHGameController
{
	OHNintendoDSGameControllerProfile *_rawProfile;
}
@end

OF_ASSUME_NONNULL_END

Added src/hid/OHNintendoDSGameController.m version [18aa290f08].





















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
160
161
162
163
164
165
166
167
168
169
170
/*
 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3.0 only,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * version 3.0 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3.0 along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
 */

#include "config.h"

#import "OHNintendoDSGameController.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFNumber.h"
#import "OHGameControllerButton.h"
#import "OHGameControllerDirectionalPad.h"
#import "OHGameControllerProfile.h"

#import "OFInitializationFailedException.h"
#import "OFReadFailedException.h"

#define asm __asm__
#include <nds.h>
#undef asm

@interface OHNintendoDSGameControllerProfile: OHGameControllerProfile
@end

static OFArray OF_GENERIC(OHGameController *) *controllers;

static OFString *const buttonNames[] = {
	@"A", @"B", @"X", @"Y", @"L", @"R", @"Start", @"Select"
};
static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames);

@implementation OHNintendoDSGameController
@synthesize rawProfile = _rawProfile;

+ (void)initialize
{
	void *pool;

	if (self != [OHNintendoDSGameController class])
		return;

	pool = objc_autoreleasePoolPush();
	controllers = [[OFArray alloc] initWithObject:
	    [[[OHNintendoDSGameController alloc] init] autorelease]];
	objc_autoreleasePoolPop(pool);
}

+ (OFArray OF_GENERIC(OHGameController *) *)controllers
{
	return controllers;
}

- (instancetype)init
{
	self = [super init];

	@try {
		_rawProfile = [[OHNintendoDSGameControllerProfile alloc] init];

		[self retrieveState];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_rawProfile release];

	[super dealloc];
}

- (void)retrieveState
{
	OFDictionary *buttons = _rawProfile.buttons;
	OHGameControllerDirectionalPad *dPad =
	    [_rawProfile.directionalPads objectForKey: @"D-Pad"];
	u32 keys;

	scanKeys();
	keys = keysCurrent();

	[[buttons objectForKey: @"A"] setValue: !!(keys & KEY_A)];
	[[buttons objectForKey: @"B"] setValue: !!(keys & KEY_B)];
	[[buttons objectForKey: @"X"] setValue: !!(keys & KEY_X)];
	[[buttons objectForKey: @"Y"] setValue: !!(keys & KEY_Y)];
	[[buttons objectForKey: @"L"] setValue: !!(keys & KEY_L)];
	[[buttons objectForKey: @"R"] setValue: !!(keys & KEY_R)];
	[[buttons objectForKey: @"Start"] setValue: !!(keys & KEY_START)];
	[[buttons objectForKey: @"Select"] setValue: !!(keys & KEY_SELECT)];

	[dPad.up setValue: !!(keys & KEY_UP)];
	[dPad.down setValue: !!(keys & KEY_DOWN)];
	[dPad.left setValue: !!(keys & KEY_LEFT)];
	[dPad.right setValue: !!(keys & KEY_RIGHT)];
}

- (OFString *)name
{
	return @"Nintendo DS";
}
@end

@implementation OHNintendoDSGameControllerProfile
- (instancetype)init
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		OFMutableDictionary *buttons =
		    [OFMutableDictionary dictionaryWithCapacity: numButtons];
		OHGameControllerButton *up, *down, *left, *right;
		OHGameControllerDirectionalPad *dPad;

		for (size_t i = 0; i < numButtons; i++) {
			OHGameControllerButton *button =
			    [[[OHGameControllerButton alloc]
			    initWithName: buttonNames[i]] autorelease];
			[buttons setObject: button forKey: buttonNames[i]];
		}
		[buttons makeImmutable];
		_buttons = [buttons retain];

		up = [[[OHGameControllerButton alloc]
		    initWithName: @"D-Pad Up"] autorelease];
		down = [[[OHGameControllerButton alloc]
		    initWithName: @"D-Pad Down"] autorelease];
		left = [[[OHGameControllerButton alloc]
		    initWithName: @"D-Pad Left"] autorelease];
		right = [[[OHGameControllerButton alloc]
		    initWithName: @"D-Pad Right"] autorelease];
		dPad = [[[OHGameControllerDirectionalPad alloc]
		    initWithName: @"D-Pad"
			      up: up
			    down: down
			    left: left
			   right: right] autorelease];

		_directionalPads = [[OFDictionary alloc]
		    initWithObject: dPad
			    forKey: @"D-Pad"];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
@end