some warnings fixed, nsf fixed, palettes, more code backported
authornotaz <notasas@gmail.com>
Mon, 30 Apr 2007 21:16:00 +0000 (21:16 +0000)
committernotaz <notasas@gmail.com>
Mon, 30 Apr 2007 21:16:00 +0000 (21:16 +0000)
git-svn-id: file:///home/notaz/opt/svn/fceu@120 be3aeb3a-fb24-0410-a615-afba39da0efa

40 files changed:
Makefile.base
Makefile.gp2x
boards/n106.c
cart.c
cheat.c
cheat.h
drawing.h
driver.h
drivers/common/cheat.c
drivers/common/cheat.h
fce.c
general.c
general.h
ines.c
input/share.h
mappers/217.c
mappers/85.c
memory.c
memory.h
movie.c
movie.h
nsf.c
palette.c [new file with mode: 0644]
palette.h
palettes/nsfnew.h [deleted file]
palettes/palettes.h
palettes/rp2c04001.old [deleted file]
palettes/vscv.h [deleted file]
palettes/vseb.h [deleted file]
palettes/vsgoonies.h [deleted file]
palettes/vsgrad.h [deleted file]
palettes/vsmar.h [deleted file]
palettes/vsplatoon.h [deleted file]
palettes/vsslalom.h [deleted file]
palettes/vssmb.h [deleted file]
sound.c
svga.c
svga.h
video.c
x6502.c

index be38984..756e55c 100644 (file)
@@ -1,5 +1,5 @@
 CFLAGS  = -Wall  ${TFLAGS}
 CFLAGS  = -Wall  ${TFLAGS}
-OBJECTS = fce.o video.o general.o endian.o svga.o sound.o nsf.o fds.o netplay.o ines.o state.o unif.o input.o file.o cart.o crc32.o memory.o cheat.o debug.o md5.o vsuni.o
+OBJECTS = fce.o video.o general.o endian.o svga.o sound.o nsf.o fds.o netplay.o ines.o state.o unif.o input.o file.o cart.o crc32.o memory.o cheat.o debug.o md5.o vsuni.o palette.o
 # x6502.o
 
 fceu:          fceu2
 # x6502.o
 
 fceu:          fceu2
index 8b1d55f..af7d4ae 100644 (file)
@@ -2,7 +2,7 @@ CROSS   = arm-linux-
 CC     = $(CROSS)gcc
 STRIP  = $(CROSS)strip
 AS     = $(CROSS)as
 CC     = $(CROSS)gcc
 STRIP  = $(CROSS)strip
 AS     = $(CROSS)as
-TFLAGS  = -Winline -mcpu=arm920t -Izlib -DGP2X=1 -DLSB_FIRST -DUNIX -DPSS_STYLE=1 -DZLIB -DFRAMESKIP -D_REENTRANT
+TFLAGS  = -Winline -mcpu=arm920t -Izlib -DGP2X=1 -DLSB_FIRST -DUNIX -DPSS_STYLE=1 -DHAVE_ASPRINTF -DZLIB -DFRAMESKIP -D_REENTRANT
 ASFLAGS        = -mcpu=arm920t -mfloat-abi=soft
 RM     = rm -f
 B      = drivers/gp2x/
 ASFLAGS        = -mcpu=arm920t -mfloat-abi=soft
 RM     = rm -f
 B      = drivers/gp2x/
index 2872d16..6ccfe2b 100644 (file)
@@ -229,7 +229,7 @@ static void NamcoSoundHack(void)
 #endif
   z=((SOUNDTS<<16)/soundtsinc)>>4;
   a=z-dwave;
 #endif
   z=((SOUNDTS<<16)/soundtsinc)>>4;
   a=z-dwave;
-  if(a) DoNamcoSound(&Wave[dwave], a);
+  if(a) DoNamcoSound((int32 *)&Wave[dwave], a);
   dwave+=a;
 }
 
   dwave+=a;
 }
 
@@ -238,7 +238,7 @@ static void NamcoSound(int Count)
   int32 z,a;
   z=((SOUNDTS<<16)/soundtsinc)>>4;
   a=z-dwave;
   int32 z,a;
   z=((SOUNDTS<<16)/soundtsinc)>>4;
   a=z-dwave;
-  if(a) DoNamcoSound(&Wave[dwave], a);
+  if(a) DoNamcoSound((int32 *)&Wave[dwave], a);
   dwave=0;
 }
 
   dwave=0;
 }
 
diff --git a/cart.c b/cart.c
index f888397..ff9aceb 100644 (file)
--- a/cart.c
+++ b/cart.c
@@ -453,6 +453,7 @@ void OpenGenie(void)
 
   fn=FCEU_MakeFName(FCEUMKF_GGROM,0,0);
   fp=fopen(fn,"rb");
 
   fn=FCEU_MakeFName(FCEUMKF_GGROM,0,0);
   fp=fopen(fn,"rb");
+  free(fn);
   if(!fp)
   {
    FCEU_PrintError("Error opening Game Genie ROM image!");
   if(!fp)
   {
    FCEU_PrintError("Error opening Game Genie ROM image!");
diff --git a/cheat.c b/cheat.c
index d789d74..2fba4f4 100644 (file)
--- a/cheat.c
+++ b/cheat.c
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
- *  Copyright (C) 2002 Ben Parnell
+ *  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
  *
  * 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
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <ctype.h>
 
 #include "types.h"
 #include "x6502.h"
 #include "cheat.h"
 #include "fce.h"
 
 #include "types.h"
 #include "x6502.h"
 #include "cheat.h"
 #include "fce.h"
-#include "svga.h"
 #include "general.h"
 #include "cart.h"
 #include "memory.h"
 
 #include "general.h"
 #include "cart.h"
 #include "memory.h"
 
+#include "file.h"
+#include "svga.h"
+
 static uint8 *CheatRPtrs[64];
 
 void FCEU_CheatResetRAM(void)
 {
  int x;
 
 static uint8 *CheatRPtrs[64];
 
 void FCEU_CheatResetRAM(void)
 {
  int x;
 
- for(x=0;x<64;x++) 
+ for(x=0;x<64;x++)
   CheatRPtrs[x]=0;
 }
 
   CheatRPtrs[x]=0;
 }
 
@@ -56,9 +59,21 @@ struct CHEATF {
            char *name;
            uint16 addr;
            uint8 val;
            char *name;
            uint16 addr;
            uint8 val;
+          int compare; /* -1 for no compare. */
+          int type;    /* 0 for replace, 1 for substitute(GG). */
           int status;
 };
 
           int status;
 };
 
+typedef struct {
+       uint16 addr;
+       uint8 val;
+       int compare;
+       readfunc PrevRead;
+} CHEATF_SUBFAST;
+
+
+static CHEATF_SUBFAST SubCheats[256];
+static int numsubcheats=0;
 struct CHEATF *cheats=0,*cheatsl=0;
 
 
 struct CHEATF *cheats=0,*cheatsl=0;
 
 
@@ -69,18 +84,79 @@ struct CHEATF *cheats=0,*cheatsl=0;
 static uint16 *CheatComp=0;
 static int savecheats;
 
 static uint16 *CheatComp=0;
 static int savecheats;
 
-static int AddCheatEntry(char *name, uint32 addr, uint8 val, int status);
+static DECLFR(SubCheatsRead)
+{
+ CHEATF_SUBFAST *s=SubCheats;
+ int x=numsubcheats;
+
+ do
+ {
+  if(s->addr==A)
+  {
+   if(s->compare>=0)
+   {
+    uint8 pv=s->PrevRead(A);
+
+    if(pv==s->compare)
+     return(s->val);
+    else return(pv);
+   }
+   else return(s->val);
+  }
+  s++;
+ } while(--x);
+ return(0);    /* We should never get here. */
+}
+
+void RebuildSubCheats(void)
+{
+ int x;
+ struct CHEATF *c=cheats;
+
+ for(x=0;x<numsubcheats;x++)
+  SetReadHandler(SubCheats[x].addr,SubCheats[x].addr,SubCheats[x].PrevRead);
+
+ numsubcheats=0;
+ while(c)
+ {
+  if(c->type==1 && c->status)
+  {
+   if(GetReadHandler(c->addr)==SubCheatsRead)
+   {
+    /* Prevent a catastrophe by this check. */
+    //FCEU_DispMessage("oops");
+   }
+   else
+   {
+    SubCheats[numsubcheats].PrevRead=GetReadHandler(c->addr);
+    SubCheats[numsubcheats].addr=c->addr;
+    SubCheats[numsubcheats].val=c->val;
+    SubCheats[numsubcheats].compare=c->compare;
+    SetReadHandler(c->addr,c->addr,SubCheatsRead);
+    numsubcheats++;
+   }
+  }
+  c=c->next;
+ }
+}
 
 
+void FCEU_PowerCheats()
+{
+ numsubcheats=0;       /* Quick hack to prevent setting of ancient read addresses. */
+ RebuildSubCheats();
+}
+
+static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type);
 static void CheatMemErr(void)
 {
  FCEUD_PrintError("Error allocating memory for cheat data.");
 }
 
 /* This function doesn't allocate any memory for "name" */
 static void CheatMemErr(void)
 {
  FCEUD_PrintError("Error allocating memory for cheat data.");
 }
 
 /* This function doesn't allocate any memory for "name" */
-static int AddCheatEntry(char *name, uint32 addr, uint8 val, int status)
+static int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type)
 {
  struct CHEATF *temp;
 {
  struct CHEATF *temp;
- if(!(temp=malloc(sizeof(struct CHEATF))))
+ if(!(temp=(struct CHEATF *)malloc(sizeof(struct CHEATF))))
  {
   CheatMemErr();
   return(0);
  {
   CheatMemErr();
   return(0);
@@ -89,7 +165,8 @@ static int AddCheatEntry(char *name, uint32 addr, uint8 val, int status)
  temp->addr=addr;
  temp->val=val;
  temp->status=status;
  temp->addr=addr;
  temp->val=val;
  temp->status=status;
-
+ temp->compare=compare;
+ temp->type=type;
  temp->next=0;
 
  if(cheats)
  temp->next=0;
 
  if(cheats)
@@ -103,80 +180,113 @@ static int AddCheatEntry(char *name, uint32 addr, uint8 val, int status)
  return(1);
 }
 
  return(1);
 }
 
-void LoadGameCheats(void)
+void FCEU_LoadGameCheats(FILE *override)
 {
  FILE *fp;
 {
  FILE *fp;
- char *name=0;
  unsigned int addr;
  unsigned int val;
  unsigned int status;
  unsigned int addr;
  unsigned int val;
  unsigned int status;
+ unsigned int type;
+ unsigned int compare;
  int x;
 
  int x;
 
- char linebuf[256+4+2+2+1+1]; /* 256 for name, 4 for address, 2 for value, 2 for semicolons, 1 for status, 1 for null */
- char namebuf[257];
+ char linebuf[2048];
+ char *namebuf;
  int tc=0;
  int tc=0;
+ char *fn;
+
+ numsubcheats=savecheats=0;
+
+ if(override)
+  fp = override;
+ else
+ {
+  fn=FCEU_MakeFName(FCEUMKF_CHEAT,0,0);
+  fp=FCEUD_UTF8fopen(fn,"rb");
+  free(fn);
+  if(!fp) return;
+ }
 
 
- savecheats=0;
- if(!(fp=fopen(FCEU_MakeFName(FCEUMKF_CHEAT,0,0),"rb")))
-  return;
- while(fgets(linebuf,256+4+2+2+1+1,fp)>0)
- { 
-  addr=val=status=0;
-  namebuf[0]=0; // If the cheat doesn't have a name...
-  if(linebuf[0]==':')  
+ while(fgets(linebuf,2048,fp)>0)
+ {
+  char *tbuf=linebuf;
+  int doc=0;
+
+  addr=val=compare=status=type=0;
+
+  if(tbuf[0]=='S')
   {
   {
-   strncpy(namebuf,&linebuf[1+4+2+2],257);
-   if(sscanf(&linebuf[1],"%04x%*[:]%02x",&addr,&val)!=2)
-    continue;
+   tbuf++;
+   type=1;
+  }
+  else type=0;
+
+  if(tbuf[0]=='C')
+  {
+   tbuf++;
+   doc=1;
+  }
+
+  if(tbuf[0]==':')
+  {
+   tbuf++;
    status=0;
   }
    status=0;
   }
+  else status=1;
+
+  if(doc)
+  {
+   char *neo=&tbuf[4+2+2+1+1+1];
+   if(sscanf(tbuf,"%04x%*[:]%02x%*[:]%02x",&addr,&val,&compare)!=3)
+    continue;
+   namebuf=malloc(strlen(neo)+1);
+   strcpy(namebuf,neo);
+  }
   else
   {
   else
   {
-   strncpy(namebuf,&linebuf[4+2+2],257);
-   if(sscanf(linebuf,"%04x%*[:]%02x",&addr,&val)!=2) continue;
-   status=1;
+   char *neo=&tbuf[4+2+1+1];
+   if(sscanf(tbuf,"%04x%*[:]%02x",&addr,&val)!=2)
+    continue;
+   namebuf=malloc(strlen(neo)+1);
+   strcpy(namebuf,neo);
   }
   }
-  for(x=0;x<257;x++)
+
+  for(x=0;x<strlen(namebuf);x++)
   {
    if(namebuf[x]==10 || namebuf[x]==13)
    {
     namebuf[x]=0;
     break;
    }
   {
    if(namebuf[x]==10 || namebuf[x]==13)
    {
     namebuf[x]=0;
     break;
    }
+   else if(namebuf[x]<0x20) namebuf[x]=' ';
   }
   }
-  namebuf[256]=0;
-  if(!(name=malloc(strlen(namebuf)+1)))
-   CheatMemErr();
-  else
-  {
-   strcpy(name,namebuf);
-   AddCheatEntry(name,addr,val,status);
-   tc++;
-  }
+
+  AddCheatEntry(namebuf,addr,val,doc?compare:-1,status,type);
+  tc++;
  }
  }
- fclose(fp);
+ RebuildSubCheats();
+ if(!override)
+  fclose(fp);
 }
 
 }
 
-
-void FlushGameCheats(void)
+void FCEU_FlushGameCheats(FILE *override, int nosave)
 {
  if(CheatComp)
  {
   free(CheatComp);
   CheatComp=0;
  }
 {
  if(CheatComp)
  {
   free(CheatComp);
   CheatComp=0;
  }
-
- if(!savecheats)
+ if((!savecheats || nosave) && !override)      /* Always save cheats if we're being overridden. */
  {
   if(cheats)
   {
    struct CHEATF *next=cheats;
    for(;;)
  {
   if(cheats)
   {
    struct CHEATF *next=cheats;
    for(;;)
-   {  
+   {
+    struct CHEATF *last=next;
     next=next->next;
     next=next->next;
-    free(cheats->name);
-    free(cheats);
+    free(last->name);
+    free(last);
     if(!next) break;
    }
    cheats=cheatsl=0;
     if(!next) break;
    }
    cheats=cheatsl=0;
@@ -184,53 +294,80 @@ void FlushGameCheats(void)
  }
  else
  {
  }
  else
  {
+  char *fn = 0;
+
+  if(!override)
+   fn = FCEU_MakeFName(FCEUMKF_CHEAT,0,0);
+
   if(cheats)
   {
    struct CHEATF *next=cheats;
    FILE *fp;
   if(cheats)
   {
    struct CHEATF *next=cheats;
    FILE *fp;
-   if((fp=fopen(FCEU_MakeFName(FCEUMKF_CHEAT,0,0),"wb")))
+
+   if(override)
+    fp = override;
+   else
+    fp=FCEUD_UTF8fopen(fn,"wb");
+
+   if(fp)
    {
     for(;;)
     {
      struct CHEATF *t;
    {
     for(;;)
     {
      struct CHEATF *t;
-     if(next->status)
-      fprintf(fp,"%04x:%02x:%s\n",next->addr,next->val,next->name);
+     if(next->type)
+      fputc('S',fp);
+     if(next->compare>=0)
+      fputc('C',fp);
+
+     if(!next->status)
+      fputc(':',fp);
+
+     if(next->compare>=0)
+      fprintf(fp,"%04x:%02x:%02x:%s\n",next->addr,next->val,next->compare,next->name);
      else
      else
-      fprintf(fp,":%04x:%02x:%s\n",next->addr,next->val,next->name);
+      fprintf(fp,"%04x:%02x:%s\n",next->addr,next->val,next->name);
+
      free(next->name);
      t=next;
      next=next->next;
      free(t);
      if(!next) break;
     }
      free(next->name);
      t=next;
      next=next->next;
      free(t);
      if(!next) break;
     }
-    fclose(fp);
+    if(!override)
+     fclose(fp);
    }
    else
     FCEUD_PrintError("Error saving cheats.");
    cheats=cheatsl=0;
   }
    }
    else
     FCEUD_PrintError("Error saving cheats.");
    cheats=cheatsl=0;
   }
-  else
-   remove(FCEU_MakeFName(FCEUMKF_CHEAT,0,0));
+  else if(!override)
+   remove(fn);
+  if(!override)
+   free(fn);
  }
  }
+
+ RebuildSubCheats();  /* Remove memory handlers. */
+
 }
 
 
 }
 
 
-int FCEUI_AddCheat(char *name, uint32 addr, uint8 val)
+int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type)
 {
  char *t;
 
 {
  char *t;
 
- if(!(t=malloc(strlen(name)+1)))
+ if(!(t=(char *)malloc(strlen(name)+1)))
  {
   CheatMemErr();
   return(0);
  }
  strcpy(t,name);
  {
   CheatMemErr();
   return(0);
  }
  strcpy(t,name);
- if(!AddCheatEntry(t,addr,val,1))
+ if(!AddCheatEntry(t,addr,val,compare,1,type))
  {
   free(t);
   return(0);
  }
  savecheats=1;
  {
   free(t);
   return(0);
  }
  savecheats=1;
+ RebuildSubCheats();
  return(1);
 }
 
  return(1);
 }
 
@@ -262,7 +399,7 @@ int FCEUI_DelCheat(uint32 which)
      cheats=cheatsl=0;  // No (more) cheats.
    }
    free(cur->name);     // Now that all references to this cheat are removed,
      cheats=cheatsl=0;  // No (more) cheats.
    }
    free(cur->name);     // Now that all references to this cheat are removed,
-   free(cur);           // free the memory.   
+   free(cur);           // free the memory.
    break;
   }                     // *END REMOVE THIS CHEAT*
 
    break;
   }                     // *END REMOVE THIS CHEAT*
 
@@ -275,17 +412,19 @@ int FCEUI_DelCheat(uint32 which)
  }
 
  savecheats=1;
  }
 
  savecheats=1;
+ RebuildSubCheats();
+
  return(1);
 }
 
  return(1);
 }
 
-void ApplyPeriodicCheats(void)
+void FCEU_ApplyPeriodicCheats(void)
 {
  struct CHEATF *cur=cheats;
  if(!cur) return;
 
  for(;;)
  {
 {
  struct CHEATF *cur=cheats;
  if(!cur) return;
 
  for(;;)
  {
-  if(cur->status)
+  if(cur->status && !(cur->type))
    if(CheatRPtrs[cur->addr>>10])
     CheatRPtrs[cur->addr>>10][cur->addr]=cur->val;
   if(cur->next)
    if(CheatRPtrs[cur->addr>>10])
     CheatRPtrs[cur->addr>>10][cur->addr]=cur->val;
   if(cur->next)
@@ -296,18 +435,18 @@ void ApplyPeriodicCheats(void)
 }
 
 
 }
 
 
-void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int s))
+void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data), void *data)
 {
   struct CHEATF *next=cheats;
 
   while(next)
   {
 {
   struct CHEATF *next=cheats;
 
   while(next)
   {
-   if(!callb(next->name,next->addr,next->val,next->status)) break;
+   if(!callb(next->name,next->addr,next->val,next->compare,next->status,next->type,data)) break;
    next=next->next;
   }
 }
 
    next=next->next;
   }
 }
 
