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
This commit is contained in:
ol.sc
2011-12-27 01:11:22 +00:00
parent ee9558f616
commit 90621257e7

View File

@@ -60,6 +60,7 @@ struct appheader {
char *version; char *version;
char *author; char *author;
char *info; char *info;
char *icon;
}; };
const char *mainToken[] = {"MENU", "HEADER", "ICON", "DIALOG", "VLIR", ""}; 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", const char *hdrFTypes[] = {"APPLICATION", "AUTO_EXEC", "DESK_ACC", "ASSEMBLY",
"DISK_DEVICE", "PRINTER", "SYSTEM", ""}; "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", ""}; const char *hdrDOSTp[] = {"seq", "SEQ", "prg", "PRG", "usr", "USR", ""};
@@ -120,11 +121,11 @@ void printCHeader(void) {
fprintf(outputCFile, fprintf(outputCFile,
"//\n" "//\n"
"//\tThis file was generated by GEOS Resource Compiler\n" "//\tThis file was generated by the GEOS Resource Compiler\n"
"//\n" "//\n"
"//\tDO NOT EDIT! Any changes will be lost!\n" "//\tDO NOT EDIT! Any changes will be lost!\n"
"//\n" "//\n"
"//\tEdit proper resource file instead\n" "//\tEdit proper resource file instead.\n"
"//\n\n"); "//\n\n");
} }
@@ -133,11 +134,11 @@ void printSHeader(void) {
fprintf(outputSFile, fprintf(outputSFile,
";\n" ";\n"
";\tThis file was generated by GEOS Resource Compiler\n" ";\tThis file was generated by the GEOS Resource Compiler\n"
";\n" ";\n"
";\tDO NOT EDIT! Any changes will be lost!\n" ";\tDO NOT EDIT! Any changes will be lost!\n"
";\n" ";\n"
";\tEdit proper resource file instead\n" ";\tEdit proper resource file instead.\n"
";\n\n"); ";\n\n");
} }
@@ -402,6 +403,7 @@ void DoHeader(void) {
myHead.dostype = 128 + 3; myHead.dostype = 128 + 3;
myHead.structure = 0; myHead.structure = 0;
myHead.mode = 0; myHead.mode = 0;
myHead.icon = NULL;
t = time(NULL); t = time(NULL);
my_tm = localtime(&t); my_tm = localtime(&t);
@@ -478,6 +480,9 @@ void DoHeader(void) {
break; break;
} }
break; break;
case 6: /* icon */
myHead.icon = nextPhrase();
break;
} }
} while (strcmp(token, "}") != 0); } while (strcmp(token, "}") != 0);
@@ -508,10 +513,16 @@ void DoHeader(void) {
"\t.import __VLIR0_START__, __STARTUP_RUN__\n\n" "\t.import __VLIR0_START__, __STARTUP_RUN__\n\n"
"\t.byte 3, 21, 63 | $80\n"); "\t.byte 3, 21, 63 | $80\n");
for (a = 0; a != 63; a = a + 3) { if (myHead.icon != NULL) {
fprintf(outputSFile, fprintf(outputSFile,
"\t.byte %%%s, %%%s, %%%s\n", "\t.incbin \"%s\", 0, 63\n",
bintos(icon1[a], i1), bintos(icon1[a+1], i2), bintos(icon1[a+2], i3)); 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, fprintf(outputSFile,