From 90621257e7bc53e511fd786990c576492fa7d697 Mon Sep 17 00:00:00 2001
From: "ol.sc"
Date: Tue, 27 Dec 2011 01:11:22 +0000
Subject: [PATCH] Allow for custom icon for a GEOS app by allowing user to
specify an external 63-byte sprite file - which is simply translated to an
'.incbin' command.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5318 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
src/grc65/grc65.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/grc65/grc65.c b/src/grc65/grc65.c
index 75d33b2cd..bd237eb70 100644
--- a/src/grc65/grc65.c
+++ b/src/grc65/grc65.c
@@ -60,6 +60,7 @@ struct appheader {
char *version;
char *author;
char *info;
+ char *icon;
};
const char *mainToken[] = {"MENU", "HEADER", "ICON", "DIALOG", "VLIR", ""};
@@ -67,7 +68,7 @@ const char *mainToken[] = {"MENU", "HEADER", "ICON", "DIALOG", "VLIR", ""};
const char *hdrFTypes[] = {"APPLICATION", "AUTO_EXEC", "DESK_ACC", "ASSEMBLY",
"DISK_DEVICE", "PRINTER", "SYSTEM", ""};
-const char *hdrFields[] = {"author", "info", "date", "dostype", "mode", "structure", ""};
+const char *hdrFields[] = {"author", "info", "date", "dostype", "mode", "structure", "icon", ""};
const char *hdrDOSTp[] = {"seq", "SEQ", "prg", "PRG", "usr", "USR", ""};
@@ -120,11 +121,11 @@ void printCHeader(void) {
fprintf(outputCFile,
"//\n"
- "//\tThis file was generated by GEOS Resource Compiler\n"
+ "//\tThis file was generated by the GEOS Resource Compiler\n"
"//\n"
"//\tDO NOT EDIT! Any changes will be lost!\n"
"//\n"
- "//\tEdit proper resource file instead\n"
+ "//\tEdit proper resource file instead.\n"
"//\n\n");
}
@@ -133,11 +134,11 @@ void printSHeader(void) {
fprintf(outputSFile,
";\n"
- ";\tThis file was generated by GEOS Resource Compiler\n"
+ ";\tThis file was generated by the GEOS Resource Compiler\n"
";\n"
";\tDO NOT EDIT! Any changes will be lost!\n"
";\n"
- ";\tEdit proper resource file instead\n"
+ ";\tEdit proper resource file instead.\n"
";\n\n");
}
@@ -402,6 +403,7 @@ void DoHeader(void) {
myHead.dostype = 128 + 3;
myHead.structure = 0;
myHead.mode = 0;
+ myHead.icon = NULL;
t = time(NULL);
my_tm = localtime(&t);
@@ -478,6 +480,9 @@ void DoHeader(void) {
break;
}
break;
+ case 6: /* icon */
+ myHead.icon = nextPhrase();
+ break;
}
} while (strcmp(token, "}") != 0);
@@ -508,10 +513,16 @@ void DoHeader(void) {
"\t.import __VLIR0_START__, __STARTUP_RUN__\n\n"
"\t.byte 3, 21, 63 | $80\n");
- for (a = 0; a != 63; a = a + 3) {
+ if (myHead.icon != NULL) {
fprintf(outputSFile,
- "\t.byte %%%s, %%%s, %%%s\n",
- bintos(icon1[a], i1), bintos(icon1[a+1], i2), bintos(icon1[a+2], i3));
+ "\t.incbin \"%s\", 0, 63\n",
+ myHead.icon);
+ } else {
+ for (a = 0; a != 63; a = a + 3) {
+ fprintf(outputSFile,
+ "\t.byte %%%s, %%%s, %%%s\n",
+ bintos(icon1[a], i1), bintos(icon1[a+1], i2), bintos(icon1[a+2], i3));
+ }
}
fprintf(outputSFile,
--
2.39.5