STRIP = arm-linux-strip
TFLAGS = -mcpu=arm920t -Izlib -DGP2X=1 -DLSB_FIRST -DSDL -DUNIX -DPSS_STYLE=1 -DZLIB -DFRAMESKIP -D_REENTRANT
RM = rm -f
-B = drivers/pc/
+B = drivers/gp2x/
ifdef DEBUG
TFLAGS += -ggdb
else
include zlib/Makefile
-OBJDRIVER = ${B}minimal.o ${B}sdl.o ${B}main.o ${B}throttle.o ${B}unix-netplay.o ${B}sdl-sound.o ${B}sdl-video.o ${B}lnx-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS} ppu.o
+OBJDRIVER = ${B}minimal.o ${B}gp2x.o ${B}main.o ${B}throttle.o ${B}unix-netplay.o ${B}gp2x-sound.o ${B}gp2x-video.o ${B}lnx-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS} ppu.o
LDRIVER = -L /mnt/sd/lib -L/mnt/sd/gp2x/usr/lib -lm -lpthread -lz -static
-# `arm-linux-sdl-config --libs`
include Makefile.base
${B}lnx-joystick.o: ${B}lnx-joystick.c
${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c
-${B}sdl.o: ${B}sdl.c ${B}sdl.h
-${B}sdl-video.o: ${B}sdl-video.c
-${B}sdl-video.o: ${B}minimal.c
-${B}sdl-sound.o: ${B}sdl-sound.c
+${B}gp2x.o: ${B}gp2x.c ${B}gp2x.h
+${B}gp2x-video.o: ${B}gp2x-video.c
+${B}gp2x-video.o: ${B}minimal.c
+${B}gp2x-sound.o: ${B}gp2x-sound.c
${B}unix-netplay.o: ${B}unix-netplay.c
${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h
ppu.o: ppu.c ppu.h
/* Prototypes for platform interface functions follow: */
-void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
+void FCEUD_Update(uint8 *XBuf, int16 *Buffer, int Count);
/* Video interface */
void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b);
void GetBaseDirectory(char *BaseDirectory);
int InitSound(void);
-void WriteSound(int32 *Buffer, int Count, int NoWaiting);
+void WriteSound(int16 *Buffer, int Count, int NoWaiting);
void KillSound(void);
void SilenceSound(int s); /* DOS and SDL */
--- /dev/null
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <linux/soundcard.h>
+
+#include "gp2x.h"
+#include "minimal.h"
+#include "throttle.h"
+
+
+extern int soundvol;
+extern unsigned long gp2x_dev[8];
+
+// always have this call
+INLINE void gp2x_sound_frame(void *blah, void *buff, int samples)
+{
+}
+
+void WriteSound(int16 *Buffer, int Count)
+{
+ write(gp2x_dev[3], Buffer, Count<<1);
+ SpeedThrottle();
+}
+
+void* gp2x_write_sound(void* blah)
+{
+ return NULL;
+}
+
+void SilenceSound(int n)
+{
+ soundvol=0;
+}
+
+int InitSound(FCEUGI *gi)
+{
+ Settings.sound=22050;
+ FCEUI_Sound(Settings.sound);
+ gp2x_sound_volume(soundvol, soundvol);
+ printf("InitSound() sound_rate: %d\n", Settings.sound);
+ return 1;
+}
+
+uint32 GetMaxSound(void)
+{
+ return(4096);
+}
+
+uint32 GetWriteSound(void)
+{
+ return 1024;
+}
+
+int KillSound(void)
+{
+ FCEUI_Sound(0);
+
+ return 1;
+}
+
#include <string.h>
#include <sys/time.h>
-#include "sdl.h"
-//#include "../common/vidblit.h"
-
-
+#include "gp2x.h"
#include "minimal.h"
extern int showfps;
gettimeofday(&tv_now, 0);
if (prevsec != tv_now.tv_sec)
{
- sprintf(fps_str, "%i/%i", framesRendered, framesEmulated);
+ sprintf(fps_str, "%2i/%2i", framesRendered, framesEmulated);
framesEmulated = framesRendered = 0;
needfpsflip = 4;
prevsec = tv_now.tv_sec;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
-#include "sdl.h"
-#include "sdl-video.h"
+#include "gp2x.h"
+#include "gp2x-video.h"
#ifdef NETWORK
#include "unix-netplay.h"
#endif
#include "minimal.h"
-//extern int soundvol;
+
int CLImain(int argc, char *argv[]);
-extern int gp2x_in_sound_thread;
-extern void pthread_yield(void);
extern void SetVideoScaling(int, int, int);
//#define SOUND_RATE 44100
gp2x_deinit();
// make sure sound thread has exited cleanly
- while (gp2x_in_sound_thread) pthread_yield();
- printf("Sound thread exited\n");
printf("Exiting main(). terminated");
if (showfps && swapbuttons)
{
inited=0;
}
-void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
+void FCEUD_Update(uint8 *XBuf, int16 *Buffer, int Count)
{
if(!Count && !NoWaiting && !(eoptions&EO_NOTHROTTLE))
SpeedThrottle();
0.9: initial FIFO message system for dual cpu cores.
initial 48 Mb support.
- initial quadruple buffering in 8bbp mode.
+ initial quadruple buffering in 8bbp mode.
added functions:
- - gp2x_dualcore_exec() ; initial FIFO message system for dual cpu cores.
+ - gp2x_dualcore_exec() ; initial FIFO message system for dual cpu cores.
- gp2x_dualcore_sync() ; initial FIFO message system for dual cpu cores.
improved functions:
- - gp2x_video_flip() ; initial quadruple buffering in 8bbp mode.
+ - gp2x_video_flip() ; initial quadruple buffering in 8bbp mode.
0.8: initial dual cores cpu support.
very basic blit functions by popular demand ;-)
volatile unsigned long gp2x_sound_pausei=1, gp2x_ticks=0, gp2x_sound=0, *gp2x_dualcore_ram;
unsigned short *gp2x_memregs, *gp2x_screen15, *gp2x_logvram15[4], gp2x_sound_buffer[4+((44100/25)*2)*8]; //25 Hz gives our biggest supported sampling buffer
volatile unsigned short gp2x_palette[512];
- pthread_t gp2x_sound_thread=0;
extern void gp2x_sound_frame(void *blah, void *buff, int samples);
unsigned long address=gp2x_physvram[gp2x_physvram[7]];
if(++gp2x_physvram[7]==4) gp2x_physvram[7]=0;
- gp2x_screen15=gp2x_logvram15[gp2x_physvram[7]];
- gp2x_screen8=(unsigned char *)gp2x_screen15;
-
+ gp2x_screen15=gp2x_logvram15[gp2x_physvram[7]];
+ gp2x_screen8=(unsigned char *)gp2x_screen15;
+
gp2x_memregs[0x290E>>1]=(unsigned short)(address & 0xFFFF);
gp2x_memregs[0x2910>>1]=(unsigned short)(address >> 16);
gp2x_memregs[0x2912>>1]=(unsigned short)(address & 0xFFFF);
{
unsigned long address=gp2x_physvram[0];
- gp2x_screen15=gp2x_logvram15[0];
- gp2x_screen8=(unsigned char *)gp2x_screen15;
-
+ gp2x_screen15=gp2x_logvram15[0];
+ gp2x_screen8=(unsigned char *)gp2x_screen15;
+
gp2x_memregs[0x290E>>1]=(unsigned short)(address & 0xFFFF);
gp2x_memregs[0x2910>>1]=(unsigned short)(address >> 16);
gp2x_memregs[0x2912>>1]=(unsigned short)(address & 0xFFFF);
void gp2x_video_setgamma(unsigned short gamma) /*0..255*/
{
- int i=256*3;
- gp2x_memregs[0x295C>>1]=0;
- while(i--) gp2x_memregs[0x295E>>1]=gamma;
+ int i=256*3;
+ gp2x_memregs[0x295C>>1]=0;
+ while(i--) gp2x_memregs[0x295E>>1]=gamma;
}
void gp2x_video_setpalette(void)
{
unsigned short *g=(unsigned short *)gp2x_palette; int i=512;
- gp2x_memregs[0x2958>>1]=0;
- while(i--) gp2x_memregs[0x295A>>1]=*g++;
+ gp2x_memregs[0x2958>>1]=0;
+ while(i--) gp2x_memregs[0x295A>>1]=*g++;
}
void gp2x_blitter_rect15(gp2x_rect *r)
void gp2x_blitter_rect8(gp2x_rect *r)
{
- int x, y; unsigned char *data=r->data8, *offset=&gp2x_screen8[r->x+r->y*320];
+ int x, y; unsigned char *data=r->data8, *offset=&gp2x_screen8[r->x+r->y*320];
y=r->h; if(r->solid)
while(y--) { x=r->w; while(x--) *offset++=*data++; offset+=320-x; }
while(y--) { x=r->w; while(x--) { if(*data) *offset=*data; offset++, data++; }
offset+=320-x; }
}
-
+
unsigned long gp2x_joystick_read(void)
{
unsigned long value=(gp2x_memregs[0x1198>>1] & 0x00FF);
if(value==0xF7) value=0xEB;
if(value==0xDF) value=0xAF;
if(value==0x7F) value=0xBE;
-
+
return ~((gp2x_memregs[0x1184>>1] & 0xFF00) | value | (gp2x_memregs[0x1186>>1] << 16));
}
void gp2x_timer_delay(unsigned long ticks)
{
unsigned long target=gp2x_memregl[0x0A00>>2]+ticks*gp2x_ticks_per_second;
- while(gp2x_memregl[0x0A00>>2]<target);
+ while(gp2x_memregl[0x0A00>>2]<target);
}
unsigned long gp2x_timer_read(void)
{
return gp2x_memregl[0x0A00>>2]/gp2x_ticks_per_second;
-}
+}
unsigned long gp2x_timer_read_ms(void)
{
return gp2x_memregl[0x0A00>>2];
-}
+}
void gp2x_sound_pause(int yes) { gp2x_sound_pausei=yes; }
-
+#if 0
static void *gp2x_sound_play(void *blah)
{
int flip=0, flyp=gp2x_sound_buffer[1];
struct timespec ts; ts.tv_sec=0, ts.tv_nsec=gp2x_sound_buffer[2];
- while(!gp2x_sound)
- {
+ while(!gp2x_sound)
+ {
nanosleep(&ts, NULL);
-
-
- if(!gp2x_sound_pausei)
- {
+
+
+ if(!gp2x_sound_pausei)
+ {
// [1] is sound buffer size at 22050, 16, stereo, it is 1468 (367*4)
// [0] number of bytes?, at 22050,16,stereo, it is 367
// first half of buffer
// first one is 368
-
+
gp2x_sound_frame(blah, (void *)(&gp2x_sound_buffer[4+flip]), gp2x_sound_buffer[0]);
// write out to second half of buffer
write(gp2x_dev[3], (void *)(&gp2x_sound_buffer[4+flyp]), gp2x_sound_buffer[1]);
flip+=gp2x_sound_buffer[1];
if(flip==gp2x_sound_buffer[1]*8) flip=0;
- flyp+=gp2x_sound_buffer[1];
+ flyp+=gp2x_sound_buffer[1];
if(flyp==gp2x_sound_buffer[1]*8) flyp=0;
- }
+ }
}
return NULL;
}
+#endif
static void gp2x_initqueue(gp2x_queue *q, unsigned long queue_items, unsigned long *position920t, unsigned long *position940t)
{
}
static void gp2x_enqueue(gp2x_queue *q, unsigned long data)
-{
+{
while(q->items==q->max_items); /*waiting for tail to decrease...*/
q->place920t[q->head = (q->head < q->max_items ? q->head+1 : 0)] = data;
q->items++;
void gp2x_dualcore_launch_program(unsigned long *area, unsigned long size)
{
unsigned long i=0, *arm940t_ram=(unsigned long *)gp2x_dualcore_ram;
-
+
gp2x_940t_reset(1);
gp2x_memregs[0x3B40>>1] = 0; //disable interrupts
gp2x_memregs[0x3B44>>1] = 0xffff;
gp2x_memregs[0x3B46>>1] = 0xffff;
- gp2x_940t_pause(0);
-
+ gp2x_940t_pause(0);
+
while(i < size) *arm940t_ram++=area[i++];
gp2x_initqueue((gp2x_queue *)gp2x_1stcore_data_ptr(GP2X_QUEUE_ARRAY_PTR), GP2X_QUEUE_MAX_ITEMS, (unsigned long *)gp2x_1stcore_data_ptr(GP2X_QUEUE_DATA_PTR), (unsigned long *)gp2x_2ndcore_data_ptr(GP2X_QUEUE_DATA_PTR));
int channels=1;
int stereoLocal=0;
- gp2x_ticks_per_second=7372800/ticks_per_second;
+ gp2x_ticks_per_second=7372800/ticks_per_second;
if(!gp2x_dev[0]) gp2x_dev[0] = open("/dev/fb0", O_RDWR);
if(!gp2x_dev[1]) gp2x_dev[1] = open("/dev/fb1", O_RDWR);
- if(!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
-
+ if(!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
+
// don't run sound right now
if ( gp2x_do_sound)
{
- if(!gp2x_dev[3]) gp2x_dev[3] = open("/dev/dsp", O_WRONLY);
+ if(!gp2x_dev[3]) gp2x_dev[3] = open("/dev/dsp", O_WRONLY|O_ASYNC);
if(!gp2x_dev[4]) gp2x_dev[4] = open("/dev/mixer", O_RDWR);
}
gp2x_memregs=(unsigned short *)gp2x_memregl;
if(first) { printf(MINILIB_VERSION "\n");
- gp2x_dualcore_registers(1);
+ gp2x_dualcore_registers(1);
gp2x_sound_volume(100,100);
gp2x_memregs[0x0F16>>1] = 0x830a; usleep(100000);
gp2x_memregs[0x0F58>>1] = 0x100c; usleep(100000); }
- ioctl(gp2x_dev[gp2x_physvram[7]=0], FBIOGET_FSCREENINFO, &fixed_info);
+ ioctl(gp2x_dev[gp2x_physvram[7]=0], FBIOGET_FSCREENINFO, &fixed_info);
gp2x_screen15=gp2x_logvram15[2]=gp2x_logvram15[0]=(unsigned short *)mmap(0, 320*240*2, PROT_WRITE, MAP_SHARED, gp2x_dev[0], 0);
gp2x_screen8=(unsigned char *)gp2x_screen15;
gp2x_physvram[2]=gp2x_physvram[0]=fixed_info.smem_start;
memset(gp2x_screen15, 0, 320*240*2); gp2x_video_flip();
if(bpp==8) gp2x_physvram[2]+=320*240, gp2x_physvram[3]+=320*240,
- gp2x_logvram15[2]+=320*240/2, gp2x_logvram15[3]+=320*240/2;
+ gp2x_logvram15[2]+=320*240/2, gp2x_logvram15[3]+=320*240/2;
if ( gp2x_do_sound)
{
-
+
ioctl(gp2x_dev[3], SNDCTL_DSP_SPEED, &rate);
ioctl(gp2x_dev[3], SNDCTL_DSP_SETFMT, &bits);
frag = 0x40000|13;
ioctl(gp2x_dev[3], SNDCTL_DSP_SETFRAGMENT, &frag);
-
+
printf("minimal() do sound, rate %d, bits %d, stereo %d, frag %d\n", rate, bits, stereo, frag);
- if(first)
- {
- first=0;
+ if(first)
+ {
+ first=0;
}
- }
+ }
}
gp2x_dualcore_registers(0);
gp2x_memregs[0x28DA>>1]=0x4AB; //set video mode
- gp2x_memregs[0x290C>>1]=640;
-
+ gp2x_memregs[0x290C>>1]=640;
+
{ int i; for(i=0;i<8;i++) if(gp2x_dev[i]) close(gp2x_dev[i]); } //close all devices
fcloseall(); //close all files
}
-
+
void SetVideoScaling(int pixels,int width,int height)
{
float x, y;
- float xscale,yscale;
+ float xscale,yscale=0;
int bpp=(gp2x_memregs[0x28DA>>1]>>9)&0x3; /* bytes per pixel */
else if (gp2x_memregs[0x2818>>1] == 239) /* NTSC? */
yscale=(pixels*331.0)/320.0; /* Y-Scale with NTSC */
}
- else /* TV-Out OFF? */
+ else /* TV-Out OFF? */
{
xscale=1024.0; /* X-Scale for LCD */
yscale=pixels; /* Y-Scale for LCD */
\r
#include <fcntl.h>\r
#include <linux/fb.h>\r
-#include <pthread.h>\r
#include <signal.h>\r
#include <stdlib.h>\r
#include <stdio.h>\r
#define gp2x_1stcore_code_ptr(v) (&gp2x_dualcore_ram[(v)>>2])\r
#define gp2x_2ndcore_data_ptr(v) gp2x_2ndcore_code_ptr((v)+0x100000)\r
#define gp2x_1stcore_data_ptr(v) gp2x_1stcore_code_ptr((v)+0x100000)\r
- \r
+\r
#define gp2x_video_wait_vsync() while(gp2x_memregs[0x1182>>1]&(1<<4));\r
#define gp2x_video_wait_hsync() while(gp2x_memregs[0x1182>>1]&(1<<5));\r
\r
+++ /dev/null
-/* FCE Ultra - NES/Famicom Emulator
- *
- * Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
- *
- * 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 <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <linux/soundcard.h>
-
-#include "sdl.h"
-#include "minimal.h"
-
-#define GP2X_SOUND 1
-
-extern void pthread_yield(void);
-extern void FCEUI_FrameSkip(int x);
-
-//extern int dosound;
-extern int soundvol;
-
-// always have this call
-INLINE void gp2x_sound_frame(void *blah, void *buff, int samples)
- {
-}
-
-
-
-
-
-//static int sexy_in_function=0;
-#define NumSexyBufferBuffers 2
-struct timespec gp2x_sleep_ts;
-int firstentry=1;
-//int firstprint=1;
-struct timeval sleeptimer;
-
-
-
-pthread_t gp2x_sexy_sound_thread=0;
-int** SexyBufferBuffers=NULL;
-int SexyBufferBufferCounts[NumSexyBufferBuffers];
-int gp2x_sound_inited=0;
-int gp2x_in_sound_thread=0;
-extern unsigned long gp2x_dev[8];
-
-pthread_cond_t gp2x_sound_cond=PTHREAD_COND_INITIALIZER;
-pthread_mutex_t gp2x_sound_mutex = PTHREAD_MUTEX_INITIALIZER;
-int zzdebug01_entry=0;
-int zzdebug01_wait=0;
-int hasSound=0;
-extern unsigned long fps;
-extern unsigned long avg_fps;
-extern unsigned long ticks;
-
-int throttlecount=0;
-
-void WriteSound(int32 *Buffer, int Count)
- {
- write(gp2x_dev[3], Buffer, Count<<1);
- pthread_yield();
- SpeedThrottle();
- }
-
-void* gp2x_write_sound(void* blah)
- {
- gp2x_in_sound_thread=1;
- {
- if (hasSound)
- {
- hasSound=0;
- }
- else
- {
- }
-
- }
- gp2x_in_sound_thread=0;
- return NULL;
-}
-
-void SilenceSound(int n)
-{
- soundvol=0;
-}
-
-int InitSound(FCEUGI *gi)
-{
- Settings.sound=22050;
- FCEUI_Sound(Settings.sound);
- gp2x_sound_volume(soundvol, soundvol);
- printf("InitSound() sound_rate: %d\n", Settings.sound);
- if(firstentry)
- {
- firstentry=0;
- gp2x_sound_inited=1;
- }
- return 1 ;
-}
-
-uint32 GetMaxSound(void)
-{
- return(4096);
-}
-
-uint32 GetWriteSound(void)
- {
- return 1024;
-}
-
-int KillSound(void)
-{
- FCEUI_Sound(0);
- gp2x_sound_inited=0;
-
- return 1;
-}
-
-
-
-
int x;
fputc(type,st);
-
+
for(x=bsize=0;x<count;x++)
bsize+=sf[x].s&(~RLSB);
bsize+=count<<3;
if(sf[x].s&RLSB)
{
int z;
- for(z=(sf[x].s&(~RLSB))-1;z>=0;z--)
+ for(z=(sf[x].s&(~RLSB))-1;z>=0;z--)
*(uint8*)sf[x].v=fgetc(st);
}
else
// totalsize+=WriteStateChunk(st,4,SFCTLR,SFCTLRELEMENTS);
totalsize+=WriteStateChunk(st,5,SFSND,SFSNDELEMENTS);
totalsize+=WriteStateChunk(st,0x10,SFMDATA,SFEXINDEX);
-
+
fseek(st,4,SEEK_SET);
write32(totalsize,st);
SaveStateStatus[CurrentState]=1;
fread(&header,1,16,st);
if(memcmp(header,"FCS",3))
{
- fseek(st,0,SEEK_SET);
+ fseek(st,0,SEEK_SET);
if(!LoadStateOld(st))
goto lerror;
goto okload;
FILE *st=NULL;
int ssel;
- if(SaveStateStatus[0]==-1)
+ if(SaveStateStatus[0]==(char)-1)
for(ssel=0;ssel<10;ssel++)
{
st=fopen(FCEU_MakeFName(FCEUMKF_STATE,ssel,0),"rb");
int32 nada;
uint8 version;
nada=0;
-
+
StateBuffer=FCEU_malloc(59999);
if(StateBuffer==NULL)
return 0;
afread(&nada,1,1);
afread(&nada,1,1);
afread(&nada,1,1);
-
+
for(x=0;x<8;x++)
areadupper8of16((int8 *)&CHRBankList[x]);
afread(PRGBankList,4,1);
aread16((int8 *)&scanline);
aread16((int8 *)&RefreshAddr);
afread(&VRAMBuffer,1,1);
-
+
afread(&IRQa,1,1);
aread32((int8 *)&IRQCount);
aread32((int8 *)&IRQLatch);
{
nada=0;
afread(&nada,1,1);
- PPUCHRRAM|=(nada?1:0)<<x;
+ PPUCHRRAM|=(nada?1:0)<<x;
}
-
+
afread(mapbyte1,1,8);
afread(mapbyte2,1,8);
afread(mapbyte3,1,8);
afread(mapbyte4,1,8);
for(x=0;x<4;x++)
aread16((int8 *)&nada);
-
+
PPUNTARAM=0;
for(x=0;x<4;x++)
{
afread(&vtoggle,1,1);
aread16((int8 *)&TempAddrT);
aread16((int8 *)&RefreshAddrT);
-
+
if(GameStateRestore) GameStateRestore(version);
free(StateBuffer);
FixOldSaveStateSFreq();
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
- * Copyright (C) 1998 BERO
+ * Copyright (C) 1998 BERO
* Copyright (C) 2002 Ben Parnell
*
* This program is free software; you can redistribute it and/or modify
#endif
#include "types.h"
-#include "svga.h"
+#include "svga.h"
#include "fce.h"
#include "general.h"
#include "video.h"
void FCEUI_SelectState(int w)
{
- if(netplay!=2 && FCEUGameInfo.type!=GIT_NSF)
+ if(netplay!=2 && FCEUGameInfo.type!=GIT_NSF)
CommandQueue=42+w;
}
void FCEUI_LoadState(void)
{
- if(netplay!=2 && FCEUGameInfo.type!=GIT_NSF)
+ if(netplay!=2 && FCEUGameInfo.type!=GIT_NSF)
CommandQueue=41;
}
case DES_NSFINC:NSFControl(1);break;
case DES_NSFDEC:NSFControl(2);break;
- case DES_NSFRES:NSFControl(0);break;
+ case DES_NSFRES:NSFControl(0);break;
case DES_VSUNIDIPSET:CommandQueue=10+(int)d;break;
case DES_VSUNITOGGLEDIPVIEW:CommandQueue=10;break;
which=controlselect==1?ntschue:ntsctint;
which--;
if(which<0) which=0;
- if(controlselect==1)
- ntschue=which;
- else ntsctint=which;
+ if(controlselect==1)
+ ntschue=which;
+ else ntsctint=which;
CalculatePalette();
}
controllength=360;
}
}
break;
- case DES_NTSCINC:
+ case DES_NTSCINC:
if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF)
if(controlselect)
{
uint32 r,g,b;
int x;
- /* If it's not forced(only forced when the palette changes),
- don't waste cpu time if the same deemphasis bits are set as the last call.
+ /* If it's not forced(only forced when the palette changes),
+ don't waste cpu time if the same deemphasis bits are set as the last call.
*/
- if(!force)
+ if(!force)
{
- if(d==lastd)
+ if(d==lastd)
return;
}
else /* Only set this when palette has changed. */
FCEUD_SetPalette(x|0xC0,m,n,o);
}
-
+
lastd=d;
}
static uint8 br1[4]={6,9,12,12};
static double br2[4]={.29,.45,.73,.9};
static double br3[4]={0,.24,.47,.77};
-
+
for(x=0;x<=3;x++)
for(z=0;z<16;z++)
{
s=(double)TINTVAL;
y=(double)br2[x];
if(z==0) {s=0;y=((double)br1[x])/12;}
-
+
if(z>=13)
{
s=y=0;
if(z==13)
- y=(double)br3[x];
+ y=(double)br3[x];
}
theta=(double)M_PI*(double)(((double)cols[z]*10+HUEVAL)/(double)180);
r=(int)(((double)y+(double)s*(double)sin(theta))*(double)256);
g=(int)(((double)y-(double)((double)27/(double)53)*s*(double)sin(theta)+(double)((double)10/(double)53)*s*cos(theta))*(double)256);
- b=(int)(((double)y-(double)s*(double)cos(theta))*(double)256);
+ b=(int)(((double)y-(double)s*(double)cos(theta))*(double)256);
// TODO: Fix RGB to compensate for phosphor changes(add to red??).
if(r<0) r=0;
if(g<0) g=0;
if(b<0) b=0;
-
+
paletten[(x<<4)+z].r=r;
paletten[(x<<4)+z].g=g;
paletten[(x<<4)+z].b=b;
}
}
else
- {
+ {
/* Save snapshot before overlay stuff is written. */
if(dosnapsave)
{
ReallySnap();
dosnapsave=0;
}
- if(FCEUGameInfo.type==GIT_VSUNI && DIPS&2)
+ if(FCEUGameInfo.type==GIT_VSUNI && DIPS&2)
DrawDips();
if(StateShow) DrawState();
if(controllength) {controllength--;DrawBars();}
static void ChoosePalette(void)
{
if(FCEUGameInfo.type==GIT_NSF)
- palo=NSFPalette;
+ palo=NSFPalette;
else if(ipalette)
palo=palettei;
else if(ntsccol && !PAL && FCEUGameInfo.type!=GIT_VSUNI)
CalculatePalette();
}
else
- palo=palpoint[pale];
+ palo=palpoint[pale];
}
void WritePalette(void)
if(FCEUGameInfo.type==GIT_NSF)
{
for(x=0;x<39;x++)
- FCEUD_SetPalette(x,palo[x].r,palo[x].g,palo[x].b);
+ FCEUD_SetPalette(x,palo[x].r,palo[x].g,palo[x].b);
}
else
{