static char noticeMsg[64]; // notice msg to draw\r
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing\r
static int reset_timing, osd_fps_x;\r
static char noticeMsg[64]; // notice msg to draw\r
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing\r
static int reset_timing, osd_fps_x;\r
// load SRAM for this ROM\r
if(currentConfig.EmuOpt & 1)\r
emu_SaveLoadGame(1, 1);\r
// load SRAM for this ROM\r
if(currentConfig.EmuOpt & 1)\r
emu_SaveLoadGame(1, 1);\r
// set default config\r
memset(¤tConfig, 0, sizeof(currentConfig));\r
currentConfig.lastRomFile[0] = 0;\r
// set default config\r
memset(¤tConfig, 0, sizeof(currentConfig));\r
currentConfig.lastRomFile[0] = 0;\r
- currentConfig.EmuOpt = 0x1f | 0xc00; // | cd_leds | cd_cdda\r
- currentConfig.PicoOpt = 0x0f | 0x200; // | use_940\r
- currentConfig.PsndRate = 44100;\r
+ currentConfig.EmuOpt = 0x1f | 0x400; // | cd_leds\r
+ currentConfig.PicoOpt = 0x0f | 0xe00; // | use_940 | cd_pcm | cd_cdda\r
+ currentConfig.PsndRate = 22050; // 44100;\r
currentConfig.Frameskip = -1; // auto\r
currentConfig.CPUclock = 200;\r
currentConfig.volume = 50;\r
currentConfig.Frameskip = -1; // auto\r
currentConfig.CPUclock = 200;\r
currentConfig.volume = 50;\r
PicoOpt = currentConfig.PicoOpt;\r
PsndRate = currentConfig.PsndRate;\r
PicoRegionOverride = currentConfig.PicoRegion;\r
PicoOpt = currentConfig.PicoOpt;\r
PsndRate = currentConfig.PsndRate;\r
PicoRegionOverride = currentConfig.PicoRegion;\r
currentConfig.PicoOpt = PicoOpt;\r
currentConfig.PsndRate = PsndRate;\r
currentConfig.PicoRegion = PicoRegionOverride;\r
currentConfig.PicoOpt = PicoOpt;\r
currentConfig.PsndRate = PsndRate;\r
currentConfig.PicoRegion = PicoRegionOverride;\r
bwrite = fwrite(¤tConfig, 1, sizeof(currentConfig), f);\r
fflush(f);\r
fclose(f);\r
bwrite = fwrite(¤tConfig, 1, sizeof(currentConfig), f);\r
fflush(f);\r
fclose(f);\r
// 8-bit modes\r
unsigned int col_g = (old_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0;\r
unsigned int col_r = (old_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0;\r
// 8-bit modes\r
unsigned int col_g = (old_reg & 2) ? 0xc0c0c0c0 : 0xe0e0e0e0;\r
unsigned int col_r = (old_reg & 1) ? 0xd0d0d0d0 : 0xe0e0e0e0;\r
- *(unsigned int *)((char *)gp2x_screen + 320*2+306) =\r
- *(unsigned int *)((char *)gp2x_screen + 320*3+306) =\r
- *(unsigned int *)((char *)gp2x_screen + 320*4+306) = col_g;\r
- *(unsigned int *)((char *)gp2x_screen + 320*2+312) =\r
- *(unsigned int *)((char *)gp2x_screen + 320*3+312) =\r
- *(unsigned int *)((char *)gp2x_screen + 320*4+312) = col_r;\r
+ *(unsigned int *)((char *)gp2x_screen + 320*2+ 4) =\r
+ *(unsigned int *)((char *)gp2x_screen + 320*3+ 4) =\r
+ *(unsigned int *)((char *)gp2x_screen + 320*4+ 4) = col_g;\r
+ *(unsigned int *)((char *)gp2x_screen + 320*2+12) =\r
+ *(unsigned int *)((char *)gp2x_screen + 320*3+12) =\r
+ *(unsigned int *)((char *)gp2x_screen + 320*4+12) = col_r;\r
unsigned int col_g = (old_reg & 2) ? 0x06000600 : 0;\r
unsigned int col_r = (old_reg & 1) ? 0xc000c000 : 0;\r
unsigned int col_g = (old_reg & 2) ? 0x06000600 : 0;\r
unsigned int col_r = (old_reg & 1) ? 0xc000c000 : 0;\r
- *p++ = col_g; *p++ = col_g; p++; *p++ = col_r; *p++ = col_r; p += 320/2 - 10/2;\r
- *p++ = col_g; *p++ = col_g; p++; *p++ = col_r; *p++ = col_r; p += 320/2 - 10/2;\r
- *p++ = col_g; *p++ = col_g; p++; *p++ = col_r; *p++ = col_r; p += 320/2 - 10/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 320/2 - 12/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 320/2 - 12/2;\r
+ *p++ = col_g; *p++ = col_g; p+=2; *p++ = col_r; *p++ = col_r; p += 320/2 - 12/2;\r
- blit("", (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");\r
- emu_SaveLoadGame(which & 0x1000, 0);\r
+ osd_text(4, 232, (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");\r
+ PicoStateProgressCB = emu_state_cb;\r
+ gp2x_memcpy_all_buffers(gp2x_screen, 0, 320*240*2);\r
+ emu_SaveLoadGame((which & 0x1000) >> 12, 0);\r
+ PicoStateProgressCB = NULL;\r
- int len = (PicoOpt&8)?PsndLen*2:PsndLen;\r
-\r
- snd_excess_cnt += snd_excess_add;\r
- if (snd_excess_cnt >= 0x10000) {\r
- snd_excess_cnt -= 0x10000;\r
- if (PicoOpt&8) {\r
- PsndOut[len] = PsndOut[len-2];\r
- PsndOut[len+1] = PsndOut[len-1];\r
- len+=2;\r
- } else {\r
- PsndOut[len] = PsndOut[len-1];\r
- len++;\r
- }\r
- }\r
+ if (PicoOpt&8) len<<=1;\r
if(PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old || crashed_940) {\r
/* if 940 is turned off, we need it to be put back to sleep */\r
if (!(PicoOpt&0x200) && ((PicoOpt^PicoOpt_old)&0x200)) {\r
Reset940(1, 2);\r
Pause940(1);\r
}\r
if(PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old || crashed_940) {\r
/* if 940 is turned off, we need it to be put back to sleep */\r
if (!(PicoOpt&0x200) && ((PicoOpt^PicoOpt_old)&0x200)) {\r
Reset940(1, 2);\r
Pause940(1);\r
}\r
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal);\r
gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3);\r
gp2x_sound_volume(currentConfig.volume, currentConfig.volume);\r
PicoWriteSound = updateSound;\r
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;\r
printf("starting audio: %i len: %i (ex: %04x) stereo: %i, pal: %i\n", PsndRate, PsndLen, snd_excess_add, (PicoOpt&8)>>3, Pico.m.pal);\r
gp2x_start_sound(PsndRate, 16, (PicoOpt&8)>>3);\r
gp2x_sound_volume(currentConfig.volume, currentConfig.volume);\r
PicoWriteSound = updateSound;\r
- if (PsndOut != 0) {\r
- free(PsndOut);\r
- PsndOut = 0;\r
+ // if in 16bit mode, generate 8it image for menu background\r
+ if (!(PicoOpt&0x10) && (currentConfig.EmuOpt&0x80)) {\r
+ PicoOpt |= 0x10;\r
+ if (!(Pico.video.reg[12]&1)) clearArea(1);\r
+ PicoFrameFull();\r
+ vidCpyM2((unsigned char *)gp2x_screen+320*8, framebuff+328*8);\r
+ vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
+ gp2x_video_setpalette(localPal, 0x40);\r
+ PicoOpt &= ~0x10;\r
if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);\r
} else\r
saveFname[strlen(saveFname)-3] = 0;\r
}\r
if(!PmovFile) { // gzip failed or was disabled\r
if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) {\r
if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);\r
} else\r
saveFname[strlen(saveFname)-3] = 0;\r
}\r
if(!PmovFile) { // gzip failed or was disabled\r
if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) {\r
- areaRead = (STATE_SL_FUNC) fread;\r
- areaWrite = (STATE_SL_FUNC) fwrite;\r
+ areaRead = (arearw *) fread;\r
+ areaWrite = (arearw *) fwrite;\r
+ areaEof = (areaeof *) feof;\r
+ areaSeek = (areaseek *) fseek;\r
- PmovState(load ? 6 : 5, PmovFile);\r
- strcpy(noticeMsg, load ? "GAME LOADED " : "GAME SAVED ");\r
+ ret = PmovState(load ? 6 : 5, PmovFile);\r
if(areaRead == gzRead2)\r
gzclose(PmovFile);\r
else fclose ((FILE *) PmovFile);\r
PmovFile = 0;\r
if (!load) sync();\r
else Pico.m.dirtyPal=1;\r
if(areaRead == gzRead2)\r
gzclose(PmovFile);\r
else fclose ((FILE *) PmovFile);\r
PmovFile = 0;\r
if (!load) sync();\r
else Pico.m.dirtyPal=1;\r