mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
new menu option code
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@221 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
82bc9cdd10
commit
4e8a534cec
7 changed files with 613 additions and 278 deletions
|
@ -10,7 +10,7 @@ CROSS = arm-linux-
|
|||
#up = 1
|
||||
|
||||
DEFINC = -I../.. -I. -D__GP2X__ -DARM # -DBENCHMARK
|
||||
COPT_COMMON = -static -s -O3 -ftracer -fstrength-reduce -Wall -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||
COPT_COMMON = -static -s -O2 -ftracer -fstrength-reduce -Wall -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||
COPT = $(COPT_COMMON) -mtune=arm940t
|
||||
GCC = $(CROSS)gcc
|
||||
STRIP = $(CROSS)strip
|
||||
|
@ -51,7 +51,7 @@ code940.gpe : $(OBJS940) ../helix/helix_mp3.a
|
|||
|
||||
940ym2612.o : ../../../Pico/sound/ym2612.c
|
||||
@echo $@
|
||||
@$(GCC) $(COPT) $(DEFINC) -DEXTERNAL_YM2612 -c $< -o $@
|
||||
@$(GCC) $(COPT) -Os $(DEFINC) -DEXTERNAL_YM2612 -c $< -o $@
|
||||
|
||||
mix.o : ../../../Pico/sound/mix.s
|
||||
@echo $@
|
||||
|
|
|
@ -62,6 +62,7 @@ static int movie_size = 0;
|
|||
unsigned char *framebuff = 0; // temporary buffer for alt renderer
|
||||
int state_slot = 0;
|
||||
int reset_timing = 0;
|
||||
int config_slot = 0, config_slot_current = 0;
|
||||
|
||||
|
||||
// utilities
|
||||
|
@ -474,7 +475,7 @@ void scaling_update(void)
|
|||
int emu_ReadConfig(int game)
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[512];
|
||||
char cfg[512], extbuf[16];
|
||||
int bread = 0;
|
||||
|
||||
if (!game)
|
||||
|
@ -507,9 +508,19 @@ int emu_ReadConfig(int game)
|
|||
currentConfig.PicoCDBuffers = 64;
|
||||
currentConfig.scaling = 0;
|
||||
strncpy(cfg, PicoConfigFile, 511);
|
||||
if (config_slot != 0)
|
||||
{
|
||||
char *p = strrchr(cfg, '.');
|
||||
if (p == NULL) p = cfg + strlen(cfg);
|
||||
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
||||
strncpy(p, extbuf, 511 - (p - cfg));
|
||||
}
|
||||
cfg[511] = 0;
|
||||
} else {
|
||||
romfname_ext(cfg, "cfg/", ".pbcfg");
|
||||
if (config_slot != 0)
|
||||
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
||||
else strcpy(extbuf, ".pbcfg");
|
||||
romfname_ext(cfg, "cfg/", extbuf);
|
||||
f = fopen(cfg, "rb");
|
||||
if (!f) romfname_ext(cfg, NULL, ".pbcfg");
|
||||
else fclose(f);
|
||||
|
@ -543,6 +554,7 @@ int emu_ReadConfig(int game)
|
|||
currentConfig.KeyBinds[22] = 1<<30; // vol down
|
||||
}
|
||||
|
||||
if (bread > 0) config_slot_current = config_slot;
|
||||
return (bread > 0); // == sizeof(currentConfig));
|
||||
}
|
||||
|
||||
|
@ -550,15 +562,25 @@ int emu_ReadConfig(int game)
|
|||
int emu_WriteConfig(int game)
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[512];
|
||||
char cfg[512], extbuf[16];
|
||||
int bwrite = 0;
|
||||
|
||||
if (!game)
|
||||
{
|
||||
strncpy(cfg, PicoConfigFile, 511);
|
||||
if (config_slot != 0)
|
||||
{
|
||||
char *p = strrchr(cfg, '.');
|
||||
if (p == NULL) p = cfg + strlen(cfg);
|
||||
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
||||
strncpy(p, extbuf, 511 - (p - cfg));
|
||||
}
|
||||
cfg[511] = 0;
|
||||
} else {
|
||||
romfname_ext(cfg, "cfg/", ".pbcfg");
|
||||
if (config_slot != 0)
|
||||
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
||||
else strcpy(extbuf, ".pbcfg");
|
||||
romfname_ext(cfg, "cfg/", extbuf);
|
||||
}
|
||||
|
||||
printf("emu_WriteConfig: %s ", cfg);
|
||||
|
@ -578,6 +600,7 @@ int emu_WriteConfig(int game)
|
|||
}
|
||||
printf((bwrite == sizeof(currentConfig)) ? "(ok)\n" : "(failed)\n");
|
||||
|
||||
if (bwrite == sizeof(currentConfig)) config_slot_current = config_slot;
|
||||
return (bwrite == sizeof(currentConfig));
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue