introducing.. IconChanger!! :D

This commit is contained in:
Gabriel Lorenzo 2002-09-08 23:43:45 +00:00
parent d0971bb29e
commit b73dd446fb
8 changed files with 308 additions and 1 deletions

View file

@ -1,3 +1,10 @@
9/9/2002
--------
* Le he añadido icono al stub, y también he hecho un programa (iconchanger)
para cambiárselo después de haber compilado un programa con ediv. mola
eh? :) incluyo también un icono de pacman de ejemplo ke me kedó mu majo.
(Er_Makina)
6/9/2002
--------
* Mejorado ligeramente el sistema de indexado de variables, ya no estan

BIN
ediv/bin/pacoman.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -266,4 +266,6 @@ Some old people actually have life support systems with those functions built in
http://www.cs.ukc.ac.uk/people/staff/rej/gc.html
screen_color(int color)
rellena el fondo con un color
rellena el fondo con un color
Incluir Psycle (tracker musical) en el IDE: http://sourceforge.net/projects/psycle/

View file

@ -0,0 +1,143 @@
/* 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á ..
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "image.h"
#ifndef _WIN32
#error IconChanger es sólamente para Win32
#endif
#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 - (c) Copyright Sion Ltd. 2002\n\n");
if(argc!=3) {
printf("Modo de uso:\n\n %s <programa.exe> <icono.ico>\n\n",argv[0]);
exit(2);
}
if((f=fopen(argv[2],"rb"))==NULL) {
printf("ERROR: No puedo abrir %s\n\n");
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");
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<tamanyo-sizeof(image);i++) {
if(exe[i]==image[0]) {
ok=1;
for(j=1;j<sizeof(image);j++) {
if(exe[i+j]!=image[j]) {
ok=0;
break;
}
}
if(ok) break;
}
}
if(!ok) {
free(ico);
free(exe);
printf("ERROR: El ejecutable no parece haber sido compilado con eDIV, o bien ya se le ha cambiado el icono.\n\n");
exit(6);
}
// "parcheamos" el exe en memoria
memcpy(&exe[i],&ico[ICO_START],ICO_LEN);
free(ico);
// y escribimos el exe enterito al disco duro.. lo mio si es optimizar eh? xDD
if((f=fopen(argv[1],"wb"))==NULL) {
free(exe);
printf("ERROR: No tengo acceso de escritura a %s\n\n",argv[1]);
exit(7);
}
fwrite(exe,tamanyo,1,f);
fclose(f);
free(exe);
printf("Completado :)\n\n");
return 0;
}

View file

@ -0,0 +1,22 @@
/* Esto contiene la imagen del icono por defecto del stub en su versión
* 16x16x16 (obtenida con Resource Hacker y gif2h), la cual se busca en el
* stub para saber dónde hay que escribir el nuevo icono.
*/
static unsigned char image[]={
40,0,0,0,16,0,0,0,32,0,0,0,1,0,4,0,0,0,0,0,
192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,128,0,0,128,0,0,0,128,128,0,128,0,0,0,
128,0,128,0,128,128,0,0,192,192,192,0,128,128,128,0,0,0,255,0,
0,255,0,0,0,255,255,0,255,0,0,0,255,0,255,0,255,255,0,0,
255,255,255,0,0,0,0,0,0,0,0,0,15,127,127,127,127,127,127,120,
7,247,247,0,0,247,247,248,15,127,112,243,243,15,127,120,7,247,15,48,
15,48,247,248,15,112,243,243,240,0,127,120,7,240,63,0,63,48,247,248,
15,112,243,240,3,240,127,120,7,240,63,63,63,48,247,248,15,127,3,243,
243,0,127,120,7,247,240,0,0,247,247,248,15,127,127,127,127,127,127,120,
7,247,247,247,247,247,247,248,15,153,251,191,170,255,255,248,15,153,251,191,
170,255,255,248,7,119,119,119,119,119,119,120,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};

View file

@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doku", "doku\doku.vcproj",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ediv", "ediv\ediv.vcproj", "{43BB24AC-97C9-42A5-996C-3C2EBE5B3FE1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iconchanger", "iconchanger\iconchanger.vcproj", "{510122F8-EE04-4E05-95C3-BCF6BBF7B991}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
@ -59,6 +61,14 @@ Global
{43BB24AC-97C9-42A5-996C-3C2EBE5B3FE1}.Release.Build.0 = Release|Win32
{43BB24AC-97C9-42A5-996C-3C2EBE5B3FE1}.Release con trazador.ActiveCfg = Release|Win32
{43BB24AC-97C9-42A5-996C-3C2EBE5B3FE1}.Release con trazador.Build.0 = Release|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Debug.ActiveCfg = Debug|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Debug.Build.0 = Debug|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Debug con trazador.ActiveCfg = Debug|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Debug con trazador.Build.0 = Debug|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Release.ActiveCfg = Release|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Release.Build.0 = Release|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Release con trazador.ActiveCfg = Release|Win32
{510122F8-EE04-4E05-95C3-BCF6BBF7B991}.Release con trazador.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

Binary file not shown.

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="iconchanger"
ProjectGUID="{510122F8-EE04-4E05-95C3-BCF6BBF7B991}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="../../../bin/iconchanger.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/iconchanger.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/iconchanger.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\..\iconchanger\iconchanger.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\..\iconchanger\image.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>