Commit 6f226c76 authored by Sergio Costas's avatar Sergio Costas

Cambios para que instale en cualquier directorio

Ahora permite trabajar en 320x240
parent 40bf0bd5
#CC = gcc -O2 -Wall -Wno-pointer-sign `pkg-config --cflags sdl libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
#CCo = gcc
ifdef PREFIX
PREFIX2=$(PREFIX)/usr
else
PREFIX2=/usr/local
endif
CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -O2 -Wno-pointer-sign -Wall -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
LDFLAGS += `pkg-config --libs sdl libpulse-simple alsa`
......@@ -12,26 +15,26 @@ clean:
rm fbzx *.o *~
install:
rm -f /usr/bin/fbzx
cp fbzx /usr/local/bin
mkdir -p /usr/local/share/fbzx
mkdir -p /usr/local/share/spectrum-roms
mkdir -p /usr/share/applications
mkdir -p /usr/share/pixmaps
mkdir -p /usr/local/share/doc/fbzx
cp spectrum-roms/* /usr/local/share/spectrum-roms
cp keymap.bmp /usr/local/share/fbzx
cp fbzx.desktop /usr/share/applications
cp fbzx.svg /usr/share/pixmaps
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS /usr/local/share/doc/fbzx/
rm -f $(PREFIX2)/bin/fbzx
cp fbzx $(PREFIX2)/bin
mkdir -p $(PREFIX2)/share/fbzx
mkdir -p $(PREFIX2)/share/spectrum-roms
mkdir -p $(PREFIX2)/share/applications
mkdir -p $(PREFIX2)/share/pixmaps
mkdir -p $(PREFIX2)/share/doc/fbzx
cp spectrum-roms/* $(PREFIX2)/share/spectrum-roms
cp keymap.bmp $(PREFIX2)/share/fbzx
cp fbzx.desktop $(PREFIX2)/share/applications
cp fbzx.svg $(PREFIX2)/share/pixmaps
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $(PREFIX2)/share/doc/fbzx/
uninstall:
rm -f /usr/local/bin/fbzx
rm -rf /usr/local/share/fbzx
rm -f /usr/share/applications/fbzx.desktop
rm -f /usr/share/pixmaps/fbzx.svg
rm -rf /usr/local/share/doc/fbzx
rm -rf /usr/local/share/spectrum-roms
rm -f $(PREFIX2)/bin/fbzx
rm -rf $(PREFIX2)/share/fbzx
rm -f $(PREFIX2)/share/applications/fbzx.desktop
rm -f $(PREFIX2)/share/pixmaps/fbzx.svg
rm -rf $(PREFIX2)/share/doc/fbzx
rm -rf $(PREFIX2)/share/spectrum-roms
spk_ay.o: spk_ay.c spk_ay.h emulator.h sound.h computer.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o spk_ay.o spk_ay.c
......
......@@ -39,17 +39,21 @@ void printchar(unsigned char *memo, unsigned char carac, int x, int y, unsigned
if ((characters[carac-32][pos]) & bit_rot)
paint_one_pixel (colors + (int) (color), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(color-16));
else
else if ((ordenador.text_mini==0)||((bucle1%2==0)&&(bucle2%2==0)))
paint_one_pixel (colors + (int) (back), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(back-16));
lugar2+=ordenador.bpp;
if ((ordenador.text_mini==0)||(bucle2%2==1)) {
lugar2+=ordenador.bpp;
}
bit_rot/=2;
if ((bucle2 == 7) || (bucle2 == 15)) {
pos++;
bit_rot=0x80;
}
}
lugar+=(width * ordenador.bpp);
if ((ordenador.text_mini==0)||(bucle1%2==1)) {
lugar+=(width * ordenador.bpp);
}
}
}
......@@ -59,18 +63,33 @@ void print_string(unsigned char *memo, char *cadena, int x, int y, unsigned char
int length, ncarac, bucle, xx;
int xxx, yyy;
int w,h;
unsigned char *str2;
if (ordenador.text_mini==1) {
if (x!=-1)
x/=2;
y/=2;
w=8;
h=10;
} else {
w=16;
h=20;
}
for (ncarac=0,str2=cadena;*str2;str2++) {
if ((*str2)>=' ') {
ncarac++;
}
}
length=16 * ncarac;
length=w * ncarac;
if (length > width)
xx=x;
else {
if (length > width) {
if (x>=0)
xx=x;
else
xx=0;
} else {
if (x == -1) // we want it centered
xx=(width / 2) - (length / 2);
else
......@@ -97,10 +116,10 @@ void print_string(unsigned char *memo, char *cadena, int x, int y, unsigned char
}
if ((*str2)<=127) {
printchar (memo,*str2, xxx, yyy, color, back, width);
xxx+=16;
if (xxx >= width - 16) {
xxx+=w;
if (xxx >= width - w) {
xxx=0;
yyy+=20;
yyy+=h;
}
}
str2++;
......
......@@ -371,6 +371,17 @@ void register_screen (SDL_Surface * pantalla) {
ordenador.next_pixel = 480;
ordenador.jump_pixel = 7680;
break;
case 3:
ordenador.init_line = 0;
ordenador.next_line = 0;
ordenador.next_scanline = 0;
ordenador.first_line = 40;
ordenador.last_line = 280;
ordenador.first_pixel = 0;
ordenador.last_pixel = 319;
ordenador.next_pixel = 1;
ordenador.jump_pixel = 4;
break;
}
ordenador.next_line*=ordenador.bpp;
......@@ -616,11 +627,11 @@ inline void paint_pixels (unsigned char octet,unsigned char ink, unsigned char p
valor = (octet & mask) ? (int) ink : (int) paper;
p=(colors+valor);
paint_one_pixel((unsigned char *)p,ordenador.pixel);
if ((ordenador.zaurus_mini!=1)&&(ordenador.dblscan)) {
if ((ordenador.zaurus_mini!=1)&&(ordenador.zaurus_mini!=3)&&(ordenador.dblscan)) {
paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline);
}
ordenador.pixel+=ordenador.next_pixel;
if (ordenador.zaurus_mini!=1) {
if ((ordenador.zaurus_mini!=1)&&(ordenador.zaurus_mini!=3)) {
paint_one_pixel((unsigned char *)p,ordenador.pixel);
if (ordenador.dblscan) {
paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline);
......
......@@ -41,6 +41,7 @@ struct computer {
unsigned int screen_width;
unsigned int translate[6144],translate2[6144];
unsigned char zaurus_mini;
unsigned char text_mini;
unsigned char dblscan;
unsigned char bw;
......
......@@ -405,6 +405,7 @@ void load_config(struct computer *object) {
continue;
}
if (!strncmp(line,"mode=",5)) {
printf("Cambio a modo %c\n",line[5]-'0');
mode128k=line[5]-'0';
continue;
}
......@@ -477,6 +478,7 @@ int main(int argc,char *argv[]) {
sound_type=SOUND_AUTOMATIC;
gamefile[0]=0;
ordenador.zaurus_mini=0;
ordenador.text_mini=0;
ordenador.ulaplus=0;
ordenador.ulaplus_reg=0;
fullscreen=0;
......@@ -489,8 +491,14 @@ int main(int argc,char *argv[]) {
ordenador.dblscan=0;
ordenador.bw=0;
computer_init();
printf("Computer init\n");
printf("Modo: %d\n",ordenador.mode128k);
// load current config
load_config(&ordenador);
printf("Modo: %d\n",ordenador.mode128k);
while(argumento<argc) {
if ((0==strcmp(argv[argumento],"-h"))||(0==strcmp(argv[argumento],"--help"))) {
......@@ -517,8 +525,9 @@ int main(int argc,char *argv[]) {
#ifdef D_SOUND_PULSE
printf(" -pulse: use PulseAudio for sound output (default)\n");
#endif
printf(" -mini: show screen at 320x240\n");
printf(" -mini: show screen at 320x240 in a rotated 640x480 screen\n");
printf(" -rotate: rotate screen clockwise\n");
printf(" -micro: show screen at 320x240\n");
printf(" -fs: start FBZX at fullscreen\n");
printf(" -hw: use hardware buffer (best for console framebuffer)\n");
printf(" -db: use double buffer\n");
......@@ -553,7 +562,11 @@ int main(int argc,char *argv[]) {
} else if(0==strcmp(argv[argumento],"-rotate")) {
ordenador.zaurus_mini=2;
argumento++;
} else if(0==strcmp(argv[argumento],"-fs")) {
} else if (0==strcmp(argv[argumento],"-micro")) {
ordenador.zaurus_mini=3;
ordenador.text_mini=1;
argumento++;
}else if(0==strcmp(argv[argumento],"-fs")) {
fullscreen=1;
argumento++;
} else if(0==strcmp(argv[argumento],"-hw")) {
......@@ -594,13 +607,14 @@ int main(int argc,char *argv[]) {
case 2:
init_screen(480,640,0,0,dblbuffer,hwsurface);
break;
case 3:
init_screen(320,240,0,0,dblbuffer,hwsurface);
break;
}
computer_init();
printf("Computer init\n");
printf("Modo: %d\n",ordenador.mode128k);
register_screen(screen);
printf("Screen registered\n");
printf("Modo: %d\n",ordenador.mode128k);
if(fullscreen) {
SDL_Fullscreen_Switch();
}
......@@ -623,11 +637,13 @@ int main(int argc,char *argv[]) {
// assign random values to the memory before start execution
printf("Reset memory\n");
printf("Modo: %d\n",ordenador.mode128k);
for(bucle=0;bucle<196608;bucle++)
ordenador.memoria[bucle]=(unsigned char) rand();
printf("Memory resetted\n");
ordenador.tap_file=NULL;
printf("Modo: %d\n",ordenador.mode128k);
// we filter all the events, except keyboard events
......@@ -664,8 +680,10 @@ int main(int argc,char *argv[]) {
ordenador.osd_time=100;
}
printf("Modo: %d\n",ordenador.mode128k);
printf("load main game\n");
load_main_game(gamefile);
printf("Modo: %d\n",ordenador.mode128k);
sprintf(ordenador.osd_text,"Press F1 for help");
ordenador.osd_time=200;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment