From ce6561c6a64900ae3862c6a95cf4859a6c6bfe5e1fedf463fa3f84e20ec1f0f0 Mon Sep 17 00:00:00 2001 From: Victor Roman Archidona Date: Wed, 22 Jan 2003 07:50:04 +0000 Subject: [PATCH] =?UTF-8?q?A=C3=B1adimos=20todo=20el=20"util"=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/bin/clean.bat | 4 + util/src/bmp2fnt/b2f.c | 160 +++++ util/src/bmp2fnt/win32/bmp2fnt.sln | 21 + util/src/bmp2fnt/win32/bmp2fnt.vcproj | 115 ++++ util/src/doku/doku.c | 569 ++++++++++++++++++ util/src/doku/template.txt | 11 + util/src/doku/win32/doku.sln | 21 + util/src/doku/win32/doku.vcproj | 112 ++++ util/src/iconchanger/iconchanger.c | 144 +++++ util/src/iconchanger/iconchanger.h | 23 + util/src/iconchanger/win32/iconchanger.sln | 21 + util/src/iconchanger/win32/iconchanger.vcproj | 119 ++++ util/src/win32/util.sln | 33 + 13 files changed, 1353 insertions(+) create mode 100644 util/bin/clean.bat create mode 100644 util/src/bmp2fnt/b2f.c create mode 100644 util/src/bmp2fnt/win32/bmp2fnt.sln create mode 100644 util/src/bmp2fnt/win32/bmp2fnt.vcproj create mode 100644 util/src/doku/doku.c create mode 100644 util/src/doku/template.txt create mode 100644 util/src/doku/win32/doku.sln create mode 100644 util/src/doku/win32/doku.vcproj create mode 100644 util/src/iconchanger/iconchanger.c create mode 100644 util/src/iconchanger/iconchanger.h create mode 100644 util/src/iconchanger/win32/iconchanger.sln create mode 100644 util/src/iconchanger/win32/iconchanger.vcproj create mode 100644 util/src/win32/util.sln diff --git a/util/bin/clean.bat b/util/bin/clean.bat new file mode 100644 index 0000000..12b850c --- /dev/null +++ b/util/bin/clean.bat @@ -0,0 +1,4 @@ +@echo off +del *.exp +del *.lib +del *.pdb \ No newline at end of file diff --git a/util/src/bmp2fnt/b2f.c b/util/src/bmp2fnt/b2f.c new file mode 100644 index 0000000..02db3e0 --- /dev/null +++ b/util/src/bmp2fnt/b2f.c @@ -0,0 +1,160 @@ +/* + * eDiv Compiler + * Copyleft (C) 2000-2002 Sion Entertainment + * http://www.sion-e.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _WIN32 +#error Este archivo aun NO ha sido portado a otras plataformas. +#endif + +#include +#include +#include +#include +#include + +#include + +struct _fuente_control_s { + int offset_imagen ; + int size_imagen ; + int w , h , bytespp ; + SDL_Rect rect[256] ; + SDL_Surface *imagen ; +}; + +int main(int argc, char* argv[]) +{ + FILE *fp, *out; + char tras[3], none[3]; + char *pool, *px; + struct _fuente_control_s fuente_control_s; + SDL_Surface *imagen ; + int i, x, y; + fpos_t pos; + + out = fopen("stdout.txt", "w" ); + + imagen = SDL_LoadBMP("fuente.bmp"); + SDL_LockSurface(imagen); + + // Se calculan los rects + px = imagen->pixels ; + + + // Color de borde ( El primero k se encuentra + none[0] = *(px + 0); + none[1] = *(px + 1); + none[2] = *(px + 2); + + // Colo trasparente ( Fila 1, Columna1, corresponde al caracter 0 ) + tras[0] = *(px + imagen->pitch + 3 + 0); + tras[1] = *(px + imagen->pitch + 3 + 1); + tras[2] = *(px + imagen->pitch + 3 + 2); + + + i = 1; + x = 3; + y = 0; + for ( x = 3 ; x < imagen->w ; x++ ) + { + for ( y = 0 ; y < imagen->h ; y++ ) + { + if (*(px + imagen->pitch*y + x*3 + 0) != none[0] || + *(px + imagen->pitch*y + x*3 + 1) != none[1] || + *(px + imagen->pitch*y + x*3 + 2) != none[2] ) + { + fuente_control_s.rect[i].x = x ; + fuente_control_s.rect[i].y = y ; + for ( ; y < imagen->h ; y++ ) + { + if (*(px + imagen->pitch*y + x*3 + 0) == none[0] && + *(px + imagen->pitch*y + x*3 + 1) == none[1] && + *(px + imagen->pitch*y + x*3 + 2) == none[2] ) + break ; + } + y--; + fuente_control_s.rect[i].h = y - fuente_control_s.rect[i].y + 1; + + for ( ; x < imagen->w ; x++ ) + { + if (*(px + imagen->pitch*y + x*3 + 0) == none[0] && + *(px + imagen->pitch*y + x*3 + 1) == none[1] && + *(px + imagen->pitch*y + x*3 + 2) == none[2] ) + break ; + } + x--; + fuente_control_s.rect[i].w = x - fuente_control_s.rect[i].x + 1; + x++; + + fprintf(out, "%i: %i,%i-%i,%i\n" , + i , + fuente_control_s.rect[i].x , + fuente_control_s.rect[i].y , + fuente_control_s.rect[i].w , + fuente_control_s.rect[i].h ); + + i++; + break ; + } + } + if ( i > 255) + break ; + } + + fp = fopen("fuente.fnt" , "w" ); + + fuente_control_s.offset_imagen = sizeof( fuente_control_s ); + fuente_control_s.size_imagen = imagen->w * imagen->h * imagen->format->BytesPerPixel; + fuente_control_s.w = imagen->w ; + fuente_control_s.h = imagen->h ; + fuente_control_s.bytespp = imagen->format->BytesPerPixel; + + printf("Sizeof control: %i\nOffset imagen: %i\nSizeof imagen: %i" , + fuente_control_s.offset_imagen, fuente_control_s.offset_imagen , + fuente_control_s.size_imagen ); + getchar(); + + if(!(pool = malloc(fuente_control_s.size_imagen + 1) ) ) + printf("ERROR: Memoria insuficiente\n"); + + for ( x = 0 ; x < imagen->w ; x++ ) + for ( y = 0 ; y < imagen->h ; y++ ) + for ( i = 0 ; i < imagen->format->BytesPerPixel ; i++ ) + pool[ ( x + y * imagen->w ) * imagen->format->BytesPerPixel + i ] = *(px + ( y * imagen->pitch ) + ( x * imagen->format->BytesPerPixel ) + i ); + + SDL_UnlockSurface( imagen ); + + + printf("\nescribe: %i" , fwrite( &fuente_control_s , 1 , sizeof(fuente_control_s) , fp ) ); + + pos = fuente_control_s.offset_imagen; + fsetpos(fp , &pos ); + + printf( "\n%i\n" , ftell( fp ) ); + getchar(); + + + fwrite( pool , 1 , fuente_control_s.size_imagen , fp ); + + free(pool); + + exit (EXIT_SUCCESS); +} + + diff --git a/util/src/bmp2fnt/win32/bmp2fnt.sln b/util/src/bmp2fnt/win32/bmp2fnt.sln new file mode 100644 index 0000000..e94eeb7 --- /dev/null +++ b/util/src/bmp2fnt/win32/bmp2fnt.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmp2fnt", "bmp2fnt.vcproj", "{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.ActiveCfg = Debug|Win32 + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.Build.0 = Debug|Win32 + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.ActiveCfg = Release|Win32 + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/util/src/bmp2fnt/win32/bmp2fnt.vcproj b/util/src/bmp2fnt/win32/bmp2fnt.vcproj new file mode 100644 index 0000000..33768d8 --- /dev/null +++ b/util/src/bmp2fnt/win32/bmp2fnt.vcproj @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/util/src/doku/doku.c b/util/src/doku/doku.c new file mode 100644 index 0000000..26d965a --- /dev/null +++ b/util/src/doku/doku.c @@ -0,0 +1,569 @@ +/* + * eDiv Compiler + * Copyleft (C) 2000-2002 Sion Entertainment + * http://www.sion-e.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +/* + * esta es la tabla donde se almacenan los nombres de las directivas y los textos + * por los que deben ser sustituidas, definidos en template.txt + */ +struct _sust { + char de[20]; + char a[1024]; +} sust[20]; + +/* + * esta funcion recibe un nombre de fichero (actual) y, consultando el index.dok, + * devuelve el documento anterior, el siguiente y el superior. Evidentemente esto + * se usa para generar los enlaces de navegacion. + */ +void situame(char* actual, char* ant, char* sig, char* sup); + +/* esta funcion abre el fichero indicado en fixero1 y busca en el el texto + * encerrado entre las directivas <%title%> y <%/title%>, y lo devuelve en + * el puntero "titulo" + */ +void lee_titulo(char* fixero1, char* titulo); + +/* + * esta es llamada cuando nos encontramos con la directiva <%index%>. Parsea + * el arbolito ese con los signos '+' y genera una unordered list mu potita. + */ +void procesa_indice(); + +/* + * esta es llamada cuando encontramos <%subindex%>. Se le indica el fichero + * actual y busca la entrada correspondiente en el index.dok. Entonces parsea + * la porcion de arbol que engloba y genera un subíndice como los de SGML. + */ +void procesa_subindice(char* actual); + + +FILE *f; +int i,tamano; +char* buffer; + +int main(int argc, char* argv[]) +{ + int c,num=-1,j,sw; + char nomfich[256]; + char tag[20]; + int flag=0; + + if(argc!=2) { + printf("Modo de uso: %s \n",argv[0]); + exit(1); + } + + for(i=0;i') i+=2; + c=0; + if(!strcmp(sust[num].de,"index") || !strcmp(sust[num].de,"/index") || + !strcmp(sust[num].de,"subindex")) { + printf("Error en template.txt: \"%s\" es una directiva reservada\n",sust[num].de); + exit(10); + } + } + if(buffer[i]=='"') { + i++; + while(1) { + if(buffer[i]=='"' && buffer[i-1]!='\\') break; + if(buffer[i]=='\\' && buffer[i+1]=='n') + buffer[++i]='\n'; + else if(buffer[i]=='\\' && buffer[i+1]=='"') + buffer[++i]='"'; + sust[num].a[c++]=buffer[i++]; + } + } + } + + free(buffer); + + strcpy(nomfich,argv[1]); + strcat(nomfich,".dok"); + + if((f=fopen(nomfich,"r"))==NULL) { + printf("Error abriendo fichero %s\n",nomfich); + exit(4); + } + + fseek(f,0,SEEK_END); + tamano=ftell(f); + fseek(f,0,SEEK_SET); + + if((buffer=(char*)malloc(tamano+1))==NULL) { + printf("Error: memoria insuficiente\n"); + exit(5); + } + + tamano=fread(buffer,1,tamano,f); + fclose(f); + + buffer[tamano]=0; + + strcpy(nomfich,argv[1]); + strcat(nomfich,".html"); + + if((f=fopen(nomfich,"w"))==NULL) { + printf("Error creando fichero %s\n",nomfich); + exit(7); + } + + printf("Procesando...\n"); + + fprintf(f,"\n"); + for(i=0;i') i+=2; + else { + fclose(f); + printf("Error en tag %s, byte %d\n",tag,i); + exit(8); + } + flag=i; + sw=0; + for(j=0;j<=num;j++) + if(!strcmp(sust[j].de,tag)) { + sw=1; + fwrite(sust[j].a,1,strlen(sust[j].a),f); + break; + } + if(!sw) { + if(!strcmp(tag,"index")) { + procesa_indice(); + flag=i; + } + else if(!strcmp(tag,"subindex")) { + procesa_subindice(argv[1]); + } + else { + fclose(f); + printf("Error: tag no reconocido %s en byte %d\n",tag,i); + exit(9); + } + } + if(!strcmp(tag,"/title") && strcmp(argv[1],"index")) { + char ant[256], sig[256], sup[256]; + char tant[512], tsig[512], tsup[512], tidx[512]; + situame(argv[1],ant,sig,sup); + lee_titulo(ant,tant); + lee_titulo(sig,tsig); + lee_titulo(sup,tsup); + lee_titulo("index",tidx); + fprintf(f,"\n\n\n\n\n
"); + if(*ant!=0) fprintf(f,"Anterior
%s",ant,tant); + else fprintf(f,"Anterior
 "); + fprintf(f,"
"); + if(*sup!=0) fprintf(f,"Subir
%s",sup,tsup); + else fprintf(f,"Subir
%s",tidx); + fprintf(f,"
Contenido" + "
%s
",tidx); + if(*sig!=0) fprintf(f,"Siguiente
%s",sig,tsig); + else fprintf(f,"Siguiente
 "); + fprintf(f,"

\n"); + } + } + } + + fwrite(&buffer[flag],1,strlen(&buffer[flag]),f); + + fclose(f); + + printf("Guardado %s\n",nomfich); + + return 0; +} + +void situame(char* actual, char* ant, char* sig, char* sup) +{ + FILE* fi; + char* buf,tag[20],fixero[256]; + int tam,p,c; + + int nivel=0,ni; + char anterior[256],superior[20][256]; + const char fin[]="<%/index%>"; + int j,sw=0,pillasig=0; + + *ant=0; *sig=0; *sup=0; + + if((fi=fopen("index.dok","r"))==NULL) { + printf("Error: no puedo abrir index.dok\n"); + exit(13); + } + + fseek(fi,0,SEEK_END); + tam=ftell(fi); + fseek(fi,0,SEEK_SET); + + if((buf=(char*)malloc(tam+1))==NULL) { + printf("Error: memoria insuficiente\n"); + exit(14); + } + + tam=fread(buf,1,tam,fi); + fclose(fi); + + buf[tam]=0; + + for(p=0;p') p+=2; + else { + printf("Error en fichero index.dok, tag %s, byte %d\n",tag,p); + exit(15); + } + if(!strcmp(tag,"index")) { + sw=1; + break; + } + } + } + + if(!sw) { + printf("Error: no se encuentra directiva <%index%> en index.dok\n"); + exit(16); + } + + memset(fixero,0,256); + memset(anterior,0,256); + memset(superior,0,256*20); + + for(;p31 && pnivel) { + if(ni==20) { + printf("Error: el indice no puede tener mas de 20 niveles\n"); + exit(17); + } + + if(!pillasig) { nivel=ni; strcpy(superior[nivel],fixero); } + } + if(ni31 && buf[p]!='<') + fixero[c++]=buf[p++]; + fixero[c]=0; + if(buf[p]=='<') p--; + if(pillasig) { + strcpy(ant,anterior); + strcpy(sig,fixero); + strcpy(sup,superior[nivel]); + fclose(fi); + free(buf); + return; + } + if(!strcmp(actual,fixero)) pillasig=1; + else strcpy(anterior,fixero); + } + if(pillasig) { + strcpy(ant,anterior); + strcpy(sup,superior[nivel]); + fclose(fi); + free(buf); + return; + } + printf("Error: el documento no esta listado en el indice\n"); + exit(18); +} + +void lee_titulo(char* fixero1, char* titulo) +{ + FILE* fi; + char* buf,tag[20],fixero[256]; + int tam,p,c; + + strcpy(fixero,fixero1); + strcat(fixero,".dok"); + + if((fi=fopen(fixero,"rb"))==NULL) { + sprintf(titulo,"[Error al abrir \"%s\"]",fixero); + return; + } + + fseek(fi,0,SEEK_END); + tam=ftell(fi); + fseek(fi,0,SEEK_SET); + + if((buf=(char*)malloc(tam+1))==NULL) { + printf("Error: memoria insuficiente\n"); + exit(11); + } + + tam=fread(buf,1,tam,fi); + fclose(fi); + + buf[tam]=0; + + for(p=0;p') p+=2; + else { + printf("Error en fichero %s, tag %s, byte %d\n",fixero,tag,p); + exit(13); + } + if(!strcmp(tag,"title")) { + c=0; + while(p"); + fprintf(f,"\n"); + i+=10; + return; + } + if(buffer[i]==';') { + while(buffer[i]>31 && inivel) { + if(ni==20) { + printf("Error: el indice no puede tener mas de 20 niveles\n"); + exit(25); + } + for(j=nivel;j"); + fprintf(f,"\n"); + nivel=ni; + } + if(ni"); + fprintf(f,"\n"); + nivel=ni; + } + c=0; + while(buffer[i]>31 && buffer[i]!='<') + fixero[c++]=buffer[i++]; + fixero[c]=0; + if(buffer[i]=='<') i--; + lee_titulo(fixero,titulo); + if(nivel==0) + fprintf(f,"

%s

\n",fixero,titulo); + else + fprintf(f,"
  • %s
  • \n",fixero,titulo); + } +} + +void procesa_subindice(char* actual) +{ + FILE* fi; + char* buf,tag[20],fixero[256],titulo[512]; + int tam,p,c; + + int nivel=0,ni,iniv; + const char fin[]="<%/index%>"; + int j,sw=0,pilla=0; + + if((fi=fopen("index.dok","r"))==NULL) { + printf("Error: no puedo abrir index.dok\n"); + exit(19); + } + + fseek(fi,0,SEEK_END); + tam=ftell(fi); + fseek(fi,0,SEEK_SET); + + if((buf=(char*)malloc(tam+1))==NULL) { + printf("Error: memoria insuficiente\n"); + exit(20); + } + + tam=fread(buf,1,tam,fi); + fclose(fi); + + buf[tam]=0; + + for(p=0;p') p+=2; + else { + printf("Error en fichero index.dok, tag %s, byte %d\n",tag,p); + exit(21); + } + if(!strcmp(tag,"index")) { + sw=1; + break; + } + } + } + + if(!sw) { + printf("Error: no se encuentra directiva <%index%> en index.dok\n"); + exit(22); + } + + for(;p31 && pnivel) { + if(ni==20) { + printf("Error: el indice no puede tener mas de 20 niveles\n"); + exit(23); + } + if(pilla && ni==iniv+1) { + fprintf(f,"
      "); + fprintf(f,"\n"); + } + nivel=ni; + } + if(ni31 && buf[p]!='<') + fixero[c++]=buf[p++]; + fixero[c]=0; + if(buf[p]=='<') p--; + if(!strcmp(actual,fixero)) { + pilla=1; + fprintf(f,"
        "); + iniv=nivel; + } + if(pilla && nivel<=iniv+1) { + lee_titulo(fixero,titulo); + fprintf(f,"
      • %s
      • \n",fixero,titulo); + } + } + if(pilla) { + fprintf(f,"
      "); + fprintf(f,"
    "); + fprintf(f,"\n"); + return; + } + printf("Error: el documento no esta listado en el indice\n"); + exit(24); +} \ No newline at end of file diff --git a/util/src/doku/template.txt b/util/src/doku/template.txt new file mode 100644 index 0000000..d03d2cd --- /dev/null +++ b/util/src/doku/template.txt @@ -0,0 +1,11 @@ +<%title%> "\n\neDIV docs - " +<%/title%> "\n" + "\n\n\n" + "" +<%end%> "

    Esta documentación ha sido escrita por el equipo de\n" + "Sion Entertainment y forma parte del proyecto eDIV. Las actualizaciones de esta\n" + "documentación pueden obtenerse en www.edivcentral.com.\nSi ve algún error o anomalía " + "en cualquiera de los documentos que\nse incluyen en este proyecto, por favor " + "comuníquenoslo a bugs@edivcentral.com.\n" + "Gracias.
    \n© Copyleft Sion Entertainment, 2001

    \n\n\n" diff --git a/util/src/doku/win32/doku.sln b/util/src/doku/win32/doku.sln new file mode 100644 index 0000000..b6338f8 --- /dev/null +++ b/util/src/doku/win32/doku.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doku", "doku.vcproj", "{729B5997-F7D8-446A-AE12-6E4E801B323D}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.ActiveCfg = Debug|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.Build.0 = Debug|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.ActiveCfg = Release|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/util/src/doku/win32/doku.vcproj b/util/src/doku/win32/doku.vcproj new file mode 100644 index 0000000..af768f0 --- /dev/null +++ b/util/src/doku/win32/doku.vcproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/util/src/iconchanger/iconchanger.c b/util/src/iconchanger/iconchanger.c new file mode 100644 index 0000000..bd36c9b --- /dev/null +++ b/util/src/iconchanger/iconchanger.c @@ -0,0 +1,144 @@ +/* IconChanger + * Pequeña utilidad-complemento para eDIV que permite sustituir el icono del stub de + * win32 por otro. El icono nuevo debe ser exactamente igual que el original del stub, + * es decir, tiene que cumplir las siguientes condiciones: + * - Contener 6 imágenes en total: + * + 16x16 a 4, 8 y 24 bits de color + * + 32x32 a 4, 8 y 24 bits de color + * - "Pesar" exactamente 8.854 bytes. + * Este programa es muy simple así que no se molesta en comprobar el formato del fichero, + * únicamente comprueba su tamaño. Si metes un icono que no es adecuado.. allá tú.. + * Puede ser útil en el futuro currarnos un programa decente que soporte cualquier tipo + * de iconos, que cambiara el tamaño del exe, etc etc, ya sería la reostia, pero por + * ahora con esto nos sobra. + * Pekeño inconveniente: sólo se puede cambiar el icono 1 vez :p Si se kiere cambiar el + * icono por segunda vez, hay que recompilar el programa. En realidad no importa, ya que + * en verdad es lo que pasa en todos los compiladores... + * Si se kiere cambiar el icono y un virus te ha comido el ediv.exe o el .prg, pos tiras + * de Resource Hacker y a kaxkarla... + * + * Er_Makina + */ + +#ifndef _WIN32 +#error IconChanger es sólamente para Win32 +#endif + +#include +#include +#include + +#include "iconchanger.h" + + +#define ICO_SIZE 8854 // Tamaño que debe tener el .ico +#define ICO_START 0x66 // Offset donde se empieza a leer el .ico +#define ICO_LEN 0x2230 // Tamaño del bloque a copiar del .ico al .exe + + +void* e_malloc(size_t size) +{ + void* ret; + + if(!(ret = malloc(size))) { + printf("ERROR: Memoria insuficiente.\n\n"); + exit(1); + } + + return ret; +} + +int main(int argc, char* argv[]) +{ + FILE* f; + unsigned char *exe,*ico; + int tamanyo; + int i,j; + int ok=0; + + printf("eDIV IconChanger - Copyright (c) Sion Ltd. 2002\n\n"); + if(argc!=3) { + printf("Modo de uso:\n\n %s \n\n",argv[0]); + exit(2); + } + + if((f=fopen(argv[2],"rb"))==NULL) { + printf("ERROR: No puedo abrir %s\n\n",argv[2]); + exit(3); + } + + fseek(f,0,SEEK_END); + tamanyo=ftell(f); + if(tamanyo!=ICO_SIZE) { + fclose(f); + printf("ERROR: El icono no es del formato válido\n\n"); + printf("Te refrescaré la memoria:\nEl icono (.ico) DEBE contener 6 imágenes en total, a saber:\n"); + printf(" - 3 imágenes de 16x16 (a 4, 8 y 24 bits de color).\n"); + printf(" - 3 imágenes de 32x32 (a 4, 8 y 24 bits de color).\n"); + printf("No puede faltar ninguna, ya que el archivo debe ocupar EXACTAMENTE %d bytes.\n\n",ICO_SIZE); + exit(4); + } + + ico=(unsigned char*)e_malloc(tamanyo); + fseek(f,0,SEEK_SET); + fread(ico,tamanyo,1,f); + fclose(f); + + if((f=fopen(argv[1],"rb"))==NULL) { + printf("ERROR: No puedo abrir %s\n\n",argv[1]); + exit(5); + } + + fseek(f,0,SEEK_END); + tamanyo=ftell(f); + fseek(f,0,SEEK_SET); + exe=(unsigned char*)e_malloc(tamanyo); /* no creo ke pase nada por unos 125 kb... + eso si, cuando se puedan meter el PAK y + las DLL's en el exe, va a haber ke cambiar + esto... */ + fread(exe,tamanyo,1,f); + fclose(f); + + // BUSKEDA + + printf("Buscando sitio donde meter mano en el exe...\n"); + + for(i=20;i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/util/src/win32/util.sln b/util/src/win32/util.sln new file mode 100644 index 0000000..3b1679d --- /dev/null +++ b/util/src/win32/util.sln @@ -0,0 +1,33 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmp2fnt", "..\bmp2fnt\win32\bmp2fnt.vcproj", "{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doku", "..\doku\win32\doku.vcproj", "{729B5997-F7D8-446A-AE12-6E4E801B323D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iconchanger", "..\iconchanger\win32\iconchanger.vcproj", "{97770962-E34D-47AB-AD97-F1BECDD66601}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.ActiveCfg = Debug|Win32 + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.Build.0 = Debug|Win32 + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.ActiveCfg = Release|Win32 + {CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.Build.0 = Release|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.ActiveCfg = Debug|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.Build.0 = Debug|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.ActiveCfg = Release|Win32 + {729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.Build.0 = Release|Win32 + {97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.ActiveCfg = Debug|Win32 + {97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.Build.0 = Debug|Win32 + {97770962-E34D-47AB-AD97-F1BECDD66601}.Release.ActiveCfg = Release|Win32 + {97770962-E34D-47AB-AD97-F1BECDD66601}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal