save key config
authornotaz <notasas@gmail.com>
Sun, 16 Sep 2012 15:43:17 +0000 (18:43 +0300)
committernotaz <notasas@gmail.com>
Sun, 16 Sep 2012 15:43:17 +0000 (18:43 +0300)
Makefile.pandora
Makefile.sdl
drivers/common/main.c

index 1724fe1..ee90099 100644 (file)
@@ -7,37 +7,46 @@ RM    = rm -f
 C      = drivers/common/
 L      = drivers/libpicofe/
 
+TFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=neon -ffast-math
 ifdef DEBUG
 TFLAGS += -ggdb
 LDRIVER        += -ggdb
 else
-TFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=neon -ffast-math
 TFLAGS += -O2
 LDRIVER        += -O2
 endif
 ASFLAGS += -mcpu=cortex-a8
 NOSTRIP = 1
+asm_6502=1
 
 all:           fceu
 
 include zlib/Makefile
 
-OBJDRIVER = drivers/pandora/pandora.o drivers/sdl/throttle.o drivers/arm/asmutils.o \
-       ${L}fonts.o ${L}readpng.o ${L}input.o ${L}linux/in_evdev.o ${L}linux/plat.o \
-       ${L}linux/sndout_oss.o ${L}linux/fbdev.o ${L}linux/xenv.o ${L}pandora/plat.o \
+OBJDRIVER = drivers/pandora/pandora.o drivers/arm/asmutils.o \
+       ${L}fonts.o ${L}readpng.o ${L}input.o ${L}config_file.o \
+       ${L}linux/in_evdev.o ${L}linux/plat.o ${L}linux/sndout_oss.o \
+       ${L}linux/fbdev.o ${L}linux/xenv.o ${L}pandora/plat.o \
        ${C}main.o ${C}menu.o ${C}sound-oss.o \
        ${C}cheat.o ${C}config.o ${C}args.o ${C}vidblit.o ${C}unix-netplay.o \
        ${UNZIPOBJS} \
        ppu.o movie.o fceu098.o ppu098.o
 LDRIVER += -lm -lz -lpng `sdl-config --libs`
 
+ifeq ($(asm_6502),1)
+TFLAGS  += -DASM_6502
+OBJDRIVER += ncpu.o
+else
 OBJDRIVER += x6502.o
+endif
+
 
 x6502.o: x6502.c x6502.h ops.h fce.h sound.h dprintf.h
 
 include Makefile.base
 
 ${C}menu.o:            ${C}revision.h
+${C}main.o:            ${C}input.c
 ppu.o:                 ppu.c ppu.h
 x6502.o:               TFLAGS += -Wno-inline
 
index 9e08fff..2cb118d 100644 (file)
@@ -26,8 +26,8 @@ all:          fceu
 include zlib/Makefile
 
 OBJDRIVER = drivers/sdl/sdl.o drivers/sdl/throttle.o \
-       ${L}fonts.o ${L}readpng.o ${L}input.o ${L}in_sdl.o ${L}linux/plat.o \
-       ${L}linux/sndout_oss.o \
+       ${L}fonts.o ${L}readpng.o ${L}input.o ${L}config_file.o ${L}in_sdl.o \
+       ${L}linux/plat.o ${L}linux/sndout_oss.o \
        ${C}main.o ${C}menu.o ${C}sound-oss.o \
        ${C}cheat.o ${C}config.o ${C}args.o ${C}vidblit.o ${C}unix-netplay.o \
        ${UNZIPOBJS} \
index d9ee833..60d4f1d 100644 (file)
@@ -37,6 +37,7 @@
 #include "platform.h"
 #include "menu.h"
 #include "settings.h"
+#include "../libpicofe/config_file.h"
 
 #include "../../fce.h"
 #include "../../cart.h"
@@ -59,6 +60,7 @@ CFGSTRUCT DriverConfig[]={
        AC(Settings.gamma),
        AC(Settings.perfect_vsync),
        AC(Settings.accurate_mode),
+       AC(Settings.hw_filter),
        ENDCFGSTRUCT
 };
 
@@ -158,7 +160,9 @@ int SaveConfig(const char *llgn_path)
 {
        const char *name = skip_path(llgn_path);
        char tdir[2048];
+       FILE *f;
        int ret;
+
        if (name)
             sprintf(tdir,"%s"PSS"cfg"PSS"%s.cfg",BaseDirectory,name);
        else sprintf(tdir,"%s"PSS"fceu2.cfg",BaseDirectory);
@@ -166,6 +170,17 @@ int SaveConfig(const char *llgn_path)
        FCEUI_GetNTSCTH(&ntsctint, &ntschue);
         ret=SaveFCEUConfig(tdir,fceuconfig);
        printf(ret == 0 ? "done\n" : "failed\n");
+
+       // keys
+       if (name)
+            sprintf(tdir,"%s"PSS"cfg"PSS"%s_keys.cfg",BaseDirectory,name);
+       else sprintf(tdir,"%s"PSS"fceu_keys.cfg",BaseDirectory);
+       f=fopen(tdir, "w");
+       if (f!=NULL) {
+        config_write_keys(f);
+        fclose(f);
+       }
+
        return ret;
 }
 
@@ -173,7 +188,9 @@ static int LoadConfig(const char *llgn_path)
 {
        const char *name = skip_path(llgn_path);
        char tdir[2048];
-       int ret;
+       FILE *f;
+       int ret, l;
+
        if (name)
             sprintf(tdir,"%s"PSS"cfg"PSS"%s.cfg",BaseDirectory,name);
        else sprintf(tdir,"%s"PSS"fceu2.cfg",BaseDirectory);
@@ -182,6 +199,19 @@ static int LoadConfig(const char *llgn_path)
         ret=LoadFCEUConfig(tdir,fceuconfig);
        FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
        printf(ret == 0 ? "done\n" : "failed\n");
+
+       // keys
+       if (name)
+            sprintf(tdir,"%s"PSS"cfg"PSS"%s_keys.cfg",BaseDirectory,name);
+       else sprintf(tdir,"%s"PSS"fceu_keys.cfg",BaseDirectory);
+       f=fopen(tdir, "r");
+       if (f!=NULL) {
+        l=fread(tdir,1,sizeof(tdir)-1,f);
+        tdir[l]=0;
+        config_read_keys(tdir);
+        fclose(f);
+       }
+
        return ret;
 }
 
@@ -477,6 +507,7 @@ int main(int argc, char *argv[])
          ret = menu_loop();
          if (ret == 1) break;          // exit emu
          if (ret == 2) {               // reload ROM
+          SaveLLGN();
           Exit = 0;
           continue;
          }
@@ -494,7 +525,6 @@ int main(int argc, char *argv[])
        if (fceugi)
         CloseGame();
 
-       SaveLLGN();
        FCEUI_Kill();
        DriverKill();
        platform_finish();