-int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *s)
+int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *compare, int *s, int *type)
 {
  struct CHEATF *next=cheats;
  uint32 x=0;
 {
  struct CHEATF *next=cheats;
  uint32 x=0;
@@ -319,12 +458,15 @@ int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *s)
    if(name)
     *name=next->name;
    if(a)
    if(name)
     *name=next->name;
    if(a)
-    *a=next->addr; 
+    *a=next->addr;
    if(v)
     *v=next->val;
    if(s)
     *s=next->status;
    if(v)
     *v=next->val;
    if(s)
     *s=next->status;
-
+   if(compare)
+    *compare=next->compare;
+   if(type)
+    *type=next->type;
    return(1);
   }
   next=next->next;
    return(1);
   }
   next=next->next;
@@ -333,10 +475,116 @@ int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *s)
  return(0);
 }
 
  return(0);
 }
 
+static int GGtobin(char c)
+{
+ static char lets[16]={'A','P','Z','L','G','I','T','Y','E','O','X','U','K','S','V','N'};
+ int x;
+
+ for(x=0;x<16;x++)
+  if(lets[x] == toupper(c)) return(x);
+ return(0);
+}
+
+/* Returns 1 on success, 0 on failure. Sets *a,*v,*c. */
+int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c)
+{
+ uint16 A;
+ uint8 V,C;
+ uint8 t;
+ int s;
+
+ A=0x8000;
+ V=0;
+ C=0;
+
+ s=strlen(str);
+ if(s!=6 && s!=8) return(0);
+
+ t=GGtobin(*str++);
+ V|=(t&0x07);
+ V|=(t&0x08)<<4;
+
+ t=GGtobin(*str++);
+ V|=(t&0x07)<<4;
+ A|=(t&0x08)<<4;
+
+ t=GGtobin(*str++);
+ A|=(t&0x07)<<4;
+ //if(t&0x08) return(0);       /* 8-character code?! */
+
+ t=GGtobin(*str++);
+ A|=(t&0x07)<<12;
+ A|=(t&0x08);
+
+ t=GGtobin(*str++);
+ A|=(t&0x07);
+ A|=(t&0x08)<<8;
+
+ if(s==6)
+ {
+  t=GGtobin(*str++);
+  A|=(t&0x07)<<8;
+  V|=(t&0x08);
+
+  *a=A;
+  *v=V;
+  *c=-1;
+  return(1);
+ }
+ else
+ {
+  t=GGtobin(*str++);
+  A|=(t&0x07)<<8;
+  C|=(t&0x08);
+
+  t=GGtobin(*str++);
+  C|=(t&0x07);
+  C|=(t&0x08)<<4;
+
+  t=GGtobin(*str++);
+  C|=(t&0x07)<<4;
+  V|=(t&0x08);
+  *a=A;
+  *v=V;
+  *c=C;
+  return(1);
+ }
+ return(0);
+}
+
+int FCEUI_DecodePAR(const char *str, uint16 *a, uint8 *v, int *c, int *type)
+{
+ int boo[4];
+ if(strlen(str)!=8) return(0);
+
+ sscanf(str,"%02x%02x%02x%02x",boo,boo+1,boo+2,boo+3);
+
+ *c=-1;
+
+ if(1)
+ {
+  *a=(boo[3]<<8)|(boo[2]+0x7F);
+  *v=0;
+ }
+ else
+ {
+  *v=boo[3];
+  *a=boo[2]|(boo[1]<<8);
+ }
+ /* Zero-page addressing modes don't go through the normal read/write handlers in FCEU, so
+    we must do the old hacky method of RAM cheats.
+ */
+ if(*a<0x0100)
+  *type=0;
+ else
+  *type=1;
+ return(1);
+}
+
 /* name can be NULL if the name isn't going to be changed. */
 /* same goes for a, v, and s(except the values of each one must be <0) */
 
 /* name can be NULL if the name isn't going to be changed. */
 /* same goes for a, v, and s(except the values of each one must be <0) */
 
-int FCEUI_SetCheat(uint32 which, char *name, int32 a, int32 v, int s)
+int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare,int s, int type)
 {
  struct CHEATF *next=cheats;
  uint32 x=0;
 {
  struct CHEATF *next=cheats;
  uint32 x=0;
@@ -349,7 +597,7 @@ int FCEUI_SetCheat(uint32 which, char *name, int32 a, int32 v, int s)
    {
     char *t;
 
    {
     char *t;
 
-    if((t=realloc(next->name,strlen(name+1))))
+    if((t=(char *)realloc(next->name,strlen(name+1))))
     {
      next->name=t;
      strcpy(next->name,name);
     {
      next->name=t;
      strcpy(next->name,name);
@@ -363,7 +611,12 @@ int FCEUI_SetCheat(uint32 which, char *name, int32 a, int32 v, int s)
     next->val=v;
    if(s>=0)
     next->status=s;
     next->val=v;
    if(s>=0)
     next->status=s;
+   next->compare=compare;
+   next->type=type;
+
    savecheats=1;
    savecheats=1;
+   RebuildSubCheats();
+
    return(1);
   }
   next=next->next;
    return(1);
   }
   next=next->next;
@@ -372,12 +625,33 @@ int FCEUI_SetCheat(uint32 which, char *name, int32 a, int32 v, int s)
  return(0);
 }
 
  return(0);
 }
 
+/* Convenience function. */
+int FCEUI_ToggleCheat(uint32 which)
+{
+ struct CHEATF *next=cheats;
+ uint32 x=0;
+
+ while(next)
+ {
+  if(x==which)
+  {
+   next->status=!next->status;
+   savecheats=1;
+   RebuildSubCheats();
+   return(next->status);
+  }
+  next=next->next;
+  x++;
+ }
+
+ return(-1);
+}
 
 static int InitCheatComp(void)
 {
  uint32 x;
 
 
 static int InitCheatComp(void)
 {
  uint32 x;
 
- CheatComp=malloc(65536*sizeof(uint16));
+ CheatComp=(uint16*)malloc(65536*sizeof(uint16));
  if(!CheatComp)
  {
   CheatMemErr();
  if(!CheatComp)
  {
   CheatMemErr();
@@ -385,7 +659,7 @@ static int InitCheatComp(void)
  }
  for(x=0;x<65536;x++)
   CheatComp[x]=CHEATC_NONE;
  }
  for(x=0;x<65536;x++)
   CheatComp[x]=CHEATC_NONE;
+
  return(1);
 }
 
  return(1);
 }
 
@@ -426,7 +700,7 @@ int32 FCEUI_CheatSearchGetCount(void)
 }
 /* This function will give the initial value of the search and the current value at a location. */
 
 }
 /* This function will give the initial value of the search and the current value at a location. */
 
-void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current))
+void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void *data),void *data)
 {
   uint32 x;
 
 {
   uint32 x;
 
@@ -439,7 +713,7 @@ void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current))
 
   for(x=0;x<0x10000;x++)
    if(!(CheatComp[x]&CHEATC_NOSHOW) && CheatRPtrs[x>>10])
 
   for(x=0;x<0x10000;x++)
    if(!(CheatComp[x]&CHEATC_NOSHOW) && CheatRPtrs[x>>10])
-    if(!callb(x,CheatComp[x],CheatRPtrs[x>>10][x]))
+    if(!callb(x,CheatComp[x],CheatRPtrs[x>>10][x],data))
      break;
 }
 
      break;
 }
 
@@ -550,7 +824,7 @@ void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2)
  }
  else if(type==3)                          // Any change.
  {
  }
  else if(type==3)                          // Any change.
  {
-  for(x=0x000;x<0x10000;x++)
+  for(x=0;x<0x10000;x++)
    if(!(CheatComp[x]&CHEATC_NOSHOW))
    {
     if(CheatComp[x]!=CheatRPtrs[x>>10][x])
    if(!(CheatComp[x]&CHEATC_NOSHOW))
    {
     if(CheatComp[x]!=CheatRPtrs[x>>10][x])
@@ -560,6 +834,25 @@ void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2)
     else
      CheatComp[x]|=CHEATC_EXCLUDED;
    }
     else
      CheatComp[x]|=CHEATC_EXCLUDED;
    }
-
  }
  }
+ else if(type==4)                         // Value decreased.
+ {
+  for(x=0;x<0x10000;x++)
+   if(!(CheatComp[x]&CHEATC_NOSHOW))
+   {
+    if(!(CheatRPtrs[x>>10][x]<CheatComp[x]))
+     CheatComp[x]|=CHEATC_EXCLUDED;
+   }
+ }
+ else if(type==5)                         // Value increased.
+ {
+  for(x=0;x<0x10000;x++)
+   if(!(CheatComp[x]&CHEATC_NOSHOW))
+   {
+    if(!(CheatRPtrs[x>>10][x]>CheatComp[x]))
+     CheatComp[x]|=CHEATC_EXCLUDED;
+   }
+ }
+ if(type>4)
+  FCEUI_CheatSearchSetCurrentAsOriginal();
 }
 }
diff --git a/cheat.h b/cheat.h
index e930f52..c951d82 100644 (file)
--- a/cheat.h
+++ b/cheat.h
@@ -1,6 +1,7 @@
 void FCEU_CheatResetRAM(void);
 void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p);
 
 void FCEU_CheatResetRAM(void);
 void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p);
 
-void LoadGameCheats(void);
-void FlushGameCheats(void);
-void ApplyPeriodicCheats(void);
+void FCEU_LoadGameCheats(FILE *override);
+void FCEU_FlushGameCheats(FILE *override, int nosave);
+void FCEU_ApplyPeriodicCheats(void);
+void FCEU_PowerCheats(void);
index 31a8208..22506a3 100644 (file)
--- a/drawing.h
+++ b/drawing.h
@@ -1,36 +1,19 @@
-static void DrawDips(void)
+void DrawTextLineBG(uint8 *dest)
 {
 {
-  uint32 *dest;
-  int y,x;
-
-  dest=(uint32 *)(XBuf+320*12+164);
-  for(y=24;y;y--,dest+=(320-72)>>2)
-  {
-   for(x=72>>2;x;x--,dest++)
-    *dest=0x80808080;
-  }
-
-  dest=(uint32 *)(XBuf+320*(12+4)+164+6 );
-  for(y=16;y;y--,dest+=(320>>2)-16)
-   for(x=8;x;x--)
-   {
-    *dest=0x81818181;
-    dest+=2;
-   }
-
-  dest=(uint32 *)(XBuf+320*(12+4)+164+6 );
-  for(x=0;x<8;x++,dest+=2)
-  {
-   uint32 *da=dest+(320>>2);
-
-   if(!((vsdip>>x)&1))
-    da+=(320>>2)*10;
-
-   for(y=4;y;y--,da+=320>>2)
-    *da=0x80808080;
+ int x,y;
+ static int otable[7]={81,49,30,17,8,3,0};
+        //100,40,15,10,7,5,2};
+ for(y=0;y<14;y++)
+ {
+  int offs;
 
 
-  }
-}
+  if(y>=7) offs=otable[13-y];
+  else offs=otable[y];   
+          
+  for(x=offs;x<(256-offs);x++)
+   dest[y*256+x]=(dest[y*256+x]&0x0f)|0xC0;//&=0xe0; //0x80;
+ }
+}       
 
 static void DrawMessage(void)
 {
 
 static void DrawMessage(void)
 {
@@ -38,26 +21,15 @@ static void DrawMessage(void)
   {
    uint8 *t;
    howlong--;
   {
    uint8 *t;
    howlong--;
-   t=XBuf+(FSettings.LastSLine-29)*320+32;
+   t=XBuf+(FSettings.LastSLine-16)*256;
    if(t>=XBuf)
    if(t>=XBuf)
-    DrawTextTrans(t,320,(uint8 *)errmsg,132);
+   {
+    DrawTextLineBG(t);
+    DrawTextTrans(t+256*3+(128-strlen(errmsg)*4),256,(uint8 *)errmsg,4);
+   }
   }
 }
 
   }
 }
 
-uint8 sstat[2541] =
-{
-0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,
-0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
-0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
-0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x81,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
-0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
-0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,
-0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,
-0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
-0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
-0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
-};
-
 uint8 fontdata2[2048] =
 {
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x1c,0x3e,0x1c,0x7f,0x7f,0x3e,0x1c,0x3e,0x08,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x3e,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xf0,0xe0,0xf0,0xbe,0x33,0x33,0x33,0x1e,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0xfc,0xcc,0xfc,0x0c,0x0c,0x0e,0x0f,0x07,0xfe,0xc6,0xfe,0xc6,0xc6,0xe6,0x67,0x03,0x99,0x5a,0x3c,0xe7,0xe7,0x3c,0x5a,0x99,0x01,0x07,0x1f,0x7f,0x1f,0x07,0x01,0x00,0x40,0x70,0x7c,0x7f,0x7c,0x70,0x40,0x00,0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0xfe,0xdb,0xdb,0xde,0xd8,0xd8,0xd8,0x00,0x7c,0xc6,0x1c,0x36,0x36,0x1c,0x33,0x1e,0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x18,0x30,0x7f,0x30,0x18,0x00,0x00,0x00,0x0c,0x06,0x7f,0x06,0x0c,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x7f,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00,
 uint8 fontdata2[2048] =
 {
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x1c,0x3e,0x1c,0x7f,0x7f,0x3e,0x1c,0x3e,0x08,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x3e,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xf0,0xe0,0xf0,0xbe,0x33,0x33,0x33,0x1e,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0xfc,0xcc,0xfc,0x0c,0x0c,0x0e,0x0f,0x07,0xfe,0xc6,0xfe,0xc6,0xc6,0xe6,0x67,0x03,0x99,0x5a,0x3c,0xe7,0xe7,0x3c,0x5a,0x99,0x01,0x07,0x1f,0x7f,0x1f,0x07,0x01,0x00,0x40,0x70,0x7c,0x7f,0x7c,0x70,0x40,0x00,0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0xfe,0xdb,0xdb,0xde,0xd8,0xd8,0xd8,0x00,0x7c,0xc6,0x1c,0x36,0x36,0x1c,0x33,0x1e,0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x18,0x30,0x7f,0x30,0x18,0x00,0x00,0x00,0x0c,0x06,0x7f,0x06,0x0c,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x7f,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00,
@@ -70,85 +42,187 @@ uint8 fontdata2[2048] =
 0x00,0x00,0x6e,0x3b,0x13,0x3b,0x6e,0x00,0x00,0x1e,0x33,0x1f,0x33,0x1f,0x03,0x03,0x00,0x3f,0x33,0x03,0x03,0x03,0x03,0x00,0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,0x3f,0x33,0x06,0x0c,0x06,0x33,0x3f,0x00,0x00,0x00,0x7e,0x1b,0x1b,0x1b,0x0e,0x00,0x00,0x66,0x66,0x66,0x66,0x3e,0x06,0x03,0x00,0x6e,0x3b,0x18,0x18,0x18,0x18,0x00,0x3f,0x0c,0x1e,0x33,0x33,0x1e,0x0c,0x3f,0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x38,0x0c,0x18,0x3e,0x33,0x33,0x1e,0x00,0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,0x60,0x30,0x7e,0xdb,0xdb,0x7e,0x06,0x03,0x1c,0x06,0x03,0x1f,0x03,0x06,0x1c,0x00,0x1e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x3f,0x00,0x3f,0x00,0x3f,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x3f,0x00,0x06,0x0c,0x18,0x0c,0x06,0x00,0x3f,0x00,0x18,0x0c,0x06,0x0c,0x18,0x00,0x3f,0x00,0x70,0xd8,0xd8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x0e,0x0c,0x0c,0x00,0x3f,0x00,0x0c,0x0c,0x00,0x00,0x6e,0x3b,0x00,0x6e,0x3b,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xf0,0x30,0x30,0x30,0x37,0x36,0x3c,0x38,0x1e,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x0e,0x18,0x0c,0x06,0x1e,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 };
 
 0x00,0x00,0x6e,0x3b,0x13,0x3b,0x6e,0x00,0x00,0x1e,0x33,0x1f,0x33,0x1f,0x03,0x03,0x00,0x3f,0x33,0x03,0x03,0x03,0x03,0x00,0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,0x3f,0x33,0x06,0x0c,0x06,0x33,0x3f,0x00,0x00,0x00,0x7e,0x1b,0x1b,0x1b,0x0e,0x00,0x00,0x66,0x66,0x66,0x66,0x3e,0x06,0x03,0x00,0x6e,0x3b,0x18,0x18,0x18,0x18,0x00,0x3f,0x0c,0x1e,0x33,0x33,0x1e,0x0c,0x3f,0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x38,0x0c,0x18,0x3e,0x33,0x33,0x1e,0x00,0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,0x60,0x30,0x7e,0xdb,0xdb,0x7e,0x06,0x03,0x1c,0x06,0x03,0x1f,0x03,0x06,0x1c,0x00,0x1e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x3f,0x00,0x3f,0x00,0x3f,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x3f,0x00,0x06,0x0c,0x18,0x0c,0x06,0x00,0x3f,0x00,0x18,0x0c,0x06,0x0c,0x18,0x00,0x3f,0x00,0x70,0xd8,0xd8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x0e,0x0c,0x0c,0x00,0x3f,0x00,0x0c,0x0c,0x00,0x00,0x6e,0x3b,0x00,0x6e,0x3b,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xf0,0x30,0x30,0x30,0x37,0x36,0x3c,0x38,0x1e,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x0e,0x18,0x0c,0x06,0x1e,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 };
 
