English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 24 October 2014, 03:14   #1
eva
Registered User

eva's Avatar
 
Join Date: Oct 2014
Location: Constanta / Romania
Posts: 202
Changing Icon Type

Following the discussion in: http://eab.abime.net/showthread.php?p=982493#post982493, I have not found a sensible way of changing the icon types for the icon archive at: http://aminet.net/package/pix/mwb/IconArchive short of having to use an icon editor, load each icon, change the type, save the icon, go to the shell and overwrite the .info type.

I looked up the specification of the different icon types on the Amiga and coded a small program that just changes the icon type of any .info file.

Code:
/**
***************************************************************************
**    Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3    **
***************************************************************************
** Provided an input type and an .info file, this program change the type 
** of the icon. This is useful for icon packs where .info files would have
** to be converted manually using an icon editor.
**
** Reference: http://krashan.ppa.pl/articles/amigaicons/
**/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
	FILE *fp; 
	long size;
	char *info;
	int type;

	if(argc < 3) {
		printf("SYNTAX: %s <type> <info file>\n", argv[0]);
		printf("TYPE: 1 - disk or volume\n");
		printf("      2 - drawer (folder)\n");
		printf("      3 - tool (executable)\n");
		printf("      4 - project (data file)\n");
		printf("      5 - trashcan\n");
		printf("      6 - device\n");
		printf("      7 - Kickstart ROM image\n");
		printf("      8 - an appicon (from an app)\n");
		return 1;
	}

	type = atoi(argv[1]);

	switch(type) {
		case 1: case 2: case 3: case 4:
		case 5: case 6: case 7: case 8:
		  break;
		default:
		  printf("Unknown icon type.\n");
		  return 1;
	}

	fp = fopen(argv[2], "rb");
	if(fp == NULL) {
		printf("The second argument must be an icon file.\n");
		return 1;
	}

	// read size
	fseek(fp, 0, SEEK_END);
	size = ftell(fp);
	rewind(fp);

	// allocate buffer and read
	info = (char *) calloc(size, sizeof(char));
	if(fread(info, 1, size, fp) != size) {
		printf("The file could not be read.\n");
		return 1;
	}
	fclose(fp);

	if((unsigned int)info[0] != 227 && (unsigned int)info[1] != 16) {
		printf("The file is not an icon file (info).\n");
		return 1;
	}

	// change the icon type
	info[48] = (char)type;

	// open file for write
	fp=fopen(argv[2], "wb");
	if(fp == NULL) {
		printf("The file could not be found anymore.\n");
		return 1;
	}

	// write the data
	fwrite(info, size, 1, fp);

	fclose(fp);
	free(info);
	return 0;
}
I have attached the LHA containing the binary - just copy "seticontype" from the archive to c:

The usage is very simple:
  • open a shell
  • change directory to where you have the .info file
  • run: seticontype T icon.info where T is a type (printed out as reference when you run seticontype without arguments).
  • the icon.info will be changed to type T
  • you can then overwrite your old icon with the .info you just modified

Cheeries!
Attached Files
File Type: lha seticontype.lha (7.9 KB, 61 views)
eva is offline  
AdSense AdSense  
Old 24 October 2014, 04:28   #2
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 1,736
I guess, you can do the same and much more with ProcessIcon option SIT (Set Icon Type) written by Dirk Stoecker. http://aminet.net/package/util/wb/ProcessIcon
PeterK is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
PNG Icon to Color Icon Converter? Leandro Jardim request.Apps 1 24 May 2010 05:39
Changing Icon into OS 3.9 ???? D4Ni3L3 support.Other 3 30 November 2008 07:45
Changing the CrossDOS default disk icon? SkinE support.Apps 2 01 October 2005 17:42
Changing default Ram Disk: icon under 3.9 oldpx support.Apps 8 26 July 2004 21:51
Mass Changing Of Icon Tool Types CodyJarrett support.Apps 2 05 March 2002 20:56

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:53.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.16802 seconds with 15 queries