1 /*
2  * Schism Tracker - a cross-platform Impulse Tracker clone
3  * copyright (c) 2003-2005 Storlek <storlek@rigelseven.com>
4  * copyright (c) 2005-2008 Mrs. Brisby <mrs.brisby@nimh.org>
5  * copyright (c) 2009 Storlek & Mrs. Brisby
6  * copyright (c) 2010-2012 Storlek
7  * URL: http://schismtracker.org/
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 
24 #include "headers.h"
25 #include "fmt.h"
26 
27 /* --------------------------------------------------------------------- */
28 
29 /* TODO: test this code.
30 Modplug seems to have a totally different idea of ams than this.
31 I don't know what this data's supposed to be for :) */
32 
33 /* btw: AMS stands for "Advanced Module System" */
34 
fmt_ams_read_info(dmoz_file_t * file,const uint8_t * data,size_t length)35 int fmt_ams_read_info(dmoz_file_t *file, const uint8_t *data, size_t length)
36 {
37 	uint8_t n;
38 
39 	if (!(length > 38 && memcmp(data, "AMShdr\x1a", 7) == 0))
40 		return 0;
41 
42 	n = data[7];
43 	if (n > 30)
44 		n = 30;
45 	file->description = "Velvet Studio";
46 	/*file->extension = str_dup("ams");*/
47 	file->title = strn_dup((const char *)data + 8, n);
48 	file->type = TYPE_MODULE_XM;
49 	return 1;
50 }
51