-static void DrawState(void)
+void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor)
 {
 {
- uint8 *XBaf;
- int x,y,z;
+       uint8 length=strlen((char *)textmsg);
+       uint8 x;
+       uint8 y;
+       uint8 z;
+
+       for(x=0;x<length;x++)    
+         for(y=0;y<8;y++)       
+          for(z=0;z<8;z++) 
+           if((fontdata2[(textmsg[x]<<3)+y]>>z)&1) dest[y*width+(x<<3)+z]=fgcolor;
+}
 
 
- XBaf=XBuf+4+(FSettings.LastSLine-44)*320;
+static uint8 sstat[2541] =
+{
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
+0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,
+0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x80,0x83,
+0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,
+0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x81,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,
+0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,
+0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
+0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,
+0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x83,0x80,0x80,0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x80,0x83,0x83,0x81,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x81,0x81,0x81,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
+};
 
 
+void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur)
+{
+ uint8 *XBaf;
+ int z,x,y;
+            
+ XBaf=XBuf - 4 + (FSettings.LastSLine-34)*256;
  if(XBaf>=XBuf)
  for(z=1;z<11;z++)
  if(XBaf>=XBuf)
  for(z=1;z<11;z++)
- {
-  if(SaveStateStatus[z%10])
+ {  
+  if(nstatus[z%10])
    {
           for(y=0;y<13;y++)
            for(x=0;x<21;x++)
    {
           for(y=0;y<13;y++)
            for(x=0;x<21;x++)
-           XBaf[y*320+x+z*21+z]=sstat[y*21+x+(z-1)*21*12];
+            XBaf[y*256+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
    } else {
           for(y=0;y<13;y++)
            for(x=0;x<21;x++)
             if(sstat[y*21+x+(z-1)*21*12]!=0x83)
    } else {
           for(y=0;y<13;y++)
            for(x=0;x<21;x++)
             if(sstat[y*21+x+(z-1)*21*12]!=0x83)
-             XBaf[y*320+x+z*21+z]=sstat[y*21+x+(z-1)*21*12];
+             XBaf[y*256+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
+
+            else
+             XBaf[y*256+x+z*21+z]=(XBaf[y*256+x+z*21+z]&0xF)|0xC0;
    }
    }
-  if(CurrentState==z%10)
+  if(cur==z%10) 
    {
     for(x=0;x<21;x++)
    {
     for(x=0;x<21;x++)
-     XBaf[x+z*21+z*1]=132;
+     XBaf[x+z*21+z*1]=4;
     for(x=1;x<12;x++)
      {
     for(x=1;x<12;x++)
      {
-     XBaf[320*x+z*21+z*1]=
-     XBaf[320*x+z*21+z*1+20]=132;
+     XBaf[256*x+z*21+z*1]=
+     XBaf[256*x+z*21+z*1+20]=4;
      }
     for(x=0;x<21;x++)
      }
     for(x=0;x<21;x++)
-     XBaf[3264+x+z*21+z*1]=132;
+     XBaf[12*256+x+z*21+z*1]=4;
    }
   }
    }
   }
- StateShow--;
-}
+}   
 
 
-void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor)
+static uint8 play_slines[]=
 {
 {
-       uint8 length=strlen((char *)textmsg);
-       uint8 x;
-       uint8 y;
-       uint8 z;
+       0, 0, 1,
+       1, 0, 2,
+       2, 0, 3,
+       3, 0, 4,
+       4, 0, 5,
+       5, 0, 6,
+       6, 0, 7,
+       7, 0, 8,
+       8, 0, 7,
+       9, 0, 6,
+       10, 0, 5,
+       11, 0, 4,
+       12, 0, 3,
+       13, 0, 2,
+       14, 0, 1,
+       99,
+};
 
 
-       for(x=0;x<length;x++)
-         for(y=0;y<8;y++)
-          for(z=0;z<8;z++)
-           if((fontdata2[(textmsg[x]<<3)+y]>>z)&1) dest[y*width+(x<<3)+z]=fgcolor;
-}
+static uint8 record_slines[]=
+{
+       0, 5, 9,
+       1, 3, 11,
+       2, 2, 12,
+       3, 1, 13,
+       4, 1, 13,
+       5, 0, 14,
+       6, 0, 14,
+       7, 0, 14,
+       8, 0, 14,
+       9, 0, 14,
+       10, 1, 13,
+       11, 1, 13,
+       12, 2, 12,
+       13, 3, 11,
+       14, 5, 9,
+       99,
+};
 
 
-void DrawBars(void)
+static uint8 pause_slines[]=
 {
 {
- uint8 *XBaf;
- short which=0;
- int x,x2;
+       0, 2, 6,
+       1, 2, 6,
+       2, 2, 6,
+       3, 2, 6,
+       4, 2, 6,
+       5, 2, 6,
+       6, 2, 6,
+       7, 2, 6,
+       8, 2, 6,
+       9, 2, 6,
+       10, 2, 6,
+       11, 2, 6,
+       12, 2, 6,
+       13, 2, 6,
+       14, 2, 6,
+
+       0, 9, 13,
+       1, 9, 13,
+       2, 9, 13,
+       3, 9, 13,
+       4, 9, 13,
+       5, 9, 13,
+       6, 9, 13,
+       7, 9, 13,
+       8, 9, 13,
+       9, 9, 13,
+       10, 9, 13,
+       11, 9, 13,
+       12, 9, 13,
+       13, 9, 13,
+       14, 9, 13,
+       99,
+};
 
 
- if(controlselect==1)
- {
-  DrawTextTrans(XBuf+128-12+180*320, 320, (uint8 *)"Hue", 0x85);
-  which=ntschue<<1;
- }
- else if(controlselect==2)
- {
-  DrawTextTrans(XBuf+128-16+180*320, 320, (uint8 *)"Tint", 0x85);
-  which=ntsctint<<1;
- }
+static uint8 no_slines[]=
+{
+       99
+};
 
 
- XBaf=XBuf+200*320;
- for(x=0;x<which;x+=2)
- {
-  for(x2=6;x2>=-6;x2--)
-  {
-   XBaf[x-320*x2]=0x85;
-  }
- }
- for(;x<256;x+=2)
- {
-  for(x2=2;x2>=-2;x2--)
-   XBaf[x-320*x2]=0x85;
- }
+static uint8* sline_icons[4]=
+{
+       no_slines,
+       play_slines,
+       record_slines,
+       pause_slines
+};
 
 
+void FCEU_DrawRecordingStatusN(uint8* XBuf, int n)
+{
+       uint8* slines=sline_icons[n];
+       int i;
+
+       XBuf += (FSettings.LastSLine-28)*256 + 240 + 255;
+       for(i=0; slines[i]!=99; i+=3)
+       {
+               int y=slines[i];
+               uint8* dest=XBuf+(y*256);
+               int x;
+               for(x=slines[i+1]; x!=slines[i+2]; ++x)
+                       dest[x]=0;
+       }
+
+       XBuf -= 255;
+       for(i=0; slines[i]!=99; i+=3)
+       {
+               int y=slines[i];
+               uint8* dest=XBuf+(y*256);
+               int x;
+               for(x=slines[i+1]; x!=slines[i+2]; ++x)
+                       dest[x]=4;
+       }
 }
 }
index aa6a2c7..7e86dad 100644 (file)
--- a/driver.h
+++ b/driver.h
@@ -57,6 +57,9 @@ void FCEUI_SetInput(int port, int type, void *ptr, int attrib);
 void FCEUI_SetInputFC(int type, void *ptr, int attrib);
 void FCEUI_DisableFourScore(int s);
 
 void FCEUI_SetInputFC(int type, void *ptr, int attrib);
 void FCEUI_DisableFourScore(int s);
 
+void FCEUI_GetNTSCTH(int *tint, int *hue);
+void FCEUI_SetNTSCTH(int n, int tint, int hue);
+
 #include "version.h"
 
 #define SI_NONE      0
 #include "version.h"
 
 #define SI_NONE      0
@@ -163,21 +166,25 @@ void FCEUI_SaveSnapshot(void);
 void FCEU_DispMessage(char *format, ...);
 #define FCEUI_DispMessage FCEU_DispMessage
 
 void FCEU_DispMessage(char *format, ...);
 #define FCEUI_DispMessage FCEU_DispMessage
 
-int FCEUI_AddCheat(char *name, uint32 addr, uint8 val);
+int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type);
 int FCEUI_DelCheat(uint32 which);
 
 int32 FCEUI_CheatSearchGetCount(void);
 void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current));
 int FCEUI_DelCheat(uint32 which);
 
 int32 FCEUI_CheatSearchGetCount(void);
 void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current));
-void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current));
+void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void *data),void *data);
 void FCEUI_CheatSearchBegin(void);
 void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2);
 void FCEUI_CheatSearchBegin(void);
 void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2);
-void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int s));
+void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data), void *data);
 
 
-int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *s);
-int FCEUI_SetCheat(uint32 which, char *name, int32 a, int32 v, int s);
+int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *compare, int *s, int *type);
+int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare,int s, int type);
 void FCEUI_CheatSearchShowExcluded(void);
 void FCEUI_CheatSearchSetCurrentAsOriginal(void);
 
 void FCEUI_CheatSearchShowExcluded(void);
 void FCEUI_CheatSearchSetCurrentAsOriginal(void);
 
+int FCEUI_DecodePAR(const char *code, uint16 *a, uint8 *v, int *c, int *type);
+int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c);
+int FCEUI_ToggleCheat(uint32 which);
+
 #define FCEUIOD_STATE   0
 #define FCEUIOD_SNAPS   1
 #define FCEUIOD_NV      2
 #define FCEUIOD_STATE   0
 #define FCEUIOD_SNAPS   1
 #define FCEUIOD_NV      2
index fe77510..30d5498 100644 (file)
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
- *  Copyright (C) 2002 Ben Parnell
+ *  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
  *
  * 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
 #include <ctype.h>
 #include "../../driver.h"
 
 #include <ctype.h>
 #include "../../driver.h"
 
-static void GetString(char *s)
+static void GetString(char *s, int max)
 {
  int x;
 {
  int x;
- fgets(s,256,stdin);
+ fgets(s,max,stdin);
 
 
- for(x=0;x<256;x++)
+ for(x=0;x<max;x++)
   if(s[x]=='\n')
   {
    s[x]=0;
   if(s[x]=='\n')
   {
    s[x]=0;
@@ -55,6 +55,17 @@ static uint8 Get8(unsigned int def)
 {
  char buf[32];
 
 {
  char buf[32];
 
+ fgets(buf,32,stdin);
+ if(buf[0]=='\n')
+  return(def);
+ sscanf(buf,"%u",&def);
+ return def;
+}
+
+static int GetI(int def)
+{
+ char buf[32];
+
  fgets(buf,32,stdin);
  if(buf[0]=='\n')
   return(def);
  fgets(buf,32,stdin);
  if(buf[0]=='\n')
   return(def);
@@ -106,7 +117,7 @@ int ListChoice(int hmm)
    if(buf[0]=='s' || buf[0]=='S') return(-1);
    if(buf[0]=='\n') return(0);
    if(!sscanf(buf,"%d",&num))
    if(buf[0]=='s' || buf[0]=='S') return(-1);
    if(buf[0]=='\n') return(0);
    if(!sscanf(buf,"%d",&num))
-    return(0);  
+    return(0);
    if(num<1) goto tryagain;
    return(num);
   }
    if(num<1) goto tryagain;
    return(num);
   }
@@ -154,12 +165,12 @@ int AddToList(char *text, uint32 id)
  mordoe=1;
  listids[listcount]=id;
  printf("%2d) %s\n",listcount+1,text);
  mordoe=1;
  listids[listcount]=id;
  printf("%2d) %s\n",listcount+1,text);
- listcount++; 
+ listcount++;
  return(1);
 }
 
 /*
  return(1);
 }
 
 /*
-**     
+**
 **     End list code.
 **/
 
 **     End list code.
 **/
 
@@ -181,13 +192,8 @@ static void UnhideEx(void)
 
 static void ToggleCheat(int num)
 {
 
 static void ToggleCheat(int num)
 {
- uint32 A;
- int s;
-
- FCEUI_GetCheat(num,0,&A,0,&s);
- s^=1;
- FCEUI_SetCheat(num,0,-1,-1,s);
- printf("Cheat for address $%04x %sabled.\n",(unsigned int)A,s?"en":"dis");
+ printf("Cheat %d %sabled.\n",1+num,
+  FCEUI_ToggleCheat(num)?"en":"dis");
 }
 
 static void ModifyCheat(int num)
 }
 
 static void ModifyCheat(int num)
@@ -196,16 +202,19 @@ static void ModifyCheat(int num)
  char buf[256];
  uint32 A;
  uint8 V;
  char buf[256];
  uint32 A;
  uint8 V;
+ int compare;
+ int type;
+
  int s;
  int t;
 
  int s;
  int t;
 
- FCEUI_GetCheat(num, &name, &A, &V, &s);
+ FCEUI_GetCheat(num, &name, &A, &V, &compare, &s, &type);
 
  printf("Name [%s]: ",name);
 
  printf("Name [%s]: ",name);
- GetString(buf);
+ GetString(buf,256);
 
  /* This obviously doesn't allow for cheats with no names.  Bah.  Who wants
 
  /* This obviously doesn't allow for cheats with no names.  Bah.  Who wants
-    nameless cheats anyway... 
+    nameless cheats anyway...
  */
 
  if(buf[0])
  */
 
  if(buf[0])
@@ -219,12 +228,71 @@ static void ModifyCheat(int num)
  printf("Value [%03d]: ",(unsigned int)V);
  V=Get8(V);
 
  printf("Value [%03d]: ",(unsigned int)V);
  V=Get8(V);
 
+ printf("Compare [%3d]: ",compare);
+ compare=GetI(compare);
+
+ printf("Type(0=Old Style, 1=Read Substitute) [%1d]: ",type);
+ type=GetI(type)?1:0;
+
  printf("Enable [%s]: ",s?"Y":"N");
  t=getchar();
  if(t=='Y' || t=='y') s=1;
  else if(t=='N' || t=='n') s=0;
 
  printf("Enable [%s]: ",s?"Y":"N");
  t=getchar();
  if(t=='Y' || t=='y') s=1;
  else if(t=='N' || t=='n') s=0;
 
- FCEUI_SetCheat(num,name,A,V,s);
+ FCEUI_SetCheat(num,name,A,V,compare,s,type);
+}
+
+
+static void AddCheatGGPAR(int which)
+{
+ uint16 A;
+ uint8 V;
+ int C;
+ int type;
+ char name[256],code[256];
+
+ printf("Name: ");
+ GetString(name,256);
+
+ printf("Code: ");
+ GetString(code,256);
+
+ printf("Add cheat \"%s\" for code \"%s\"?",name,code);
+ if(GetYN(0))
+ {
+  if(which)
+  {
+   if(!FCEUI_DecodePAR(code,&A,&V,&C,&type))
+   {
+    puts("Invalid Game Genie code.");
+    return;
+   }
+  }
+  else
+  {
+   if(!FCEUI_DecodeGG(code,&A,&V,&C))
+   {
+    puts("Invalid Game Genie code.");
+    return;
+   }
+   type=1;
+  }
+
+  if(FCEUI_AddCheat(name,A,V,C,type))
+   puts("Cheat added.");
+  else
+   puts("Error adding cheat.");
+ }
+}
+
+static void AddCheatGG(void)
+{
+ AddCheatGGPAR(0);
+}
+
+static void AddCheatPAR(void)
+{
+ AddCheatGGPAR(1);
 }
 
 static void AddCheatParam(uint32 A, uint8 V)
 }
 
 static void AddCheatParam(uint32 A, uint8 V)
@@ -232,7 +300,7 @@ static void AddCheatParam(uint32 A, uint8 V)
  char name[256];
 
  printf("Name: ");
  char name[256];
 
  printf("Name: ");
- GetString(name);
+ GetString(name,256);
  printf("Address [$%04x]: ",(unsigned int)A);
  A=GetH16(A);
  printf("Value [%03d]: ",(unsigned int)V);
  printf("Address [$%04x]: ",(unsigned int)A);
  A=GetH16(A);
  printf("Value [%03d]: ",(unsigned int)V);
@@ -240,7 +308,7 @@ static void AddCheatParam(uint32 A, uint8 V)
  printf("Add cheat \"%s\" for address $%04x with value %03d?",name,(unsigned int)A,(unsigned int)V);
  if(GetYN(0))
  {
  printf("Add cheat \"%s\" for address $%04x with value %03d?",name,(unsigned int)A,(unsigned int)V);
  if(GetYN(0))
  {
-  if(FCEUI_AddCheat(name,A,V))
+  if(FCEUI_AddCheat(name,A,V,-1,0))
    puts("Cheat added.");
   else
    puts("Error adding cheat.");
    puts("Cheat added.");
   else
    puts("Error adding cheat.");
@@ -253,12 +321,17 @@ static void AddCheat(void)
 }
 
 static int lid;
 }
 
 static int lid;
-static int clistcallb(char *name, uint32 a, uint8 v, int s)
+static int clistcallb(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data)
 {
  char tmp[512];
  int ret;
 
 {
  char tmp[512];
  int ret;
 
- sprintf(tmp,"%s $%04x:%03d - %s",s?"*":" ",(unsigned int)a,(unsigned int)v,name);
+ if(compare>=0)
+  sprintf(tmp,"%s   $%04x:%03d:%03d - %s",s?"*":" ",(unsigned int)a,(unsigned int)v,compare,name);
+ else
+  sprintf(tmp,"%s   $%04x:%03d     - %s",s?"*":" ",(unsigned int)a,(unsigned int)v,name);
+ if(type==1)
+  tmp[2]='S';
  ret=AddToList(tmp,lid);
  lid++;
  return(ret);
  ret=AddToList(tmp,lid);
  lid++;
  return(ret);
@@ -270,7 +343,7 @@ static void ListCheats(void)
  lid=0;
 
  BeginListShow();
  lid=0;
 
  BeginListShow();
- FCEUI_ListCheats(clistcallb);
+ FCEUI_ListCheats(clistcallb,0);
  which=EndListShow();
  if(which>=0)
  {
  which=EndListShow();
  if(which>=0)
  {
@@ -283,7 +356,7 @@ static void ListCheats(void)
            break;
    case 'd':if(!FCEUI_DelCheat(which))
             puts("Error deleting cheat!");
            break;
    case 'd':if(!FCEUI_DelCheat(which))
             puts("Error deleting cheat!");
-           else 
+           else
             puts("Cheat has been deleted.");
            break;
    case 'm':ModifyCheat(which);
             puts("Cheat has been deleted.");
            break;
    case 'm':ModifyCheat(which);
@@ -298,7 +371,7 @@ static void ResetSearch(void)
  puts("Done.");
 }
 
  puts("Done.");
 }
 
-static int srescallb(uint32 a, uint8 last, uint8 current)
+static int srescallb(uint32 a, uint8 last, uint8 current, void *data)
 {
  char tmp[13];
  sprintf(tmp, "$%04x:%03d:%03d",(unsigned int)a,(unsigned int)last,(unsigned int)current);
 {
  char tmp[13];
  sprintf(tmp, "$%04x:%03d:%03d",(unsigned int)a,(unsigned int)last,(unsigned int)current);
@@ -313,7 +386,7 @@ static void ShowRes(void)
  {
   int which;
   BeginListShow();
  {
   int which;
   BeginListShow();
-  FCEUI_CheatSearchGet(srescallb);
+  FCEUI_CheatSearchGet(srescallb,0);
   which=EndListShow();
   if(which>=0)
    AddCheatParam(which,0);
   which=EndListShow();
   if(which>=0)
    AddCheatParam(which,0);
@@ -354,10 +427,10 @@ static void DoSearch(void)
 {
  static int v1=0,v2=0;
  static int method=0;
 {
  static int v1=0,v2=0;
  static int method=0;
- char *m[4]={"O==V1 && C==V2","O==V1 && |O-C|==V2","|O-C|==V2","O!=C"};
+ char *m[6]={"O==V1 && C==V2","O==V1 && |O-C|==V2","|O-C|==V2","O!=C","Value decreased","Value increased"};
  printf("\nSearch Filter:\n");
 
  printf("\nSearch Filter:\n");
 
- method=ShowShortList(m,4,method);
+ method=ShowShortList(m,6,method);
  if(method<=1)
  {
   printf("V1 [%03d]: ",v1);
  if(method<=1)
  {
   printf("V1 [%03d]: ",v1);
@@ -373,19 +446,21 @@ static void DoSearch(void)
 }
 
 
 }
 
 
-static MENU NewCheatsMenu[7]={
- {"Add Cheat",AddCheat,1},
- {"Reset Search",ResetSearch,1},
- {"Do Search",DoSearch,1},
- {"Set Original to Current",SetOC,1},
- {"Unhide Excluded",UnhideEx,1},
- {"Show Results",ShowRes,1},
+static MENU NewCheatsMenu[]={
+ {"Add Cheat",(void *)AddCheat,1},
+ {"Reset Search",(void *)ResetSearch,1},
+ {"Do Search",(void *)DoSearch,1},
+ {"Set Original to Current",(void *)SetOC,1},
+ {"Unhide Excluded",(void *)UnhideEx,1},
+ {"Show Results",(void *)ShowRes,1},
+ {"Add Game Genie Cheat",(void *)AddCheatGG,1},
+ {"Add PAR Cheat",(void *)AddCheatPAR,1},
  {0}
 };
 
  {0}
 };
 
-static MENU MainMenu[3]={
- {"List Cheats",ListCheats,1},
- {"New Cheats...",NewCheatsMenu,0},
+static MENU MainMenu[]={
+ {"List Cheats",(void *)ListCheats,1},
+ {"New Cheats...",(void *)NewCheatsMenu,0},
  {0}
 };
 
  {0}
 };
 
@@ -423,11 +498,11 @@ static void DoMenu(MENU *men)
    if(c>x) goto invalid;
    if(men[c-1].type)
    {
    if(c>x) goto invalid;
    if(men[c-1].type)
    {
-    void (*func)(void)=men[c-1].action;
+    void (*func)(void)=(void(*)())men[c-1].action;
     func();
    }
    else
     func();
    }
    else
-    DoMenu(men[c-1].action);   /* Mmm...recursivey goodness. */
+    DoMenu((MENU*)men[c-1].action);    /* Mmm...recursivey goodness. */
    goto redisplay;
   }
   else
    goto redisplay;
   }
   else
index 6422569..b88bb6b 100644 (file)
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
- *  Copyright (C) 2002 Ben Parnell
+ *  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
  *
  * 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
diff --git a/fce.c b/fce.c
index d50c201..4db2a0a 100644 (file)
--- a/fce.c
+++ b/fce.c
@@ -48,6 +48,7 @@
 #include       "crc32.h"
 #include        "ppu.h"
 
 #include       "crc32.h"
 #include        "ppu.h"
 
+#include        "palette.h"
 #include        "movie.h"
 
 #include        "dprintf.h"
 #include        "movie.h"
 
 #include        "dprintf.h"
@@ -1032,7 +1033,7 @@ void CloseGame(void)
  if(GameLoaded)
  {
   if(FCEUGameInfo.type!=GIT_NSF)
  if(GameLoaded)
  {
   if(FCEUGameInfo.type!=GIT_NSF)
-   FlushGameCheats();
+   FCEU_FlushGameCheats(0,0);
   #ifdef NETWORK
   if(FSettings.NetworkPlay) KillNetplay();
   #endif
   #ifdef NETWORK
   if(FSettings.NetworkPlay) KillNetplay();
   #endif
@@ -1139,8 +1140,8 @@ FCEUGI *FCEUI_LoadGame(char *name)
         SaveStateRefresh();
         if(FCEUGameInfo.type!=GIT_NSF)
         {
         SaveStateRefresh();
         if(FCEUGameInfo.type!=GIT_NSF)
         {
-         LoadGamePalette();
-         LoadGameCheats();
+        FCEU_LoadGamePalette();
+         FCEU_LoadGameCheats(0);
         }
 
        FCEU_ResetPalette();
         }
 
        FCEU_ResetPalette();
@@ -1187,7 +1188,7 @@ int FCEUI_Initialize(void)
        FSettings.UsrFirstSLine[0]=8;
        FSettings.UsrFirstSLine[1]=0;
         FSettings.UsrLastSLine[0]=FSettings.UsrLastSLine[1]=239;
        FSettings.UsrFirstSLine[0]=8;
        FSettings.UsrFirstSLine[1]=0;
         FSettings.UsrLastSLine[0]=FSettings.UsrLastSLine[1]=239;
-       FSettings.SoundVolume=65535;    // 100%
+       FSettings.SoundVolume=100;
         return 1;
 }
 
         return 1;
 }
 
@@ -1222,7 +1223,7 @@ void EmLoop(void)
   int x;
   uint32 scanlines_per_frame = PAL ? 312 : 262;
   UpdateInput();
   int x;
   uint32 scanlines_per_frame = PAL ? 312 : 262;
   UpdateInput();
-  ApplyPeriodicCheats();
+  FCEU_ApplyPeriodicCheats();
 
   // FCEUPPU_Loop:
   if(ppudead) /* Needed for Knight Rider, possibly others. */
 
   // FCEUPPU_Loop:
   if(ppudead) /* Needed for Knight Rider, possibly others. */
@@ -1435,7 +1436,7 @@ static void PowerPPU(void)
 
 void ResetNES(void)
 {
 
 void ResetNES(void)
 {
-        if(!GameLoaded || (FCEUGameInfo.type==GIT_NSF)) return;
+        if(!GameLoaded) return;
         GameInterface(GI_RESETM2);
         ResetSound();
         ResetPPU();
         GameInterface(GI_RESETM2);
         ResetSound();
         ResetPPU();
index f01bae6..eabb5ed 100644 (file)
--- a/general.c
+++ b/general.c
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
- *  Copyright (C) 2002 Ben Parnell
+ *  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
  *
  * 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
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
+#include <stdarg.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "types.h"
 
 #include "types.h"
+#include "fce.h"
 
 #include "general.h"
 #include "state.h"
 
 #include "general.h"
 #include "state.h"
-#include "version.h"
-#include "svga.h"
+#include "movie.h"
+
 #include "driver.h"
 
 #include "driver.h"
 
-char *marray[1]={"Error allocating memory!"};
+#include "md5.h"
+#include "svga.h"
 
 static char BaseDirectory[2048];
 
 static char BaseDirectory[2048];
-static char FileBase[2048];
-static char FileExt[2048];
+char FileBase[2048];
+static char FileExt[2048];     /* Includes the . character, as in ".nes" */
+
 static char FileBaseDirectory[2048];
 
 void FCEUI_SetBaseDirectory(char *dir)
 static char FileBaseDirectory[2048];
 
 void FCEUI_SetBaseDirectory(char *dir)
@@ -47,80 +55,197 @@ static char *odirs[FCEUIOD__COUNT]={0,0,0,0,0};     // odirs, odors. ^_^
 
 void FCEUI_SetDirOverride(int which, char *n)
 {
 
 void FCEUI_SetDirOverride(int which, char *n)
 {
+//     FCEU_PrintError("odirs[%d]=%s->%s", which, odirs[which], n);
+if(which < FCEUIOD__COUNT)
  odirs[which]=n;
  odirs[which]=n;
- if(which==FCEUIOD_STATE)
-  SaveStateRefresh();
+
+#if 0
+ if(FCEUGameInfo)  /* Rebuild cache of present states/movies. */
+ {
+  if(which==FCEUIOD_STATE)
+   FCEUSS_CheckStates();
+  else if(which == FCEUIOD_MISC)
+   FCEUMOV_CheckMovies();
+ }
+#endif
+}
+
+#ifndef HAVE_ASPRINTF
+static int asprintf(char **strp, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap,fmt);
+ if(!(*strp=malloc(2048)))
+  return(0);
+ ret=vsnprintf(*strp,2048,fmt,ap);
+ va_end(ap);
+ return(ret);
+}
+#endif
+
+char* FCEU_GetPath(int type)
+{
+ char *ret=0;
+ switch(type)
+ {
+  case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
+                      ret=strdup(odirs[FCEUIOD_STATE]);
+                     else
+                      asprintf(&ret,"%s"PSS"movie",BaseDirectory);
+                    break;
+  case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
+                      ret=strdup(odirs[FCEUIOD_MISC]);
+                     else
+                      asprintf(&ret,"%s"PSS"movie",BaseDirectory);
+                    break;
+ }
+ return(ret);
+}
+
+char *FCEU_MakePath(int type, const char* filebase)
+{
+ char *ret=0;
+
+ switch(type)
+ {
+  case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
+                      asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_MISC],filebase);
+                     else
+                      asprintf(&ret,"%s"PSS"movie"PSS"%s",BaseDirectory,filebase);
+                    break;
+ }
+ return(ret);
 }
 
 }
 
-/* We should probably use snprintf(), but many C libraries don't seem to
-   have this function.
-*/
 char *FCEU_MakeFName(int type, int id1, char *cd1)
 {
 char *FCEU_MakeFName(int type, int id1, char *cd1)
 {
- static uint8 ret[2048];
+ char *ret=0;
+ struct stat tmpstat;
 
 
- ret[0]=0;
  switch(type)
  {
  switch(type)
  {
+  case FCEUMKF_NPTEMP: asprintf(&ret,"%s"PSS"m590plqd94fo.tmp",BaseDirectory);break;
+  case FCEUMKF_MOVIE:if(id1>=0)
+                                        {
+                         if(odirs[FCEUIOD_MISC])
+                       asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
+                      else
+                       asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
+                      if(stat(ret,&tmpstat)==-1)
+                      {
+                       if(odirs[FCEUIOD_MISC])
+                        asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
+                       else
+                        asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
+                      }
+                                        }
+                                        else
+                                        {
+                                         if(odirs[FCEUIOD_MISC])
+                                          asprintf(&ret,"%s"PSS"%s.fcm",odirs[FCEUIOD_MISC],FileBase);
+                                         else
+                                          asprintf(&ret,"%s"PSS"movie"PSS"%s.fcm",BaseDirectory,FileBase);
+                                        }
+                    break;
   case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
   case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
-                      sprintf(((char*)ret),"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
+                                        {
+                      asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
+//                                       FCEU_PrintError("A");
+                                        }
                      else
                      else
-                      sprintf(((char*)ret),"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
+                                        {
+                      asprintf(&ret,"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
+//                                       FCEU_PrintError("B");
+                                        }
+                    if(stat(ret,&tmpstat)==-1)
+                    {
+                     if(odirs[FCEUIOD_STATE])
+                         {
+                       asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
+//                                       FCEU_PrintError("C");
+                         }
+                      else
+                                         {
+                       asprintf(&ret,"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
+//                                       FCEU_PrintError("D");
+                                         }
+                    }
                      break;
   case FCEUMKF_SNAP:
                    if(FSettings.SnapName)
                    {
                      if(odirs[FCEUIOD_SNAPS])
                      break;
   case FCEUMKF_SNAP:
                    if(FSettings.SnapName)
                    {
                      if(odirs[FCEUIOD_SNAPS])
-                      sprintf(((char*)ret),"%s"PSS"%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1);
+                      asprintf(&ret,"%s"PSS"%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1);
                      else
                      else
-                      sprintf(((char*)ret),"%s"PSS"snaps"PSS"%s-%d.%s",BaseDirectory,FileBase,id1,cd1);
+                      asprintf(&ret,"%s"PSS"snaps"PSS"%s-%d.%s",BaseDirectory,FileBase,id1,cd1);
                    }
                    else
                    {
                     if(odirs[FCEUIOD_SNAPS])
                    }
                    else
                    {
                     if(odirs[FCEUIOD_SNAPS])
-                      sprintf(((char*)ret),"%s"PSS"%d.%s",odirs[FCEUIOD_SNAPS],id1,cd1);
+                      asprintf(&ret,"%s"PSS"%d.%s",odirs[FCEUIOD_SNAPS],id1,cd1);
                      else
                      else
-                      sprintf(((char*)ret),"%s"PSS"snaps"PSS"%d.%s",BaseDirectory,id1,cd1);
+                      asprintf(&ret,"%s"PSS"snaps"PSS"%d.%s",BaseDirectory,id1,cd1);
                    }
                     break;
   case FCEUMKF_FDS:if(odirs[FCEUIOD_NV])
                    }
                     break;
   case FCEUMKF_FDS:if(odirs[FCEUIOD_NV])
-                   sprintf((char*)ret,"%s"PSS"%s.fds",odirs[FCEUIOD_NV],FileBase);
+                   asprintf(&ret,"%s"PSS"%s.fds",odirs[FCEUIOD_NV],FileBase);
                   else
                   else
-                   sprintf((char*)ret,"%s"PSS"sav"PSS"%s.fds",BaseDirectory,FileBase);
+                   asprintf(&ret,"%s"PSS"sav"PSS"%s.fds",BaseDirectory,FileBase);
                   break;
   case FCEUMKF_SAV:if(odirs[FCEUIOD_NV])
                   break;
   case FCEUMKF_SAV:if(odirs[FCEUIOD_NV])
-                   {
-                    sprintf(((char*)ret),"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
-                   }
+                    asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
                   else
                   else
+                    asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
+                   if(stat(ret,&tmpstat)==-1)
                    {
                    {
-                    if(FSettings.SUnderBase)
-                     sprintf(((char*)ret),"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
+                    if(odirs[FCEUIOD_NV])
+                     asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
                     else
                     else
-                     sprintf(((char*)ret),"%s"PSS"%s.%s",FileBaseDirectory,FileBase,cd1);
+                     asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
                    }
                    break;
   case FCEUMKF_CHEAT:
                      if(odirs[FCEUIOD_CHEATS])
                    }
                    break;
   case FCEUMKF_CHEAT:
                      if(odirs[FCEUIOD_CHEATS])
-                      sprintf(((char*)ret),"%s"PSS"%s.cht",odirs[FCEUIOD_CHEATS],FileBase);
+                      asprintf(&ret,"%s"PSS"%s.cht",odirs[FCEUIOD_CHEATS],FileBase);
                      else
                      else
-                      sprintf(((char*)ret),"%s"PSS"cheats"PSS"%s.cht",BaseDirectory,FileBase);
+                      asprintf(&ret,"%s"PSS"cheats"PSS"%s.cht",BaseDirectory,FileBase);
+                     break;
+  case FCEUMKF_IPS:  asprintf(&ret,"%s"PSS"%s%s.ips",FileBaseDirectory,FileBase,FileExt);
                      break;
                      break;
-  case FCEUMKF_GGROM:sprintf(((char*)ret),"%s"PSS"gg.rom",BaseDirectory);break;
-  case FCEUMKF_FDSROM:sprintf(((char*)ret),"%s"PSS"disksys.rom",BaseDirectory);break;
+  case FCEUMKF_GGROM:asprintf(&ret,"%s"PSS"gg.rom",BaseDirectory);break;
+  case FCEUMKF_FDSROM:asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory);break;
   case FCEUMKF_PALETTE:
                        if(odirs[FCEUIOD_MISC])
   case FCEUMKF_PALETTE:
                        if(odirs[FCEUIOD_MISC])
-                        sprintf(((char*)ret),"%s"PSS"%s.pal",odirs[FCEUIOD_MISC],FileBase);
+                        asprintf(&ret,"%s"PSS"%s.pal",odirs[FCEUIOD_MISC],FileBase);
                        else
                        else
-                        sprintf(((char*)ret),"%s"PSS"gameinfo"PSS"%s.pal",BaseDirectory,FileBase);
+                        asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);
                        break;
                        break;
+  case FCEUMKF_MOVIEGLOB:
+                     if(odirs[FCEUIOD_MISC])
+//                      asprintf(&ret,"%s"PSS"%s*.fcm",odirs[FCEUIOD_MISC],FileBase);
+                      asprintf(&ret,"%s"PSS"*.???",odirs[FCEUIOD_MISC]);
+                     else
+//                      asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fcm",BaseDirectory,FileBase);
+                      asprintf(&ret,"%s"PSS"movie"PSS"*.???",BaseDirectory);
+                     break;
+  case FCEUMKF_MOVIEGLOB2:
+                      asprintf(&ret,"%s"PSS"*.???",BaseDirectory);
+                     break;
+  case FCEUMKF_STATEGLOB:
+                     if(odirs[FCEUIOD_STATE])
+                      asprintf(&ret,"%s"PSS"%s*.fc?",odirs[FCEUIOD_STATE],FileBase);
+                     else
+                      asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fc?",BaseDirectory,FileBase);
+                     break;
  }
  }
- return((char *)ret);
+ return(ret);
 }
 
 }
 
-void GetFileBase(char *f)
+void GetFileBase(const char *f)
 {
 {
-        char *tp1,*tp3;
+        const char *tp1,*tp3;
 
  #if PSS_STYLE==4
      tp1=((char *)strrchr(f,':'));
 
  #if PSS_STYLE==4
      tp1=((char *)strrchr(f,':'));
@@ -145,11 +270,11 @@ void GetFileBase(char *f)
       tp1++;
      }
 
       tp1++;
      }
 
-     if((tp3=strrchr(f,'.'))!=NULL)
+     if(((tp3=strrchr(f,'.'))!=NULL) && (tp3>tp1))
      {
       memcpy(FileBase,tp1,tp3-tp1);
       FileBase[tp3-tp1]=0;
      {
       memcpy(FileBase,tp1,tp3-tp1);
       FileBase[tp3-tp1]=0;
-      strcpy(FileExt,tp3+1);
+      strcpy(FileExt,tp3);
      }
      else
      {
      }
      else
      {
index 14ca5f0..f5e3b30 100644 (file)
--- a/general.h
+++ b/general.h
@@ -1,8 +1,8 @@
-void GetFileBase(char *f);
-#define MSG_ERRAM       marray[0]
-extern char *marray[];
+void GetFileBase(const char *f);
 extern uint32 uppow2(uint32 n);
 
 extern uint32 uppow2(uint32 n);
 
+char* FCEU_GetPath(int type);
+char *FCEU_MakePath(int type, const char* filebase);
 char *FCEU_MakeFName(int type, int id1, char *cd1);
 
 #define FCEUMKF_STATE  1
 char *FCEU_MakeFName(int type, int id1, char *cd1);
 
 #define FCEUMKF_STATE  1
@@ -14,3 +14,8 @@ char *FCEU_MakeFName(int type, int id1, char *cd1);
 #define FCEUMKF_GGROM  7
 #define FCEUMKF_IPS    8
 #define FCEUMKF_FDS    9
 #define FCEUMKF_GGROM  7
 #define FCEUMKF_IPS    8
 #define FCEUMKF_FDS    9
+#define FCEUMKF_MOVIE  10
+#define FCEUMKF_NPTEMP 11
+#define FCEUMKF_MOVIEGLOB      12
+#define FCEUMKF_STATEGLOB      13
+#define FCEUMKF_MOVIEGLOB2     14
diff --git a/ines.c b/ines.c
index 679fb92..e804c26 100644 (file)
--- a/ines.c
+++ b/ines.c
@@ -549,7 +549,7 @@ int iNESLoad(const char *name, int fp)
 \r
        iNESCart.CRC32=iNESGameCRC32;\r
 \r
 \r
        iNESCart.CRC32=iNESGameCRC32;\r
 \r
-        FCEU_printf(" PRG ROM:  %3d x 16KiB\n CHR ROM:  %3d x  8KiB\n ROM CRC32:  0x%08lx\n",\r
+        FCEU_printf(" PRG ROM:  %3d x 16KiB\n CHR ROM:  %3d x  8KiB\n ROM CRC32:  0x%08x\n",\r
                head.ROM_size,head.VROM_size,iNESGameCRC32);\r
 \r
         {\r
                head.ROM_size,head.VROM_size,iNESGameCRC32);\r
 \r
         {\r
index 8e8c333..bddf953 100644 (file)
@@ -2,6 +2,7 @@
 #include "../input.h"
 #include "../fce.h"
 #include "../svga.h"
 #include "../input.h"
 #include "../fce.h"
 #include "../svga.h"
+#include "../palette.h"
 #include "../x6502.h"
 
 void FCEU_DrawCursor(uint8 *buf, int xc, int yc);
 #include "../x6502.h"
 
 void FCEU_DrawCursor(uint8 *buf, int xc, int yc);
index 6f7a251..c9c3297 100644 (file)
@@ -93,4 +93,5 @@ void Mapper217_init(void)
   DoPRG217();
   DoCHR217();
 }
   DoPRG217();
   DoCHR217();
 }
-*/
\ No newline at end of file
+*/
+
index bae3b66..e2ae206 100644 (file)
@@ -38,7 +38,7 @@ void DoVRC7Sound(void)
  z=((SOUNDTS<<16)/soundtsinc)>>4;
  a=z-dwave;
 
  z=((SOUNDTS<<16)/soundtsinc)>>4;
  a=z-dwave;
 
- moocow(VRC7Sound, &Wave[dwave], a, 1);
+ moocow(VRC7Sound, (int32 *)&Wave[dwave], a, 1);
 
  dwave+=a;
 }
 
  dwave+=a;
 }
@@ -56,7 +56,7 @@ void UpdateOPL(int Count)
  a=z-dwave;
 
  if(VRC7Sound && a)
  a=z-dwave;
 
  if(VRC7Sound && a)
-  moocow(VRC7Sound, &Wave[dwave], a, 1);
+  moocow(VRC7Sound, (int32 *)&Wave[dwave], a, 1);
 
  dwave=0;
 }
 
  dwave=0;
 }
index 8fb701d..de10c11 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
- *  Copyright (C) 2002 Ben Parnell
+ *  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
  *
  * 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
 #include <stdlib.h>
 
 #include "types.h"
 #include <stdlib.h>
 
 #include "types.h"
-#include "version.h"
+#include "fce.h"
 #include "memory.h"
 #include "general.h"
 #include "svga.h"
 
 #include "memory.h"
 #include "general.h"
 #include "svga.h"
 
+void *FCEU_gmalloc(uint32 size)
+{
+ void *ret;
+ ret=malloc(size);
+ if(!ret)
+ {
+  FCEU_PrintError("Error allocating memory!  Doing a hard exit.");
+  exit(1);
+ }
+ return ret;
+}
+
 void *FCEU_malloc(uint32 size)
 {
  void *ret;
  ret=malloc(size);
  if(!ret)
 void *FCEU_malloc(uint32 size)
 {
  void *ret;
  ret=malloc(size);
  if(!ret)
-  FCEU_PrintError(MSG_ERRAM);
+ {
+  FCEU_PrintError("Error allocating memory!");
+  return(0);
+ }
  return ret;
 }
 
  return ret;
 }
 
-void FCEU_free(void *ptr)              // Might do something with this and FCEU_malloc later...
+void FCEU_free(void *ptr)    // Might do something with this and FCEU_malloc later...
 {
  free(ptr);
 }
 
 {
  free(ptr);
 }
 
-
+void FCEU_gfree(void *ptr)
+{
+ free(ptr);
+}
 
 void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l)
 {
 
 void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l)
 {
@@ -52,20 +70,20 @@ void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l)
  t|=(int)s;
  t|=(int)l;
 
  t|=(int)s;
  t|=(int)l;
 
- if(t&3)          // Not 4-byte aligned and/or length is not a multiple of 4.
+ if(t&3)    // Not 4-byte aligned and/or length is not a multiple of 4.
  {
  {
-  uint8 *tmpd, *tmps;  
+  uint8 *tmpd, *tmps;
 
   tmpd = d;
   tmps = s;
 
 
   tmpd = d;
   tmps = s;
 
-  for(x=l;x;x--)        // This could be optimized further, though(more tests could be performed).
+  for(x=l;x;x--)  // This could be optimized further, though(more tests could be performed).
   {
    *tmpd=*tmps;
    tmpd++;
    tmps++;
   }
   {
    *tmpd=*tmps;
    tmpd++;
    tmps++;
   }
 }
+ }
  else
  {
   uint32 *tmpd, *tmps;
  else
  {
   uint32 *tmpd, *tmps;
@@ -79,6 +97,5 @@ void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l)
    tmpd++;
    tmps++;
   }
    tmpd++;
    tmps++;
   }
+ }
 }
 }
-}
-
index 32df99a..a0c104a 100644 (file)
--- a/memory.h
+++ b/memory.h
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
 /* FCE Ultra - NES/Famicom Emulator
  *
  * Copyright notice for this file:
- *  Copyright (C) 2002 Ben Parnell
+ *  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
  *
  * 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
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-/*              Various macros for faster memory stuff
-               (at least that's the idea)
+/*        Various macros for faster memory stuff
+               (at least that's the idea) 
 */
 
 #define FCEU_dwmemset(d,c,n) {int _x; for(_x=n-4;_x>=0;_x-=4) *(uint32 *)&(d)[_x]=c;}
 
 void *FCEU_malloc(uint32 size);
 */
 
 #define FCEU_dwmemset(d,c,n) {int _x; for(_x=n-4;_x>=0;_x-=4) *(uint32 *)&(d)[_x]=c;}
 
 void *FCEU_malloc(uint32 size);
+void *FCEU_gmalloc(uint32 size);
+void FCEU_gfree(void *ptr);
 void FCEU_free(void *ptr);
 void FCEU_free(void *ptr);
-#define FCEU_gmalloc FCEU_malloc
-#define FCEU_gfree FCEU_free
 void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l);
 void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l);
diff --git a/movie.c b/movie.c
index 064c256..8e486b5 100644 (file)
--- a/movie.c
+++ b/movie.c
@@ -98,7 +98,7 @@ int resetDMCacc=0;
 static uint32 nextts = 0;
 static int32 nextd = 0;
 
 static uint32 nextts = 0;
 static int32 nextd = 0;
 
-#define FCEUSTATE_RLSB            0x80000000
+//#define FCEUSTATE_RLSB            0x80000000
 
 SFORMAT FCEUMOV_STATEINFO[]={
  { joop, 4,"JOOP"},
 
 SFORMAT FCEUMOV_STATEINFO[]={
  { joop, 4,"JOOP"},
diff --git a/movie.h b/movie.h
index 8cc5fc3..df7de25 100644 (file)
--- a/movie.h
+++ b/movie.h
@@ -19,6 +19,7 @@ int FCEUMOV_PostLoad(void);
 #endif
 
 extern int current;     // > 0 for recording, < 0 for playback
 #endif
 
 extern int current;     // > 0 for recording, < 0 for playback
+extern uint32 framecount;
 void FCEUI_LoadMovie(char *fname, int _read_only);
 
 #endif /* __MOVIE_H_ */
 void FCEUI_LoadMovie(char *fname, int _read_only);
 
 #endif /* __MOVIE_H_ */
diff --git a/nsf.c b/nsf.c
index 9e09cfb..7e8d3cb 100644 (file)
--- a/nsf.c
+++ b/nsf.c
@@ -42,6 +42,9 @@
 #define M_PI 3.14159265358979323846\r
 #endif\r
 \r
 #define M_PI 3.14159265358979323846\r
 #endif\r
 \r
+#define SCREEN_WIDTH 320\r
+#define SCREEN_OFFS 32\r
+\r
 static uint8 SongReload;\r
 static int CurrentSong;\r
 \r
 static uint8 SongReload;\r
 static int CurrentSong;\r
 \r
@@ -403,7 +406,7 @@ void DrawNSF(uint8 *XBuf)
 \r
  if(vismode==0) return;\r
 \r
 \r
  if(vismode==0) return;\r
 \r
- memset(XBuf,0,256*240);\r
+ memset(XBuf,0,320*240);\r
 \r
 \r
  {\r
 \r
 \r
  {\r
@@ -422,7 +425,7 @@ void DrawNSF(uint8 *XBuf)
     uint32 y;\r
     y=142+((Bufpl[(x*l)>>8]*mul)>>14);\r
     if(y<240)\r
     uint32 y;\r
     y=142+((Bufpl[(x*l)>>8]*mul)>>14);\r
     if(y<240)\r
-     XBuf[x+y*256]=3;\r
+     XBuf[x+y*SCREEN_WIDTH+SCREEN_OFFS]=3;\r
    }\r
   }\r
   else if(special==1)\r
    }\r
   }\r
   else if(special==1)\r
@@ -439,7 +442,7 @@ void DrawNSF(uint8 *XBuf)
     yp=120+r*sin(x*M_PI*2/256);\r
     xp&=255;\r
     yp%=240;\r
     yp=120+r*sin(x*M_PI*2/256);\r
     xp&=255;\r
     yp%=240;\r
-    XBuf[xp+yp*256]=3;\r
+    XBuf[xp+yp*SCREEN_WIDTH+SCREEN_OFFS]=3;\r
    }\r
   }\r
   else if(special==2)\r
    }\r
   }\r
   else if(special==2)\r
@@ -463,7 +466,7 @@ void DrawNSF(uint8 *XBuf)
     n=120+r*sin(t);\r
 \r
     if(m<256 && n<240)\r
     n=120+r*sin(t);\r
 \r
     if(m<256 && n<240)\r
-     XBuf[m+n*256]=3;\r
+     XBuf[m+n*SCREEN_WIDTH+SCREEN_OFFS]=3;\r
 \r
    }\r
    for(x=128;x<256;x++)\r
 \r
    }\r
    for(x=128;x<256;x++)\r
@@ -482,20 +485,20 @@ void DrawNSF(uint8 *XBuf)
     n=120+r*sin(t);\r
 \r
     if(m<256 && n<240)\r
     n=120+r*sin(t);\r
 \r
     if(m<256 && n<240)\r
-     XBuf[m+n*256]=3;\r
+     XBuf[m+n*SCREEN_WIDTH+SCREEN_OFFS]=3;\r
 \r
    }\r
    theta+=(double)M_PI/256;\r
   }\r
  }\r
 \r
 \r
    }\r
    theta+=(double)M_PI/256;\r
   }\r
  }\r
 \r
- DrawTextTrans(XBuf+10*256+4+(((31-strlen((char*)NSFHeader.SongName))<<2)), 256, NSFHeader.SongName, 6);\r
- DrawTextTrans(XBuf+26*256+4+(((31-strlen((char*)NSFHeader.Artist))<<2)), 256,NSFHeader.Artist, 6);\r
- DrawTextTrans(XBuf+42*256+4+(((31-strlen((char*)NSFHeader.Copyright))<<2)), 256,NSFHeader.Copyright, 6);\r
+ DrawTextTrans(XBuf+10*SCREEN_WIDTH+SCREEN_OFFS+4+(((31-strlen((char*)NSFHeader.SongName))<<2)), SCREEN_WIDTH, NSFHeader.SongName, 6);\r
+ DrawTextTrans(XBuf+26*SCREEN_WIDTH+SCREEN_OFFS+4+(((31-strlen((char*)NSFHeader.Artist))<<2)), SCREEN_WIDTH,NSFHeader.Artist, 6);\r
+ DrawTextTrans(XBuf+42*SCREEN_WIDTH+SCREEN_OFFS+4+(((31-strlen((char*)NSFHeader.Copyright))<<2)), SCREEN_WIDTH,NSFHeader.Copyright, 6);\r
 \r
 \r
- DrawTextTrans(XBuf+70*256+4+(((31-strlen("Song:"))<<2)), 256, (uint8*)"Song:", 6);\r
+ DrawTextTrans(XBuf+70*SCREEN_WIDTH+SCREEN_OFFS+4+(((31-strlen("Song:"))<<2)), SCREEN_WIDTH, (uint8*)"Song:", 6);\r
  sprintf(snbuf,"<%d/%d>",CurrentSong,NSFHeader.TotalSongs);\r
  sprintf(snbuf,"<%d/%d>",CurrentSong,NSFHeader.TotalSongs);\r
- DrawTextTrans(XBuf+82*256+4+(((31-strlen(snbuf))<<2)), 256, (uint8*)snbuf, 6);\r
+ DrawTextTrans(XBuf+82*SCREEN_WIDTH+SCREEN_OFFS+4+(((31-strlen(snbuf))<<2)), SCREEN_WIDTH, (uint8*)snbuf, 6);\r
 \r
  {\r
   static uint8 last=0;\r
 \r
  {\r
   static uint8 last=0;\r
diff --git a/palette.c b/palette.c
new file mode 100644 (file)
index 0000000..27342fd
--- /dev/null
+++ b/palette.c
@@ -0,0 +1,370 @@
+/* FCE Ultra - NES/Famicom Emulator\r
+ *\r
+ * Copyright notice for this file:\r
+ *  Copyright (C) 2002,2003 Xodnizel\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <math.h>\r
+\r
+#include "types.h"\r
+#include "fce.h"\r
+#include "general.h"\r
+#include "driver.h"\r
+\r
+#include "palette.h"\r
+#include "palettes/palettes.h"\r
+\r
+#include "svga.h"\r
+\r
+#ifndef M_PI\r
+#define M_PI 3.14159265358979323846\r
+#endif\r
+\r
+static int ntsccol=0;\r
+static int ntsctint=46+10;\r
+static int ntschue=72;\r
+\r
+/* These are dynamically filled/generated palettes: */\r
+pal palettei[64];       // Custom palette for an individual game.\r
+pal palettec[64];       // Custom "global" palette.\r
+pal paletten[64];       // Mathematically generated palette.\r
+\r
+static void CalculatePalette(void);\r
+static void ChoosePalette(void);\r
+static void WritePalette(void);\r
+uint8 pale=0;\r
+\r
+pal *palo;\r
+static pal *palpoint[8]=\r
+     {\r
+     palette,\r
+     rp2c04001,\r
+     rp2c04002,\r
+     rp2c04003,\r
+     rp2c05004,\r
+     };\r
+\r
+void FCEUI_SetPaletteArray(uint8 *pal)\r
+{\r
+ if(!pal)\r
+  palpoint[0]=palette;\r
+ else\r
+ {\r
+  int x;\r
+  palpoint[0]=palettec;\r
+  for(x=0;x<64;x++)\r
+  {\r
+   palpoint[0][x].r=*((uint8 *)pal+x+x+x);\r
+   palpoint[0][x].g=*((uint8 *)pal+x+x+x+1);\r
+   palpoint[0][x].b=*((uint8 *)pal+x+x+x+2);\r
+  }\r
+ }\r
+ FCEU_ResetPalette();\r
+}\r
+\r
+\r
+void FCEUI_SetNTSCTH(int n, int tint, int hue)\r
+{\r
+ ntsctint=tint;\r
+ ntschue=hue;\r
+ ntsccol=n;\r
+ FCEU_ResetPalette();\r
+}\r
+\r
+static uint8 lastd=0;\r
+void SetNESDeemph(uint8 d, int force)\r
+{\r
+ static uint16 rtmul[7]={32768*1.239,32768*.794,32768*1.019,32768*.905,32768*1.023,32768*.741,32768*.75};\r
+ static uint16 gtmul[7]={32768*.915,32768*1.086,32768*.98,32768*1.026,32768*.908,32768*.987,32768*.75};\r
+ static uint16 btmul[7]={32768*.743,32768*.882,32768*.653,32768*1.277,32768*.979,32768*.101,32768*.75};\r
+ uint32 r,g,b;\r
+ int x;\r
+\r
+ /* If it's not forced(only forced when the palette changes),\r
+    don't waste cpu time if the same deemphasis bits are set as the last call.\r
+ */\r
+ if(!force)\r
+ {\r
+  if(d==lastd)\r
+   return;\r
+ }\r
+ else   /* Only set this when palette has changed. */\r
+ {\r
+  r=rtmul[6];\r
+  g=rtmul[6];\r
+  b=rtmul[6];\r
+\r
+  for(x=0;x<0x40;x++)\r
+  {\r
+   uint32 m,n,o;\r
+   m=palo[x].r;\r
+   n=palo[x].g;\r
+   o=palo[x].b;\r
+   m=(m*r)>>15;\r
+   n=(n*g)>>15;\r
+   o=(o*b)>>15;\r
+   if(m>0xff) m=0xff;\r
+   if(n>0xff) n=0xff;\r
+   if(o>0xff) o=0xff;\r
+   FCEUD_SetPalette(x|0xC0,m,n,o);\r
+  }\r
+ }\r
+ if(!d) return; /* No deemphasis, so return. */\r
+\r
+ r=rtmul[d-1];\r
+ g=gtmul[d-1];\r
+ b=btmul[d-1];\r
+\r
+ for(x=0;x<0x40;x++)\r
+ {\r
+  uint32 m,n,o;\r
+\r
+  m=palo[x].r;\r
+  n=palo[x].g;\r
+  o=palo[x].b;\r
+  m=(m*r)>>15;\r
+  n=(n*g)>>15;\r
+  o=(o*b)>>15;\r
+  if(m>0xff) m=0xff;\r
+  if(n>0xff) n=0xff;\r
+  if(o>0xff) o=0xff;\r
+\r
+  FCEUD_SetPalette(x|0x40,m,n,o);\r
+ }\r
+\r
+ lastd=d;\r
+}\r
+\r
+/* Converted from Kevin Horton's qbasic palette generator. */\r
+static void CalculatePalette(void)\r
+{\r
+ int x,z;\r
+ int r,g,b;\r
+ double s,luma,theta;\r
+ static uint8 cols[16]={0,24,21,18,15,12,9,6,3,0,33,30,27,0,0,0};\r
+ static uint8 br1[4]={6,9,12,12};\r
+ static double br2[4]={.29,.45,.73,.9};\r
+ static double br3[4]={0,.24,.47,.77};\r
+\r
+ for(x=0;x<=3;x++)\r
+  for(z=0;z<16;z++)\r
+  {\r
+   s=(double)ntsctint/128;\r
+   luma=br2[x];\r
+   if(z==0)  {s=0;luma=((double)br1[x])/12;}\r
+\r
+   if(z>=13)\r
+   {\r
+    s=luma=0;\r
+    if(z==13)\r
+     luma=br3[x];\r
+   }\r
+\r
+   theta=(double)M_PI*(double)(((double)cols[z]*10+ (((double)ntschue/2)+300) )/(double)180);\r
+   r=(int)((luma+s*sin(theta))*256);\r
+   g=(int)((luma-(double)27/53*s*sin(theta)+(double)10/53*s*cos(theta))*256);\r
+   b=(int)((luma-s*cos(theta))*256);\r
+\r
+\r
+   if(r>255) r=255;\r
+   if(g>255) g=255;\r
+   if(b>255) b=255;\r
+   if(r<0) r=0;\r
+   if(g<0) g=0;\r
+   if(b<0) b=0;\r
+\r
+   paletten[(x<<4)+z].r=r;\r
+   paletten[(x<<4)+z].g=g;\r
+   paletten[(x<<4)+z].b=b;\r
+  }\r
+ WritePalette();\r
+}\r
+\r
+static int ipalette=0;\r
+\r
+void FCEU_LoadGamePalette(void)\r
+{\r
+  uint8 ptmp[192];\r
+  FILE *fp;\r
+  char *fn;\r
+\r
+  ipalette=0;\r
+\r
+  fn=FCEU_MakeFName(FCEUMKF_PALETTE,0,0);\r
+\r
+  if((fp=fopen(fn,"rb")))\r
+  {\r
+   int x;\r
+   fread(ptmp,1,192,fp);\r
+   fclose(fp);\r
+   for(x=0;x<64;x++)\r
+   {\r
+    palettei[x].r=ptmp[x+x+x];\r
+    palettei[x].g=ptmp[x+x+x+1];\r
+    palettei[x].b=ptmp[x+x+x+2];\r
+   }\r
+   ipalette=1;\r
+  }\r
+  free(fn);\r
+}\r
+\r
+void FCEU_ResetPalette(void)\r
+{\r
+ //if(FCEUGameInfo)\r
+ {\r
+   ChoosePalette();\r
+   WritePalette();\r
+ }\r
+}\r
+\r
+static void ChoosePalette(void)\r
+{\r
+    if(FCEUGameInfo.type==GIT_NSF)\r
+     palo=0;\r
+    else if(ipalette)\r
+     palo=palettei;\r
+    else if(ntsccol && !PAL && FCEUGameInfo.type!=GIT_VSUNI)\r
+     {\r
+      palo=paletten;\r
+      CalculatePalette();\r
+     }\r
+    else\r
+     palo=palpoint[pale];\r
+}\r
+\r
+void WritePalette(void)\r
+{\r
+    int x;\r
+\r
+    for(x=0;x<7;x++)\r
+     FCEUD_SetPalette(128+x,unvpalette[x].r,unvpalette[x].g,unvpalette[x].b);\r
+    if(FCEUGameInfo.type==GIT_NSF)\r
+    {\r
+     //for(x=0;x<128;x++)\r
+     // FCEUD_SetPalette(x,x,0,x);\r
+     for(x=0;x<7;x++)\r
+      FCEUD_SetPalette(x,unvpalette[x].r,unvpalette[x].g,unvpalette[x].b);\r
+    }\r
+    else\r
+    {\r
+     for(x=0;x<64;x++)\r
+      FCEUD_SetPalette(x,palo[x].r,palo[x].g,palo[x].b);\r
+     SetNESDeemph(lastd,1);\r
+    }\r
+}\r
+\r
+void FCEUI_GetNTSCTH(int *tint, int *hue)\r
+{\r
+ *tint=ntsctint;\r
+ *hue=ntschue;\r
+}\r
+\r
+static int controlselect=0;\r
+static int controllength=0;\r
+\r
+void FCEUI_NTSCDEC(void)\r
+{\r
+       if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI &&!PAL && FCEUGameInfo.type!=GIT_NSF)\r
+        {\r
+         int which;\r
+         if(controlselect)\r
+         {\r
+          if(controllength)\r
+          {\r
+           which=controlselect==1?ntschue:ntsctint;\r
+           which--;\r
+           if(which<0) which=0;\r
+           if(controlselect==1)\r
+            ntschue=which;\r
+           else ntsctint=which;\r
+           CalculatePalette();\r
+          }\r
+          controllength=360;\r
+         }\r
+       }\r
+}\r
+\r
+void FCEUI_NTSCINC(void)\r
+{\r
+                   if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF)\r
+                     if(controlselect)\r
+                     {\r
+                      if(controllength)\r
+                      {\r
+                       switch(controlselect)\r
+                       {\r
+                        case 1:ntschue++;\r
+                               if(ntschue>128) ntschue=128;\r
+                               CalculatePalette();\r
+                               break;\r
+                        case 2:ntsctint++;\r
+                               if(ntsctint>128) ntsctint=128;\r
+                               CalculatePalette();\r
+                               break;\r
+                       }\r
+                      }\r
+                      controllength=360;\r
+                     }\r
+}\r
+\r
+void FCEUI_NTSCSELHUE(void)\r
+{\r
+ if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF){controlselect=1;controllength=360;}\r
+}\r
+\r
+void FCEUI_NTSCSELTINT(void)\r
+{\r
+ if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF){controlselect=2;controllength=360;}\r
+}\r
+\r
+void FCEU_DrawNTSCControlBars(uint8 *XBuf)\r
+{\r
+ uint8 *XBaf;\r
+ int which=0;\r
+ int x,x2;\r
+\r
+ if(!controllength) return;\r
+ controllength--;\r
+ if(!XBuf) return;\r
+\r
+ if(controlselect==1)\r
+ {\r
+  DrawTextTrans(XBuf+128-12+180*256, 256, (uint8 *)"Hue", 0x85);\r
+  which=ntschue<<1;\r
+ }\r
+ else if(controlselect==2)\r
+ {\r
+  DrawTextTrans(XBuf+128-16+180*256, 256, (uint8 *)"Tint", 0x85);\r
+  which=ntsctint<<1;\r
+ }\r
+\r
+ XBaf=XBuf+200*256;\r
+ for(x=0;x<which;x+=2)\r
+ {\r
+  for(x2=6;x2>=-6;x2--)\r
+  {\r
+   XBaf[x-256*x2]=0x85;\r
+  }\r
+ }\r
+ for(;x<256;x+=2)\r
+ {\r
+  for(x2=2;x2>=-2;x2--)\r
+   XBaf[x-256*x2]=0x85;\r
+ }\r
+}\r
index 9a4647c..8560d9d 100644 (file)
--- a/palette.h
+++ b/palette.h
-pal rp2c04001[64] = {
- #include "palettes/rp2c04001.h"
-};
+typedef struct {
+       uint8 r,g,b;
+} pal;
 
 
-pal NSFPalette[39] = {
- #include "palettes/nsfnew.h"
-};
+extern pal *palo;
 
 
-pal palettevseb[64] = {
-#include "palettes/vseb.h"
-};
-
-pal palettevsslalom[64] = {
-#include "palettes/vsslalom.h"
-};
-
-pal palettevsgoon[64] = {
-#include "palettes/vsgoonies.h"
-};
-
-pal palettevsgrad[64] = {
-#include "palettes/vsplatoon.h"
-};
-
-pal palettevscv[64] = {
-#include "palettes/vscv.h"
-};
-
-pal palettevssmb[64] = {
-#include "palettes/vssmb.h"
-};
-
-pal palettevsmar[64] = {
-#include "palettes/vsmar.h"
-};
-
-pal unvpalette[6] = {
-{ 0x00<<2,0x00<<2,0x00<<2}, // Black
-{ 0x3F<<2,0x3F<<2,0x34<<2}, // White
-{ 0x00<<2,0x00<<2,0x00<<2}, // Black
-{ 0x1d<<2,0x1d<<2,0x24<<2}, // Greyish
-{ 190,0,0    }, // Redish
-{ 51,255,51}, // Bright green
-};
-
-
-/* These are dynamically filled/generated palettes: */
-pal palettei[64];      // Custom palette for an individual game.
-pal palettec[64];      // Custom "global" palette.
-pal paletten[64];      // Mathematically generated palette.
-
-
-/* Default palette */
-pal palette[64] = {
-
-        { 0x1D<<2, 0x1D<<2, 0x1D<<2 }, /* Value 0 */
-        { 0x09<<2, 0x06<<2, 0x23<<2 }, /* Value 1 */
-        { 0x00<<2, 0x00<<2, 0x2A<<2 }, /* Value 2 */
-        { 0x11<<2, 0x00<<2, 0x27<<2 }, /* Value 3 */
-        { 0x23<<2, 0x00<<2, 0x1D<<2 }, /* Value 4 */
-        { 0x2A<<2, 0x00<<2, 0x04<<2 }, /* Value 5 */
-        { 0x29<<2, 0x00<<2, 0x00<<2 }, /* Value 6 */
-        { 0x1F<<2, 0x02<<2, 0x00<<2 }, /* Value 7 */
-        { 0x10<<2, 0x0B<<2, 0x00<<2 }, /* Value 8 */
-        { 0x00<<2, 0x11<<2, 0x00<<2 }, /* Value 9 */
-        { 0x00<<2, 0x14<<2, 0x00<<2 }, /* Value 10 */
-        { 0x00<<2, 0x0F<<2, 0x05<<2 }, /* Value 11 */
-        { 0x06<<2, 0x0F<<2, 0x17<<2 }, /* Value 12 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 13 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 14 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 15 */
-        { 0x2F<<2, 0x2F<<2, 0x2F<<2 }, /* Value 16 */
-        { 0x00<<2, 0x1C<<2, 0x3B<<2 }, /* Value 17 */
-        { 0x08<<2, 0x0E<<2, 0x3B<<2 }, /* Value 18 */
-        { 0x20<<2, 0x00<<2, 0x3C<<2 }, /* Value 19 */
-        { 0x2F<<2, 0x00<<2, 0x2F<<2 }, /* Value 20 */
-        { 0x39<<2, 0x00<<2, 0x16<<2 }, /* Value 21 */
-        { 0x36<<2, 0x0A<<2, 0x00<<2 }, /* Value 22 */
-        { 0x32<<2, 0x13<<2, 0x03<<2 }, /* Value 23 */
-        { 0x22<<2, 0x1C<<2, 0x00<<2 }, /* Value 24 */
-        { 0x00<<2, 0x25<<2, 0x00<<2 }, /* Value 25 */
-        { 0x00<<2, 0x2A<<2, 0x00<<2 }, /* Value 26 */
-        { 0x00<<2, 0x24<<2, 0x0E<<2 }, /* Value 27 */
-        { 0x00<<2, 0x20<<2, 0x22<<2 }, /* Value 28 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 29 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 30 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 31 */
-        { 0x3F<<2, 0x3F<<2, 0x3F<<2 }, /* Value 32 */
-        { 0x0F<<2, 0x2F<<2, 0x3F<<2 }, /* Value 33 */
-        { 0x17<<2, 0x25<<2, 0x3F<<2 }, /* Value 34 */
-        { 0x10<<2, 0x22<<2, 0x3F<<2 }, /* Value 35 */
-        { 0x3D<<2, 0x1E<<2, 0x3F<<2 }, /* Value 36 */
-        { 0x3F<<2, 0x1D<<2, 0x2D<<2 }, /* Value 37 */
-        { 0x3F<<2, 0x1D<<2, 0x18<<2 }, /* Value 38 */
-        { 0x3F<<2, 0x26<<2, 0x0E<<2 }, /* Value 39 */
-        { 0x3C<<2, 0x2F<<2, 0x0F<<2 }, /* Value 40 */
-        { 0x20<<2, 0x34<<2, 0x04<<2 }, /* Value 41 */
-        { 0x13<<2, 0x37<<2, 0x12<<2 }, /* Value 42 */
-        { 0x16<<2, 0x3E<<2, 0x26<<2 }, /* Value 43 */
-        { 0x00<<2, 0x3A<<2, 0x36<<2 }, /* Value 44 */
-        { 0x1E<<2, 0x1E<<2, 0x1E<<2 }, /* Value 45 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 46 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 47 */
-        { 0x3F<<2, 0x3F<<2, 0x3F<<2 }, /* Value 48 */
-        { 0x2A<<2, 0x39<<2, 0x3F<<2 }, /* Value 49 */
-        { 0x31<<2, 0x35<<2, 0x3F<<2 }, /* Value 50 */
-        { 0x35<<2, 0x32<<2, 0x3F<<2 }, /* Value 51 */
-        { 0x3F<<2, 0x31<<2, 0x3F<<2 }, /* Value 52 */
-        { 0x3F<<2, 0x31<<2, 0x36<<2 }, /* Value 53 */
-        { 0x3F<<2, 0x2F<<2, 0x2C<<2 }, /* Value 54 */
-        { 0x3F<<2, 0x36<<2, 0x2A<<2 }, /* Value 55 */
-        { 0x3F<<2, 0x39<<2, 0x28<<2 }, /* Value 56 */
-        { 0x38<<2, 0x3F<<2, 0x28<<2 }, /* Value 57 */
-        { 0x2A<<2, 0x3C<<2, 0x2F<<2 }, /* Value 58 */
-        { 0x2C<<2, 0x3F<<2, 0x33<<2 }, /* Value 59 */
-        { 0x27<<2, 0x3F<<2, 0x3C<<2 }, /* Value 60 */
-        { 0x31<<2, 0x31<<2, 0x31<<2 }, /* Value 61 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 62 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 63 */
-};
+void FCEU_ResetPalette(void);
+void FCEU_ResetMessages();
+void FCEU_LoadGamePalette(void);
+void FCEU_DrawNTSCControlBars(uint8 *XBuf);
diff --git a/palettes/nsfnew.h b/palettes/nsfnew.h
deleted file mode 100644 (file)
index 7ee0068..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-{0<<2,14<<2,3<<2},
-{0<<2,13<<2,3<<2},
-{0<<2,12<<2,3<<2},
-{0<<2,11<<2,3<<2},
-{0<<2,15<<2,3<<2},
-{0<<2,15<<2,4<<2},
-{0<<2,16<<2,4<<2},
-{0<<2,17<<2,4<<2},
-{0<<2,18<<2,4<<2},
-{0<<2,19<<2,4<<2},
-{0<<2,20<<2,5<<2},
-{0<<2,20<<2,4<<2},
-{0<<2,21<<2,5<<2},
-{0<<2,22<<2,5<<2},
-{0<<2,23<<2,5<<2},
-{0<<2,24<<2,5<<2},
-{0<<2,24<<2,6<<2},
-{0<<2,25<<2,6<<2},
-{0<<2,26<<2,6<<2},
-{0<<2,27<<2,6<<2},
-{0<<2,28<<2,6<<2},
-{0<<2,28<<2,7<<2},
-{0<<2,29<<2,7<<2},
-{0<<2,30<<2,7<<2},
-{0<<2,11<<2,2<<2},
-{0<<2,10<<2,2<<2},
-{0<<2,9<<2,2<<2},
-{0<<2,8<<2,2<<2},
-{0<<2,7<<2,1<<2},
-{0<<2,7<<2,2<<2},
-{0<<2,6<<2,1<<2},
-{0<<2,5<<2,1<<2},
-{0<<2,4<<2,1<<2},
-{0<<2,3<<2,1<<2},
-{0<<2,2<<2,0<<2},
-{0<<2,3<<2,0<<2},
-{0<<2,1<<2,0<<2},
-{0<<2,0<<2,0<<2},
-{3<<2,0<<2,43<<2},
index ed6c2db..7db6220 100644 (file)
@@ -27,68 +27,203 @@ pal unvpalette[7] = {
 /* Default palette */
 pal palette[64] = {
 
 /* Default palette */
 pal palette[64] = {
 
-        { 0x1D<<2, 0x1D<<2, 0x1D<<2 }, /* Value 0 */
-        { 0x09<<2, 0x06<<2, 0x23<<2 }, /* Value 1 */
-        { 0x00<<2, 0x00<<2, 0x2A<<2 }, /* Value 2 */
-        { 0x11<<2, 0x00<<2, 0x27<<2 }, /* Value 3 */
-        { 0x23<<2, 0x00<<2, 0x1D<<2 }, /* Value 4 */
-        { 0x2A<<2, 0x00<<2, 0x04<<2 }, /* Value 5 */
-        { 0x29<<2, 0x00<<2, 0x00<<2 }, /* Value 6 */
-        { 0x1F<<2, 0x02<<2, 0x00<<2 }, /* Value 7 */
-        { 0x10<<2, 0x0B<<2, 0x00<<2 }, /* Value 8 */
-        { 0x00<<2, 0x11<<2, 0x00<<2 }, /* Value 9 */
-        { 0x00<<2, 0x14<<2, 0x00<<2 }, /* Value 10 */
-        { 0x00<<2, 0x0F<<2, 0x05<<2 }, /* Value 11 */
-        { 0x06<<2, 0x0F<<2, 0x17<<2 }, /* Value 12 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 13 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 14 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 15 */
-        { 0x2F<<2, 0x2F<<2, 0x2F<<2 }, /* Value 16 */
-        { 0x00<<2, 0x1C<<2, 0x3B<<2 }, /* Value 17 */
-        { 0x08<<2, 0x0E<<2, 0x3B<<2 }, /* Value 18 */
-        { 0x20<<2, 0x00<<2, 0x3C<<2 }, /* Value 19 */
-        { 0x2F<<2, 0x00<<2, 0x2F<<2 }, /* Value 20 */
-        { 0x39<<2, 0x00<<2, 0x16<<2 }, /* Value 21 */
-        { 0x36<<2, 0x0A<<2, 0x00<<2 }, /* Value 22 */
-        { 0x32<<2, 0x13<<2, 0x03<<2 }, /* Value 23 */
-        { 0x22<<2, 0x1C<<2, 0x00<<2 }, /* Value 24 */
-        { 0x00<<2, 0x25<<2, 0x00<<2 }, /* Value 25 */
-        { 0x00<<2, 0x2A<<2, 0x00<<2 }, /* Value 26 */
-        { 0x00<<2, 0x24<<2, 0x0E<<2 }, /* Value 27 */
-        { 0x00<<2, 0x20<<2, 0x22<<2 }, /* Value 28 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 29 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 30 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 31 */
-        { 0x3F<<2, 0x3F<<2, 0x3F<<2 }, /* Value 32 */
-        { 0x0F<<2, 0x2F<<2, 0x3F<<2 }, /* Value 33 */
-        { 0x17<<2, 0x25<<2, 0x3F<<2 }, /* Value 34 */
-        { 0x10<<2, 0x22<<2, 0x3F<<2 }, /* Value 35 */
-        { 0x3D<<2, 0x1E<<2, 0x3F<<2 }, /* Value 36 */
-        { 0x3F<<2, 0x1D<<2, 0x2D<<2 }, /* Value 37 */
-        { 0x3F<<2, 0x1D<<2, 0x18<<2 }, /* Value 38 */
-        { 0x3F<<2, 0x26<<2, 0x0E<<2 }, /* Value 39 */
-        { 0x3C<<2, 0x2F<<2, 0x0F<<2 }, /* Value 40 */
-        { 0x20<<2, 0x34<<2, 0x04<<2 }, /* Value 41 */
-        { 0x13<<2, 0x37<<2, 0x12<<2 }, /* Value 42 */
-        { 0x16<<2, 0x3E<<2, 0x26<<2 }, /* Value 43 */
-        { 0x00<<2, 0x3A<<2, 0x36<<2 }, /* Value 44 */
-        { 0x1E<<2, 0x1E<<2, 0x1E<<2 }, /* Value 45 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 46 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 47 */
-        { 0x3F<<2, 0x3F<<2, 0x3F<<2 }, /* Value 48 */
-        { 0x2A<<2, 0x39<<2, 0x3F<<2 }, /* Value 49 */
-        { 0x31<<2, 0x35<<2, 0x3F<<2 }, /* Value 50 */
-        { 0x35<<2, 0x32<<2, 0x3F<<2 }, /* Value 51 */
-        { 0x3F<<2, 0x31<<2, 0x3F<<2 }, /* Value 52 */
-        { 0x3F<<2, 0x31<<2, 0x36<<2 }, /* Value 53 */
-        { 0x3F<<2, 0x2F<<2, 0x2C<<2 }, /* Value 54 */
-        { 0x3F<<2, 0x36<<2, 0x2A<<2 }, /* Value 55 */
-        { 0x3F<<2, 0x39<<2, 0x28<<2 }, /* Value 56 */
-        { 0x38<<2, 0x3F<<2, 0x28<<2 }, /* Value 57 */
-        { 0x2A<<2, 0x3C<<2, 0x2F<<2 }, /* Value 58 */
-        { 0x2C<<2, 0x3F<<2, 0x33<<2 }, /* Value 59 */
-        { 0x27<<2, 0x3F<<2, 0x3C<<2 }, /* Value 60 */
-        { 0x31<<2, 0x31<<2, 0x31<<2 }, /* Value 61 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 62 */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 63 */
+        {0x60, 0x60, 0x60}, /* Value 0 */
+        {0x00, 0x00, 0x70}, /* Value 1 */
+        {0x14, 0x00, 0x80}, /* Value 2 */
+        {0x2C, 0x00, 0x6E}, /* Value 3 */
+        {0x4A, 0x00, 0x4E}, /* Value 4 */
+        {0x6C, 0x00, 0x18}, /* Value 5 */
+        {0x5A, 0x03, 0x02}, /* Value 6 */
+        {0x51, 0x18, 0x00}, /* Value 7 */
+        {0x34, 0x24, 0x00}, /* Value 8 */
+        {0x00, 0x34, 0x00}, /* Value 9 */
+        {0x00, 0x32, 0x00}, /* Value 10 */
+        {0x00, 0x34, 0x20}, /* Value 11 */
+        {0x00, 0x2C, 0x78}, /* Value 12 */
+        {0x00, 0x00, 0x00}, /* Value 13 */
+        {0x02, 0x02, 0x02}, /* Value 14 */
+        {0x02, 0x02, 0x02}, /* Value 15 */
+        {0xC4, 0xC4, 0xC4}, /* Value 16 */
+        {0x00, 0x58, 0xDE}, /* Value 17 */
+        {0x30, 0x1F, 0xFC}, /* Value 18 */
+        {0x7F, 0x14, 0xE0}, /* Value 19 */
+        {0xA8, 0x00, 0xB0}, /* Value 20 */
+        {0xC0, 0x06, 0x5C}, /* Value 21 */
+        {0xC0, 0x2B, 0x0E}, /* Value 22 */
+        {0xA6, 0x40, 0x10}, /* Value 23 */
+        {0x6F, 0x61, 0x00}, /* Value 24 */
+        {0x30, 0x80, 0x00}, /* Value 25 */
+        {0x00, 0x7C, 0x00}, /* Value 26 */
+        {0x00, 0x7C, 0x3C}, /* Value 27 */
+        {0x00, 0x6E, 0x84}, /* Value 28 */
+        {0x14, 0x14, 0x14}, /* Value 29 */
+        {0x04, 0x04, 0x04}, /* Value 30 */
+        {0x04, 0x04, 0x04}, /* Value 31 */
+        {0xF0, 0xF0, 0xF0}, /* Value 32 */
+        {0x4C, 0xAA, 0xFF}, /* Value 33 */
+        {0x6F, 0x73, 0xF5}, /* Value 34 */
+        {0xB0, 0x70, 0xFF}, /* Value 35 */
+        {0xDA, 0x5A, 0xFF}, /* Value 36 */
+        {0xF0, 0x60, 0xC0}, /* Value 37 */
+        {0xF8, 0x83, 0x6D}, /* Value 38 */
+        {0xD0, 0x90, 0x30}, /* Value 39 */
+        {0xD4, 0xC0, 0x30}, /* Value 40 */
+        {0x66, 0xD0, 0x00}, /* Value 41 */
+        {0x26, 0xDD, 0x1A}, /* Value 42 */
+        {0x2E, 0xC8, 0x66}, /* Value 43 */
+        {0x34, 0xC2, 0xBE}, /* Value 44 */
+        {0x54, 0x54, 0x54}, /* Value 45 */
+        {0x06, 0x06, 0x06}, /* Value 46 */
+        {0x06, 0x06, 0x06}, /* Value 47 */
+        {0xFF, 0xFF, 0xFF}, /* Value 48 */
+        {0xB6, 0xDA, 0xFF}, /* Value 49 */
+        {0xC8, 0xCA, 0xFF}, /* Value 50 */
+        {0xDA, 0xC2, 0xFF}, /* Value 51 */
+        {0xF0, 0xBE, 0xFF}, /* Value 52 */
+        {0xFC, 0xBC, 0xEE}, /* Value 53 */
+        {0xFF, 0xD0, 0xB4}, /* Value 54 */
+        {0xFF, 0xDA, 0x90}, /* Value 55 */
+        {0xEC, 0xEC, 0x92}, /* Value 56 */
+        {0xDC, 0xF6, 0x9E}, /* Value 57 */
+        {0xB8, 0xFF, 0xA2}, /* Value 58 */
+        {0xAE, 0xEA, 0xBE}, /* Value 59 */
+        {0x9E, 0xEF, 0xEF}, /* Value 60 */
+        {0xBE, 0xBE, 0xBE}, /* Value 61 */
+        {0x08, 0x08, 0x08}, /* Value 62 */
+        {0x08, 0x08, 0x08}, /* Value 63 */
+/*
+// old palette:
+74, 74, 74
+24, 18, 8C
+00, 00, A8
+44, 00, 9C
+8C, 00, 74
+A8, 00, 10
+A4, 00, 00
+7C, 08, 00
+40, 2C, 00
+00, 44, 00
+00, 50, 00
+00, 3C, 14
+18, 3C, 5C
+00, 00, 00
+00, 00, 00
+00, 00, 00
+BC, BC, BC
+00, 70, EC
+20, 38, EC
+80, 00, F0
+BC, 00, BC
+E4, 00, 58
+D8, 28, 00
+C8, 4C, 0C
+88, 70, 00
+00, 94, 00
+00, A8, 00
+00, 90, 38
+00, 80, 88
+00, 00, 00
+00, 00, 00
+00, 00, 00
+FC, FC, FC
+3C, BC, FC
+5C, 94, FC
+40, 88, FC
+F4, 78, FC
+FC, 74, B4
+FC, 74, 60
+FC, 98, 38
+F0, BC, 3C
+80, D0, 10
+4C, DC, 48
+58, F8, 98
+00, E8, D8
+78, 78, 78
+00, 00, 00
+00, 00, 00
+FC, FC, FC
+A8, E4, FC
+C4, D4, FC
+D4, C8, FC
+FC, C4, FC
+FC, C4, D8
+FC, BC, B0
+FC, D8, A8
+FC, E4, A0
+E0, FC, A0
+A8, F0, BC
+B0, FC, CC
+9C, FC, F0
+C4, C4, C4
+00, 00, 00
+00, 00, 00
+
+slightly better but too dark:
+0x5C, 0x5C, 0x5C
+0x00, 0x20, 0x74
+0x00, 0x00, 0x98
+0x30, 0x00, 0x84
+0x58, 0x00, 0x68
+0x68, 0x00, 0x30
+0x60, 0x00, 0x00
+0x48, 0x10, 0x00
+0x28, 0x18, 0x00
+0x20, 0x28, 0x00
+0x00, 0x40, 0x00
+0x00, 0x38, 0x30
+0x00, 0x38, 0x48
+0x00, 0x00, 0x00
+0x10, 0x10, 0x10
+0x10, 0x10, 0x10
+0xAA, 0xAA, 0xAA
+0x18, 0x54, 0xBC
+0x28, 0x30, 0xF8
+0x68, 0x20, 0xD8
+0xA8, 0x00, 0xB8
+0xB8, 0x14, 0x5C
+0xB8, 0x18, 0x10
+0x8C, 0x38, 0x0C
+0x60, 0x50, 0x00
+0x3C, 0x60, 0x00
+0x00, 0x78, 0x00
+0x00, 0x70, 0x4C
+0x00, 0x70, 0x80
+0xFF, 0xFF, 0x10
+0x10, 0xFF, 0xFF
+0x10, 0x10, 0xFF
+0xFF, 0xFF, 0xFF
+0x4C, 0x9C, 0xEC
+0x78, 0x80, 0xFF
+0xAC, 0x70, 0xFF
+0xE0, 0x60, 0xF0
+0xFC, 0x68, 0xA4
+0xFF, 0x70, 0x68
+0xE2, 0x92, 0x38
+0xBB, 0xAB, 0x00
+0x7E, 0xC2, 0x1C
+0x40, 0xD0, 0x30
+0x28, 0xC4, 0x80
+0x20, 0xB8, 0xC0
+0x48, 0x48, 0x48
+0x10, 0x10, 0x10
+0x10, 0x10, 0x10
+0xFF, 0xFF, 0xFF
+0xB4, 0xD4, 0xFF
+0xC0, 0xC8, 0xFF
+0xD8, 0xC4, 0xFF
+0xF0, 0xC0, 0xFF
+0xFF, 0xC4, 0xD8
+0xFF, 0xC8, 0xC0
+0xF8, 0xD4, 0xAC
+0xE8, 0xE0, 0x98
+0xD0, 0xE8, 0xA0
+0xB8, 0xF0, 0xA8
+0xA8, 0xE8, 0xD0
+0xA8, 0xE0, 0xE8
+0xB2, 0xB2, 0xB2
+0x10, 0xFF, 0x10
+0xFF, 0x10, 0x10
+
+*/
+
 };
 };
diff --git a/palettes/rp2c04001.old b/palettes/rp2c04001.old
deleted file mode 100644 (file)
index f2526b9..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{ 0x3f<<2, 0x31<<2, 0x36<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x36<<2, 0x0a<<2, 0x00<<2, },
-{ 0x17<<2, 0x25<<2, 0x3f<<2, },
-{ 0x00<<2, 0x20<<2, 0x22<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x39<<2, 0x00<<2, 0x16<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x1d<<2, 0x1d<<2, 0x1d<<2, },
-{ 0x3f<<2, 0x26<<2, 0x0e<<2, },
-{ 0x2a<<2, 0x00<<2, 0x04<<2, },
-{ 0x23<<2, 0x00<<2, 0x1d<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x10<<2, 0x0b<<2, 0x00<<2, },
-{ 0x3f<<2, 0x3f<<2, 0x3f<<2, },
-{ 0x0f<<2, 0x2f<<2, 0x3f<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x20<<2, 0x34<<2, 0x04<<2, },
-{ 0x27<<2, 0x3f<<2, 0x3c<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x3f<<2, 0x2f<<2, 0x2c<<2, },
-{ 0x08<<2, 0x0e<<2, 0x3b<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x16<<2, 0x3e<<2, 0x26<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x09<<2, 0x06<<2, 0x23<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x2a<<2, 0x39<<2, 0x3f<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x13<<2, 0x37<<2, 0x12<<2, },
-{ 0x00<<2, 0x3a<<2, 0x36<<2, },
-{ 0x06<<2, 0x0f<<2, 0x17<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x1f<<2, 0x02<<2, 0x00<<2, },
-{ 0x3f<<2, 0x31<<2, 0x3f<<2, },
-{ 0x29<<2, 0x00<<2, 0x00<<2, },
-{ 0x20<<2, 0x00<<2, 0x3c<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x3f<<2, 0x1d<<2, 0x18<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x25<<2, 0x00<<2, },
-{ 0x2f<<2, 0x2f<<2, 0x2f<<2, },
-{ 0x00<<2, 0x14<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x32<<2, 0x13<<2, 0x03<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x1c<<2, 0x3b<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
-{ 0x3f<<2, 0x1d<<2, 0x2d<<2, },
-{ 0x22<<2, 0x1c<<2, 0x00<<2, },
-{ 0x00<<2, 0x00<<2, 0x00<<2, },
diff --git a/palettes/vscv.h b/palettes/vscv.h
deleted file mode 100644 (file)
index 8220f30..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{127,127,127},
-{255,163,71},
-{0,0,191},
-{71,43,191},
-{151,0,135},
-{248,88,152},
-{171,19,0},
-{248,184,248},
-{191,0,0},
-{0,120,0},
-{0,107,0},
-{0,91,0},
-{255,255,255},
-{152,120,248},
-{0,0,0},
-{0,0,0},
-{191,191,191},
-{0,120,248},
-{171,19,0},
-{107,71,255},
-{0,174,0},
-{231,0,91},
-{248,56,0},
-{119,119,255},
-{175,127,0},
-{0,184,0},
-{0,171,0},
-{0,171,71},
-{0,139,139},
-{0,0,0},
-{0,0,0},
-{71,43,191},
-{248,248,248},
-{255,227,171},
-{248,120,88},
-{152,120,248},
-{0,120,248},
-{248,88,152},
-{191,191,191},
-{255,163,71},
-{200,0,200},
-{184,248,24},
-{127,127,127},
-{0,120,0},
-{0,235,219},
-{0,0,0},
-{0,0,0},
-{255,255,255},
-{255,255,255},
-{167,231,255},
-{91,219,87},
-{231,95,19},
-{0,67,88},
-{0,0,255},
-{231,0,91},
-{0,184,0},
-{251,219,123},
-{216,248,120},
-{139,23,0},
-{255,227,171},
-{0,255,255},
-{171,0,35},
-{0,0,0},
-{0,0,0},
diff --git a/palettes/vseb.h b/palettes/vseb.h
deleted file mode 100644 (file)
index 234d993..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x2a<<2, 0x00<<2},
-{0x3f<<2, 0x3f<<2, 0x3f<<2},
-{0x27<<2, 0x3f<<2, 0x3c<<2},
-{0x00<<2, 0x11<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x2a<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x3f<<2, 0x3f<<2, 0x3f<<2},
-{0x31<<2, 0x35<<2, 0x3f<<2},
-{0x31,0xa6,0xf6}, 
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x08<<2, 0x0e<<2, 0x3b<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x22<<2, 0x1c<<2, 0x00<<2},
-{0x32<<2, 0x13<<2, 0x03<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x06<<2, 0x0f<<2, 0x17<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x2a<<2},
-{0x36<<2, 0x0a<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x3f<<2, 0x36<<2, 0x2a<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0xd8,0xd6,0xb1}, 
-{0x3f<<2, 0x26<<2, 0x0e<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x20<<2, 0x34<<2, 0x04<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x0f<<2, 0x2f<<2, 0x3f<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x1c<<2, 0x3b<<2},  
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x2a<<2, 0x39<<2, 0x3f<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0xc6,0x9D,0x62}, 
-{0x13<<2, 0x37<<2, 0x12<<2},
-{0x3c<<2, 0x2f<<2, 0x0f<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x20<<2, 0x00<<2, 0x3c<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
-{0x00<<2, 0x00<<2, 0x00<<2},
diff --git a/palettes/vsgoonies.h b/palettes/vsgoonies.h
deleted file mode 100644 (file)
index 9dd272e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-        { 0x1D<<2, 0x1D<<2, 0x1D <<2}, /* Value 0 */
-        { 0x09<<2, 0x06<<2, 0x23 <<2}, /* Value 1 */
-        { 0x00<<2, 0x00<<2, 0x2A <<2}, /* Value 2 */
-        { 0x2f<<2, 0x2f<<2, 0x2f <<2}, /* Value 3 */
-        { 0x23<<2, 0x00<<2, 0x1D <<2}, /* Value 4 */
-        { 0x3f<<2, 0x3f<<2, 0x3f <<2}, /* Value 5 */
-        { 0x2a<<2, 0x39<<2, 0x3f <<2}, /* Value 6 */
-        { 0x1F<<2, 0x02<<2, 0x00 <<2}, /* Value 7 */
-        { 0x09<<2, 0x06<<2, 0x23 <<2}, /* Value 8 */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 9 */
-        { 0x3f<<2, 0x2f<<2, 0x2c <<2}, /* Value a */
-        { 0x00<<2, 0x0F<<2, 0x05 <<2}, /* Value b */
-        { 0x06<<2, 0x0F<<2, 0x17 <<2}, /* Value c */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value d */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value e */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value f */
-        { 0x2F<<2, 0x2F<<2, 0x2F <<2}, /* Value 10 */
-        { 0x00<<2, 0x1C<<2, 0x3B <<2}, /* Value 11 */
-        { 0x08<<2, 0x0E<<2, 0x3B <<2}, /* Value 12 */
-        { 0x08<<2, 0x0e<<2, 0x3b <<2}, /* Value 13 */
-        { 0x00<<2, 0x25<<2, 0x00 <<2}, /* Value 14 */
-        { 0x39<<2, 0x00<<2, 0x16 <<2}, /* Value 15 */ 
-        { 0x32<<2, 0x13<<2, 0x03 <<2}, /* Value 16 */
-        { 0x32<<2, 0x13<<2, 0x03 <<2}, /* Value 17 */
-        { 0x1d<<2, 0x1d<<2, 0x1d <<2}, /* Value 18 */
-        { 0x00<<2, 0x25<<2, 0x00 <<2}, /* Value 19 */
-        { 0x00<<2, 0x2A<<2, 0x00 <<2}, /* Value 1a */
-        { 0x00<<2, 0x00<<2, 0x2a <<2}, /* Value 1b */
-        { 0x36<<2, 0x0a<<2, 0x00 <<2}, /* Value 1c */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 1d */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 1e */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 1f */
-        { 0x3F<<2, 0x3F<<2, 0x3F <<2}, /* Value 20 */
-        { 0x0F<<2, 0x2F<<2, 0x3F <<2}, /* Value 21 */
-        { 0x17<<2, 0x25<<2, 0x3F <<2}, /* Value 22 */
-        { 0x10<<2, 0x22<<2, 0x3F <<2}, /* Value 23 */
-        { 0x3D<<2, 0x1E<<2, 0x3F <<2}, /* Value 24 */
-        { 0x3F<<2, 0x26<<2, 0x0e <<2}, /* Value 25 */
-        { 0x3F<<2, 0x1D<<2, 0x18 <<2}, /* Value 26 */
-        { 0x3F<<2, 0x3f<<2, 0x3f <<2}, /* Value 27 */
-        { 0x3C<<2, 0x2F<<2, 0x0F <<2}, /* Value 28 */
-        { 0x20<<2, 0x34<<2, 0x04 <<2}, /* Value 29 */
-        { 0x17<<2, 0x25<<2, 0x3f <<2}, /* Value 2a */
-        { 0x16<<2, 0x3E<<2, 0x26 <<2}, /* Value 2b */
-        { 0x00<<2, 0x1c<<2, 0x3b <<2}, /* Value 2c */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 2d */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 2e */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 2f */
-        { 0x3F<<2, 0x3F<<2, 0x3F <<2}, /* Value 30 */
-        { 0x2A<<2, 0x39<<2, 0x3F <<2}, /* Value 31 */
-        { 0x31<<2, 0x35<<2, 0x3F <<2}, /* Value 32 */
-        { 0x35<<2, 0x32<<2, 0x3F <<2}, /* Value 33 */
-        { 0x1F<<2, 0x02<<2, 0x00 <<2}, /* Value 34 */
-        { 0x3F<<2, 0x31<<2, 0x36 <<2}, /* Value 35 */
-        { 0x3F<<2, 0x2F<<2, 0x2C <<2}, /* Value 36 */
-        { 0x3F<<2, 0x36<<2, 0x2A <<2}, /* Value 37 */
-        { 0x3F<<2, 0x39<<2, 0x28 <<2}, /* Value 38 */
-        { 0x38<<2, 0x3F<<2, 0x28 <<2}, /* Value 39 */
-        { 0x2A<<2, 0x3C<<2, 0x2F <<2}, /* Value 3a */
-        { 0x2C<<2, 0x3F<<2, 0x33 <<2}, /* Value 3b */
-        { 0x27<<2, 0x3F<<2, 0x3C <<2}, /* Value 3c */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 3d */
-        { 0x00<<2, 0x00<<2, 0x00 <<2}, /* Value 3e */
-        { 0x06<<2, 0x0f<<2, 0x17 <<2}, /* Value 3f */
-
diff --git a/palettes/vsgrad.h b/palettes/vsgrad.h
deleted file mode 100644 (file)
index 3f8c6fe..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-        { 0x3f<<2, 0x31<<2, 0x36<<2 }, /* Value 0 */ // Done
-        { 0x09<<2, 0x06<<2, 0x23<<2 }, /* Value 1 */
-        { 0x36<<2, 0x0a<<2, 0x00<<2 }, /* Value 2 */ // Done
-        { 0x11<<2, 0x00<<2, 0x27<<2 }, /* Value 3 */
-        { 0x00<<2, 0x20<<2, 0x22<<2 }, /* Value 4 */ // Done
-        { 0x2A<<2, 0x00<<2, 0x04<<2 }, /* Value 5 */
-        { 0x29<<2, 0x00<<2, 0x00<<2 }, /* Value 6 */
-        { 0x1F<<2, 0x02<<2, 0x00<<2 }, /* Value 7 */
-        { 0x10<<2, 0x0B<<2, 0x00<<2 }, /* Value 8 */
-        { 0x00<<2, 0x11<<2, 0x00<<2 }, /* Value 9 */
-        { 0x3f<<2, 0x26<<2, 0x0e<<2 }, /* Value a */ // Done
-        { 0x00<<2, 0x0F<<2, 0x05<<2 }, /* Value b */
-        { 0x06<<2, 0x0F<<2, 0x17<<2 }, /* Value c */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value d */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value e */
-        { 0x3f<<2, 0x3f<<2, 0x3f<<2 }, /* Value f */ // Done
-        { 0x0F<<2, 0x2F<<2, 0x3F<<2 }, /* Value 10 */ //Done
-        { 0x00<<2, 0x1C<<2, 0x3B<<2 }, /* Value 11 */
-        { 0x08<<2, 0x0E<<2, 0x3B<<2 }, /* Value 12 */
-        { 0x20<<2, 0x00<<2, 0x3C<<2 }, /* Value 13 */
-        { 0x2F<<2, 0x00<<2, 0x2F<<2 }, /* Value 14 */
-        { 0x39<<2, 0x00<<2, 0x16<<2 }, /* Value 15 */ 
-        { 0x36<<2, 0x0A<<2, 0x00<<2 }, /* Value 16 */
-        { 0x08<<2, 0x0e<<2, 0x3b<<2 }, /* Value 17 */ // Done
-        { 0x22<<2, 0x1C<<2, 0x00<<2 }, /* Value 18 */
-        { 0x00<<2, 0x25<<2, 0x00<<2 }, /* Value 19 */
-        { 0x00<<2, 0x2A<<2, 0x00<<2 }, /* Value 1a */
-        { 0x00<<2, 0x24<<2, 0x0E<<2 }, /* Value 1b */
-        { 0x00<<2, 0x20<<2, 0x22<<2 }, /* Value 1c */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 1d */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 1e */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 1f */
-        { 0x3F<<2, 0x3F<<2, 0x3F<<2 }, /* Value 20 */
-        { 0x0F<<2, 0x2F<<2, 0x3F<<2 }, /* Value 21 */
-        { 0x17<<2, 0x25<<2, 0x3F<<2 }, /* Value 22 */
-        { 0x0f<<2, 0x2f<<2, 0x3f<<2 }, /* Value 23 */ // Done
-        { 0x00<<2, 0x3a<<2, 0x36<<2 }, /* Value 24 */ // Done
-        { 0x06<<2, 0x0f<<2, 0x17<<2 }, /* Value 25 */ // Done
-        { 0x3F<<2, 0x1D<<2, 0x18<<2 }, /* Value 26 */
-        { 0x3F<<2, 0x26<<2, 0x0E<<2 }, /* Value 27 */
-        { 0x3C<<2, 0x2F<<2, 0x0F<<2 }, /* Value 28 */
-        { 0x1f<<2, 0x02<<2, 0x00<<2 }, /* Value 29 */ // Done
-        { 0x13<<2, 0x37<<2, 0x12<<2 }, /* Value 2a */
-        { 0x29<<2, 0x00<<2, 0x00<<2 }, /* Value 2b */ // Done
-        { 0x00<<2, 0x3A<<2, 0x36<<2 }, /* Value 2c */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 2d */
-        { 0x3f<<2, 0x1d<<2, 0x18<<2 }, /* Value 2e */ // done
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 2f */ // done
-        { 0x3F<<2, 0x3F<<2, 0x3F<<2 }, /* Value 30 */
-        { 0x00<<2, 0x25<<2, 0x00<<2 }, /* Value 31 */ // Done
-        { 0x2f<<2, 0x2f<<2, 0x2F<<2 }, /* Value 32 */ // Done
-        { 0x35<<2, 0x32<<2, 0x3F<<2 }, /* Value 33 */
-        { 0x3F<<2, 0x31<<2, 0x3F<<2 }, /* Value 34 */
-        { 0x3F<<2, 0x31<<2, 0x36<<2 }, /* Value 35 */
-        { 0x3F<<2, 0x2F<<2, 0x2C<<2 }, /* Value 36 */
-        { 0x32<<2, 0x13<<2, 0x03<<2 }, /* Value 37 */ // Done
-        { 0x3F<<2, 0x39<<2, 0x28<<2 }, /* Value 38 */
-        { 0x38<<2, 0x3F<<2, 0x28<<2 }, /* Value 39 */
-        { 0x2A<<2, 0x3C<<2, 0x2F<<2 }, /* Value 3a */
-        { 0x2C<<2, 0x3F<<2, 0x33<<2 }, /* Value 3b */
-        { 0x27<<2, 0x3F<<2, 0x3C<<2 }, /* Value 3c */
-        { 0x3f<<2, 0x1d<<2, 0x2d<<2 }, /* Value 3d */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 3e */
-        { 0x00<<2, 0x00<<2, 0x00<<2 }, /* Value 3f */
-
diff --git a/palettes/vsmar.h b/palettes/vsmar.h
deleted file mode 100644 (file)
index 5eb7143..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{ 0x1d<<2, 0x1d<<2, 0x1d<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x11<<2, 0x00<<2, 0x27<<2 },
-{ 0x00<<2, 0x2a<<2, 0x00<<2 },
-{ 0x3f<<2, 0x3f<<2, 0x3f<<2 },
-{ 0x2a<<2, 0x39<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x39<<2, 0x00<<2, 0x16<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x17<<2, 0x25<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x22<<2, 0x1c<<2, 0x00<<2 },
-{ 0x32<<2, 0x13<<2, 0x03<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x1d<<2, 0x1d<<2, 0x1d<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x3f<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x26<<2, 0x0e<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x20<<2, 0x34<<2, 0x04<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x0f<<2, 0x2f<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x1c<<2, 0x3b<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x3a<<2, 0x36<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x3a<<2, 0x36<<2 },
-{ 0x3c<<2, 0x2f<<2, 0x0f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x14<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x31<<2, 0x35<<2, 0x3f<<2 },
-{ 0x3f<<2, 0x36<<2, 0x2a<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
diff --git a/palettes/vsplatoon.h b/palettes/vsplatoon.h
deleted file mode 100644 (file)
index 7d7dce4..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{63<<2,49<<2,54<<2},
-{9<<2,6<<2,35<<2},
-{54<<2,10<<2,0<<2},
-{17<<2,0<<2,39<<2},
-{0<<2,32<<2,34<<2},
-{0<<2,17<<2,0<<2},
-{41<<2,0<<2,0<<2},
-{63<<2,29<<2,45<<2},
-{63<<2,63<<2,63<<2},
-{0<<2,17<<2,0<<2},
-{63<<2,38<<2,14<<2},
-{42<<2,0<<2,4<<2},
-{6<<2,15<<2,23<<2},
-{32<<2,52<<2,4<<2},
-{0<<2,0<<2,0<<2},
-{63<<2,63<<2,63<<2},
-{15<<2,47<<2,63<<2},
-{0<<2,28<<2,59<<2},
-{8<<2,14<<2,59<<2},
-{63<<2,63<<2,63<<2},
-{47<<2,0<<2,47<<2},
-{57<<2,0<<2,22<<2},
-{63<<2,47<<2,44<<2},
-{8<<2,14<<2,59<<2},
-{34<<2,28<<2,0<<2},
-{0<<2,37<<2,0<<2},
-{0<<2,42<<2,0<<2},
-{0<<2,36<<2,14<<2},
-{0<<2,32<<2,34<<2},
-{0<<2,0<<2,0<<2},
-{0<<2,0<<2,0<<2},
-{0<<2,0<<2,0<<2},
-{63<<2,63<<2,63<<2},
-{15<<2,47<<2,63<<2},
-{23<<2,37<<2,63<<2},
-{19<<2,55<<2,18<<2},
-{0<<2,58<<2,54<<2},
-{6<<2,15<<2,23<<2},
-{63<<2,29<<2,24<<2},
-{63<<2,38<<2,14<<2},
-{60<<2,47<<2,15<<2},
-{31<<2,2<<2,0<<2},
-{19<<2,55<<2,18<<2},
-{41<<2,0<<2,0<<2},
-{0<<2,58<<2,54<<2},
-{0<<2,0<<2,0<<2},
-{63<<2,29<<2,24<<2},
-{0<<2,0<<2,0<<2},
-{63<<2,63<<2,63<<2},
-{0<<2,37<<2,0<<2},
-{47<<2,47<<2,47<<2},
-{0<<2,20<<2,0<<2},
-{63<<2,49<<2,63<<2},
-{63<<2,49<<2,54<<2},
-{63<<2,38<<2,14<<2},
-{54<<2,10<<2,0<<2},
-{63<<2,57<<2,40<<2},
-{15<<2,47<<2,63<<2},
-{42<<2,60<<2,47<<2},
-{44<<2,63<<2,51<<2},
-{39<<2,63<<2,60<<2},
-{63<<2,29<<2,45<<2},
-{34<<2,28<<2,0<<2},
-{0<<2,0<<2,0<<2}
diff --git a/palettes/vsslalom.h b/palettes/vsslalom.h
deleted file mode 100644 (file)
index 4328b1c..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x26<<2, 0x0e<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x1d<<2, 0x18<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x1d<<2, 0x2d<<2 },
-{ 0x3f<<2, 0x3f<<2, 0x3f<<2 },
-{ 0x2f<<2, 0x00<<2, 0x2f<<2 },
-{ 0x27<<2, 0x3f<<2, 0x3c<<2 },
-{ 0x00<<2, 0x25<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x0f<<2, 0x2f<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x16<<2, 0x3e<<2, 0x26<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3d<<2, 0x1e<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x2c<<2, 0x3f<<2, 0x33<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x09<<2, 0x06<<2, 0x23<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x35<<2, 0x32<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x2f<<2, 0x2f<<2, 0x2f<<2 },
-{ 0x17<<2, 0x25<<2, 0x3f<<2 },
-{ 0x2f<<2, 0x00<<2, 0x2f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x17<<2, 0x25<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x3f<<2, 0x3f<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x13<<2, 0x37<<2, 0x12<<2 },
-{ 0x3f<<2, 0x26<<2, 0x0e<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x27<<2, 0x3f<<2, 0x3c<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x3f<<2, 0x39<<2, 0x28<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
-{ 0x00<<2, 0x00<<2, 0x00<<2 },
diff --git a/palettes/vssmb.h b/palettes/vssmb.h
deleted file mode 100644 (file)
index f942610..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-{98,106,0},   // 0
-{0,0,255},    // 1
-{0,106,119},  // 2
-{71,43,191},  // 3
-{151,0,135},  // 4
-{171,0,35},   // 5
-{0x24,0x18,0x8c},   // 6 
-{0xc8,0x4c,0x0c},  // 7 
-{162,162,162},// 8
-{0,120,0},    // 9
-{0x4c,0xDC,0x48},    // a
-{0,91,0},     // b
-{255,213,153},// c
-{255,255,0},  // d
-{0,153,0},    // e
-{0,0,0},      // f 
-{255,102,255},// 10
-{0,120,248},  // 11
-{0x20,0x38,0xec},   // 12
-{107,71,255}, // 13
-{0,0,0},      // 14
-{231,0,91},   // 15
-{248,56,0},   // 16
-{251,0x74,0x60},  // 17
-{175,127,0},  // 18
-{0,184,0},    // 19
-{81,115,255}, // 1a
-{0,171,71},   // 1b
-{0,139,139},  // 1c
-{0,0,0},      // 1d
-{145,255,136},// 1e
-{0x3F,0xbF,0xFF},    // 1f
-{248,248,248},// 20
-{0,0x50,0}, // 21
-{107,0,0},    // 22
-{72,85,248},  // 23
-{248,120,248},// 24
-{248,88,152}, // 25
-{89,89,88},   // 26
-{249,0,0x58},  // 27
-{0,47,47},    // 28
-{184,248,24}, // 29
-
-{0x3f,0xbf,0xff},  // 2a
-{88,248,152}, // 2b
-{0,235,219},  // 2c
-{120,120,120},// 2d
-{0,0,0},      // 2e
-{0,0,0},      // 2f
-{255,255,255},// 30
-{167,231,255},// 31
-{89,4,0},     // 32
-{187,0,0},    // 33
-{248,184,248},// 34
-{251,167,195},// 35   
-{255,255,255},// 36
-{0,227,225},  // 37
-{251,219,123},// 38
-{255,174,15},  // 39
-{184,248,184},// 3a
-{184,248,216},// 3b
-{0x80,0xd0,0x10},    // 3c
-{248,216,248},// 3d
-{255,170,170},// 3e
-{0,64,0},     // 3f
diff --git a/sound.c b/sound.c
index 2b76b0b..7d56a2d 100644 (file)
--- a/sound.c
+++ b/sound.c
@@ -866,7 +866,7 @@ void SetNESSoundMap(void)
   SetReadHandler(0x4015,0x4015,Read_PSG);
 }
 
   SetReadHandler(0x4015,0x4015,Read_PSG);
 }
 
-static int32 WaveNSF[256];
+static int32 WaveNSF[2048];
 
 int32 highp;                   // 0 through 65536, 0 = no high pass, 65536 = max high pass
 
 
 int32 highp;                   // 0 through 65536, 0 = no high pass, 65536 = max high pass
 
@@ -952,12 +952,12 @@ int FlushEmulateSound(void)
 //  printf("count %d, num ints %d\n", end, (end >> 4));
   if(FCEUGameInfo.type==GIT_NSF)
   {
 //  printf("count %d, num ints %d\n", end, (end >> 4));
   if(FCEUGameInfo.type==GIT_NSF)
   {
-   printf("IS NSF");
-   int x,s=0,si=end/1024;       // Only want 1/4 of the output buffer to be displayed
-   for(x=0;x<256;x++)
+   int x;//,s=0,si=end/1024;
+   for(x=0;x<1024;x++)
    {
    {
-    WaveNSF[x]=WaveFinal[s>>4];
-    s+=si;
+    //WaveNSF[x]=WaveFinal[s>>4];
+    WaveNSF[x]=WaveFinalMono[x];
+    //s+=si;
    }
   }
 
    }
   }
 
@@ -1073,5 +1073,5 @@ void FCEUI_Sound(int Rate)
 
 void FCEUI_SetSoundVolume(uint32 volume)
 {
 
 void FCEUI_SetSoundVolume(uint32 volume)
 {
- FSettings.SoundVolume=(volume<<16)/100;
+ FSettings.SoundVolume=volume;
 }
 }
