Table of Contents

About

This is a small program that is run from the command line in an AmigaDOS shell and sets the type of an icon (.info) file. It can be used to quickly change icon types without having to load them in a program, saving the icon and then overwriting the original icon.

Download

Syntax

seticontype T <file>.info

where T can be:

  • 1 disk or volume.
  • 2 drawer (folder).
  • 3 tool (executable).
  • 4 project (data file).
  • 5 trashcan.
  • 6 device.
  • 7 Kickstart ROM image.
  • 8 an appicon (placed on the desktop by application).

and <file>.info is an icon.

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;
}

amiga/change_icon_type.txt · Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.