diff --git a/svga.c b/svga.c
index 1133a28..b040c27 100644 (file)
--- a/svga.c
+++ b/svga.c
@@ -49,6 +49,8 @@
 #include "cart.h"
 #include "input.h"
 
 #include "cart.h"
 #include "input.h"
 
+#include "vsuni.h"
+
 FCEUS FSettings;
 
 static int howlong;
 FCEUS FSettings;
 
 static int howlong;
@@ -126,10 +128,6 @@ void FCEUI_SetGameGenie(int a)
  FSettings.GameGenie=a?1:0;
 }
 
  FSettings.GameGenie=a?1:0;
 }
 
-static void CalculatePalette(void);
-static void ChoosePalette(void);
-static void WritePalette(void);
-
 #ifndef NETWORK
 #define netplay 0
 #endif
 #ifndef NETWORK
 #define netplay 0
 #endif
@@ -142,7 +140,7 @@ uint8 DIPS=0;
 //uint8 vsdip=0;
 //int coinon=0;
 
 //uint8 vsdip=0;
 //int coinon=0;
 
-uint8 pale=0;
+//uint8 pale=0;
 uint8 CommandQueue=0;
 
 static int controlselect=0;
 uint8 CommandQueue=0;
 
 static int controlselect=0;
@@ -151,6 +149,7 @@ static int ntsctint=46+10;
 static int ntschue=72;
 static int controllength=0;
 
 static int ntschue=72;
 static int controllength=0;
 
+#if 0
 pal *palo;
 static pal *palpoint[8]=
      {
 pal *palo;
 static pal *palpoint[8]=
      {
@@ -163,6 +162,7 @@ static pal *palpoint[8]=
      palettevseb,
      rp2c04001
      };
      palettevseb,
      rp2c04001
      };
+#endif
 
 void FCEUI_SetSnapName(int a)
 {
 
 void FCEUI_SetSnapName(int a)
 {
@@ -174,6 +174,7 @@ void FCEUI_SaveExtraDataUnderBase(int a)
  FSettings.SUnderBase=a;
 }
 
  FSettings.SUnderBase=a;
 }
 
+#if 0
 void FCEUI_SetPaletteArray(uint8 *pal)
 {
  if(!pal)
 void FCEUI_SetPaletteArray(uint8 *pal)
 {
  if(!pal)
@@ -191,6 +192,7 @@ void FCEUI_SetPaletteArray(uint8 *pal)
  }
  FCEU_ResetPalette();
 }
  }
  FCEU_ResetPalette();
 }
+#endif
 
 void FCEUI_SelectState(int w)
 {
 
 void FCEUI_SelectState(int w)
 {
@@ -259,7 +261,7 @@ void DriverInterface(int w, void *d)
   case DES_VSUNICOIN:CommandQueue=19;break;
   case DES_NTSCSELHUE:if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF){controlselect=1;controllength=360;}break;
   case DES_NTSCSELTINT:if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF){controlselect=2;controllength=360;}break;
   case DES_VSUNICOIN:CommandQueue=19;break;
   case DES_NTSCSELHUE:if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF){controlselect=1;controllength=360;}break;
   case DES_NTSCSELTINT:if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF){controlselect=2;controllength=360;}break;
-
+#if 0
   case DES_NTSCDEC:
                  if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF)
                  {
   case DES_NTSCDEC:
                  if(ntsccol && FCEUGameInfo.type!=GIT_VSUNI && !PAL && FCEUGameInfo.type!=GIT_NSF)
                  {
@@ -301,9 +303,11 @@ void DriverInterface(int w, void *d)
                      controllength=360;
                     }
                    break;
                      controllength=360;
                     }
                    break;
+#endif
   }
 }
 
   }
 }
 
+#if 0
 static uint8 lastd=0;
 void SetNESDeemph(uint8 d, int force)
 {
 static uint8 lastd=0;
 void SetNESDeemph(uint8 d, int force)
 {
@@ -418,6 +422,7 @@ static void CalculatePalette(void)
   }
  WritePalette();
 }
   }
  WritePalette();
 }
+#endif
 
 #include "drawing.h"
 #ifdef FRAMESKIP
 
 #include "drawing.h"
 #ifdef FRAMESKIP
@@ -461,10 +466,16 @@ void FCEU_PutImage(void)
           ReallySnap();
           dosnapsave=0;
          }
           ReallySnap();
           dosnapsave=0;
          }
-        if(FCEUGameInfo.type==GIT_VSUNI && DIPS&2)
-         DrawDips();
-         if(StateShow) DrawState();
-         if(controllength) {controllength--;DrawBars();}
+        if(FCEUGameInfo.type==GIT_VSUNI)
+                FCEU_VSUniDraw(XBuf);
+         //if(StateShow) DrawState();
+
+        //FCEU_DrawSaveStates(XBuf);
+        //FCEU_DrawMovies(XBuf);
+        //FCEU_DrawNTSCControlBars(XBuf);
+        //FCEU_DrawRecordingStatus(XBuf);
+
+         //if(controllength) {controllength--;DrawBars();}
         }
        DrawMessage();
        #ifdef FPS
         }
        DrawMessage();
        #ifdef FPS
@@ -476,6 +487,7 @@ void FCEU_PutImage(void)
        DrawInput(XBuf+8);
 }
 
        DrawInput(XBuf+8);
 }
 
+#if 0
 static int ipalette=0;
 
 void LoadGamePalette(void)
 static int ipalette=0;
 
 void LoadGamePalette(void)
@@ -538,7 +550,6 @@ void WritePalette(void)
     }
 }
 
     }
 }
 
-#if 0
 void FlushCommandQueue(void)
 {
   if(!netplay && CommandQueue) {DoCommand(CommandQueue);CommandQueue=0;}
 void FlushCommandQueue(void)
 {
   if(!netplay && CommandQueue) {DoCommand(CommandQueue);CommandQueue=0;}
diff --git a/svga.h b/svga.h
index 35f4b43..9d8cbf9 100644 (file)
--- a/svga.h
+++ b/svga.h
  */
 
 #include "driver.h"
  */
 
 #include "driver.h"
-typedef struct __pal {
-       uint8 r;
-       uint8 g;
-       uint8 b;
-} pal;
 
 typedef struct {
            int PAL;
 
 typedef struct {
            int PAL;
@@ -75,10 +70,7 @@ void SetNESPalette(void);
 #define JOY_LEFT        0x40
 #define JOY_RIGHT       0x80
 
 #define JOY_LEFT        0x40
 #define JOY_RIGHT       0x80
 
-extern pal *palo;
-
 void DoCommand(uint8 c);
 extern uint8 CommandQueue;
 void DoCommand(uint8 c);
 extern uint8 CommandQueue;
-void FCEU_ResetPalette(void);
-void LoadGamePalette(void);
+
 void FlushCommandQueue(void);
 void FlushCommandQueue(void);
diff --git a/video.c b/video.c
index 397f82e..e9d3c2d 100644 (file)
--- a/video.c
+++ b/video.c
@@ -236,7 +236,7 @@ int SaveSnapshot(void)
    tmp+=16;
   }
 
    tmp+=16;
   }
 
-  if(compress(compmem,&compmemsize,mork,(totallines<<8)+totallines)!=Z_OK)
+  if(compress(compmem,(unsigned long *)&compmemsize,mork,(totallines<<8)+totallines)!=Z_OK)
   {
    if(mal) free(mal);
    goto PNGerr;
   {
    if(mal) free(mal);
    goto PNGerr;
diff --git a/x6502.c b/x6502.c
index 1d9174c..1f97afe 100644 (file)
--- a/x6502.c
+++ b/x6502.c
@@ -469,7 +469,6 @@ void X6502_Reset_c(void)
 {
   _PC=RdMem(0xFFFC);
   _PC|=RdMem(0xFFFD)<<8;
 {
   _PC=RdMem(0xFFFC);
   _PC|=RdMem(0xFFFD)<<8;
-  if(FCEUGameInfo.type==GIT_NSF) _PC=0x3830;
   _jammed=0;
   _PI=_P=I_FLAG;
 }
   _jammed=0;
   _PI=_P=I_FLAG;
 }