// Allocate space for the rom plus padding\r
rom=PicoCartAlloc(size);\r
if (rom==NULL) {\r
- printf("out of memory (wanted %i)\n", size);\r
+ elprintf(EL_STATUS, "out of memory (wanted %i)", size);\r
return 1;\r
}\r
\r
else\r
bytes_read = pm_read(rom,size,f); // Load up the rom\r
if (bytes_read <= 0) {\r
- printf("read failed\n");\r
+ elprintf(EL_STATUS, "read failed");\r
free(rom);\r
return 1;\r
}\r
#define R_ERROR_RETURN(error) \
{ \
- printf("PicoCdLoadState @ %x: " error "\n", g_read_offs); \
+ elprintf(EL_STATUS, "PicoCdLoadState @ %x: " error "\n", g_read_offs); \
return 1; \
}
#define CHECKED_READ2(len2,data) \
if (len2 != len) { \
- printf("unexpected len %i, wanted %i (%s)", len, len2, #len2); \
+ elprintf(EL_STATUS, "unexpected len %i, wanted %i (%s)", len, len2, #len2); \
if (len > len2) R_ERROR_RETURN("failed."); \
/* else read anyway and hope for the best.. */ \
} \
case CHUNK_MISC_CD: CHECKED_READ_BUFF(Pico_mcd->m); break;
default:
- printf("PicoCdLoadState: skipping unknown chunk %i of size %i\n", buff[0], len);
+ elprintf(EL_STATUS, "PicoCdLoadState: skipping unknown chunk %i of size %i\n", buff[0], len);
areaSeek(file, len, SEEK_CUR);
break;
}
cd_buffer = NULL;
}
if (reads)
- printf("CD buffer hits: %i/%i (%i%%)\n", hits, reads, hits * 100 / reads);
+ elprintf(EL_STATUS, "CD buffer hits: %i/%i (%i%%)\n", hits, reads, hits * 100 / reads);
}
dprintf("CD buffer seek %i -> %i\n", prev_lba, lba);
pm_seek(Pico_mcd->TOC.Tracks[0].F, where_seek, SEEK_SET);
}
-else if (prev_lba == 0x80000000) printf("wtf?\n");
dprintf("CD buffer miss %i -> %i\n", prev_lba, lba);
dprintf("CD buffer move=%i, read_len=%i", PicoCDBuffers - read_len, read_len);
memmove(cd_buffer + read_len*2048, cd_buffer, (PicoCDBuffers - read_len)*2048);
moved = 1;
-if (prev_lba == 0x80000000) printf("wtf?\n");
}
else
{
\r
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read\r
\r
- printf("tray close\n");\r
+ elprintf(EL_STATUS, "tray close\n");\r
\r
if (PicoMCDcloseTray != NULL)\r
CD_Present = PicoMCDcloseTray();\r
\r
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read\r
\r
- printf("tray open\n");\r
+ elprintf(EL_STATUS, "tray open\n");\r
\r
Unload_ISO();\r
CD_Present = 0;\r
step *= 256*256/4;
g_rate = (unsigned int) step;
if (step - (float) g_rate >= 0.5) g_rate++;
- printf("g_rate: %f %08x\n", (double)step, g_rate);
+ elprintf(EL_STATUS, "g_rate: %f %08x\n", (double)step, g_rate);
}
memset(&CZ80, 0, sizeof(CZ80));\r
Cz80_Init(&CZ80);\r
Cz80_Set_Fetch(&CZ80, 0x0000, 0x1fff, (UINT32)Pico.zram); // main RAM\r
- Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram - 0x2000); // mirror\r
+ Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram); // mirror\r
Cz80_Set_ReadB(&CZ80, (UINT8 (*)(UINT32 address))z80_read); // unused (hacked in)\r
Cz80_Set_WriteB(&CZ80, z80_write);\r
Cz80_Set_INPort(&CZ80, z80_in);\r
drZ80.Z80SP = drZ80.z80_rebaseSP(0x2000); // 0xf000 ?\r
#elif defined(_USE_CZ80)\r
Cz80_Reset(&CZ80);\r
+ Cz80_Set_Reg(&CZ80, CZ80_IX, 0xffff);\r
+ Cz80_Set_Reg(&CZ80, CZ80_IY, 0xffff);\r
+ Cz80_Set_Reg(&CZ80, CZ80_SP, 0x2000);\r
#endif\r
Pico.m.z80_fakeval = 0; // for faking when Z80 is disabled\r
}\r
/PSP/GAME or /PSP/GAMEXXX directory in your memory stick (it shouldn't matter\r
which one GAME* directory to use).\r
\r
-If you are on 1.5, you will have to use KXploit tool to create the needed files\r
-and directories, and then copy them to /PSP/GAME. I assume 1.5 users know how to\r
-do this, if not, just google for KXploit.\r
+If you are on 1.5, there is a separate KXploited version for it.\r
\r
#endif\r
Note that this emulator may require some tweaking of configuration settings to run\r
\r
Changelog\r
---------\r
+1.35a\r
+ * PSP: fixed a bug which prevented to load any ROMs after testing the BIOS.\r
+ * PSP: fixed incorrect CZ80 memory map setup, which caused Z80 crashes and\r
+ graphics corruption in EU Mega CD model1 BIOS menus.\r
+ + PSP: added additional "set to 4:3 scaled" display option for convenience.\r
+ + Added an option to disable frame limitter (works only with non-auto frameskip).\r
+\r
1.35\r
+ PSP port added. Lots of new code for it. Integrated modified FAME/C, CZ80 cores.\r
+ Some minor generic optimizations.\r
}\r
}\r
\r
+/* check if the name begins with BIOS name */\r
+static int emu_isBios(const char *name)\r
+{\r
+ int i;\r
+ for (i = 0; i < sizeof(biosfiles_us)/sizeof(biosfiles_us[0]); i++)\r
+ if (strstr(name, biosfiles_us[i]) != NULL) return 1;\r
+ for (i = 0; i < sizeof(biosfiles_eu)/sizeof(biosfiles_eu[0]); i++)\r
+ if (strstr(name, biosfiles_eu[i]) != NULL) return 1;\r
+ for (i = 0; i < sizeof(biosfiles_jp)/sizeof(biosfiles_jp[0]); i++)\r
+ if (strstr(name, biosfiles_jp[i]) != NULL) return 1;\r
+ return 0;\r
+}\r
+\r
/* checks if romFileName points to valid MegaCD image\r
* if so, checks for suitable BIOS */\r
int emu_cdCheck(int *pregion)\r
\r
menu_romload_end();\r
\r
- // emu_ReadConfig() might have messed currentConfig.lastRomFile\r
- strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1);\r
- currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0;\r
+ if (!emu_isBios(romFileName))\r
+ {\r
+ // emu_ReadConfig() might have messed currentConfig.lastRomFile\r
+ strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1);\r
+ currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0;\r
+ }\r
\r
if (PicoPatches) {\r
PicoPatchPrepare();\r
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
// craigix_ram, confirm_save, show_cd_leds, confirm_load
// A_SNs_gamma, perfect_vsync, giz_scanlines, giz_dblbuff
- // vsync_mode, show_clock
+ // vsync_mode, show_clock, no_frame_limitter
int PicoOpt; // used for config saving only, see Pico.h
int PsndRate; // ditto
int PicoRegion; // ditto
MA_OPT2_RAMTIMINGS, /* gp2x */
MA_OPT2_SQUIDGEHACK, /* gp2x */
MA_OPT2_STATUS_LINE, /* psp */
+ MA_OPT2_NO_FRAME_LIMIT, /* psp */
MA_OPT2_DONE,
MA_OPT3_SCALE, /* psp (all OPT3) */
MA_OPT3_HSCALE32,
MA_OPT3_HSCALE40,
MA_OPT3_PRES_NOSCALE,
+ MA_OPT3_PRES_SCALE43,
MA_OPT3_PRES_FULLSCR,
MA_OPT3_FILTERING,
MA_OPT3_VSYNC,
if (fbimg_width >= 480) {
g_vertices[0].u = (fbimg_width-480)/2;
g_vertices[1].u = src_width - (fbimg_width-480)/2 - 1;
- if (fbimg_width == 480) border_hack = 1;
fbimg_width = 480;
fbimg_xoffs = 0;
} else {
g_vertices[1].u = src_width;
fbimg_xoffs = 240 - fbimg_width/2;
}
+ if (fbimg_width > 320 && fbimg_width <= 480) border_hack = 1;
if (fbimg_height >= 272) {
g_vertices[0].v = (fbimg_height-272)/2;
for (i = 0; i < currentConfig.Frameskip; i++) {
updateKeys();
SkipFrame(); frames_done++;
- if (PsndOut) { // do framelimitting if sound is enabled
+ if (!(currentConfig.EmuOpt&0x40000)) { // do framelimitting if needed
int tval_diff;
tval = sceKernelGetSystemTimeLow();
tval_diff = (int)(tval - tval_thissec) << 8;
if (currentConfig.Frameskip < 0 && tval_diff - lim_time >= (300000<<8)) // slowdown detection
reset_timing = 1;
- else if (PsndOut != NULL || currentConfig.Frameskip < 0)
+ else if (!(currentConfig.EmuOpt&0x40000) || currentConfig.Frameskip < 0)
{
// sleep if we are still too fast
if (tval_diff < lim_time)
}
+static SceIoStat cpstat;
+
static char *romsel_loop(char *curr_path)
{
struct my_dirent **namelist;
int n, iret, sel = 0;
unsigned long inp = 0;
char *ret = NULL, *fname = NULL;
- SceIoStat cpstat;
// is this a dir or a full path?
memset(&cpstat, 0, sizeof(cpstat));
if (iret >= 0 && (cpstat.st_attr & FIO_SO_IFREG)) { // file
char *p;
for (p = curr_path + strlen(curr_path) - 1; p > curr_path && *p != '/'; p--);
- *p = 0;
- fname = p+1;
+ if (p > curr_path) {
+ *p = 0;
+ fname = p+1;
+ }
+ else strcpy(curr_path, "ms0:/");
}
else if (iret >= 0 && (cpstat.st_attr & FIO_SO_IFDIR)); // dir
else strcpy(curr_path, "ms0:/"); // something else
p = start + strlen(start) - 1;
while (*p == '/' && p > start) p--;
while (*p != '/' && *p != ':' && p > start) p--;
- if (p <= start || *p == ':' || p[-1] == ':') strcpy(newdir, "ms0:/");
+ if (p <= start || *p == ':') strcpy(newdir, "ms0:/");
else { strncpy(newdir, start, p-start); newdir[p-start] = 0; }
} else {
strcpy(newdir, curr_path);
{ NULL, MB_ONOFF, MA_OPT3_FILTERING, ¤tConfig.scaling, 1, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT3_VSYNC, NULL, 0, 0, 0, 1 },
{ "Set to unscaled centered", MB_NONE, MA_OPT3_PRES_NOSCALE, NULL, 0, 0, 0, 1 },
+ { "Set to 4:3 scaled", MB_NONE, MA_OPT3_PRES_SCALE43, NULL, 0, 0, 0, 1 },
{ "Set to fullscreen", MB_NONE, MA_OPT3_PRES_FULLSCR, NULL, 0, 0, 0, 1 },
{ "done", MB_NONE, MA_OPT3_DONE, NULL, 0, 0, 0, 1 },
};
currentConfig.scale = currentConfig.hscale40 = currentConfig.hscale32 = 1.0;
menu_opt3_preview(is_32col);
break;
+ case MA_OPT3_PRES_SCALE43:
+ currentConfig.scale = 1.20;
+ currentConfig.hscale40 = 1.00;
+ currentConfig.hscale32 = 1.25;
+ menu_opt3_preview(is_32col);
+ break;
case MA_OPT3_PRES_FULLSCR:
currentConfig.scale = 1.20;
currentConfig.hscale40 = 1.25;
menu_entry opt2_entries[] =
{
- { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, ¤tConfig.PicoOpt,0x00004, 0, 0, 1 },
- { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, ¤tConfig.PicoOpt,0x00001, 0, 0, 1 },
- { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,¤tConfig.PicoOpt,0x00002, 0, 0, 1 },
- { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x00008, 0, 0, 1 },
- { "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x00020, 0, 0, 1 },
- { "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, ¤tConfig.EmuOpt, 0x20000, 0, 0, 1 },
- { "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1 },
+ { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, ¤tConfig.PicoOpt,0x00004, 0, 0, 1 },
+ { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, ¤tConfig.PicoOpt,0x00001, 0, 0, 1 },
+ { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496, ¤tConfig.PicoOpt,0x00002, 0, 0, 1 },
+ { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x00008, 0, 0, 1 },
+ { "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, ¤tConfig.EmuOpt, 0x00020, 0, 0, 1 },
+ { "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, ¤tConfig.EmuOpt, 0x20000, 0, 0, 1 },
+ { "Disable frame limitter", MB_ONOFF, MA_OPT2_NO_FRAME_LIMIT, ¤tConfig.EmuOpt, 0x40000, 0, 0, 1 },
+ { "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1 },
};
#define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0]))
/* alt logging */
#define LOG_FILE "log.txt"
+#ifndef LPRINTF_STDIO
typedef struct _log_entry
{
char buff[256];
} log_entry;
static log_entry *le_root = NULL;
+#endif
void lprintf_f(const char *fmt, ...)
{
-#define VERSION "1.35"\r
+#define VERSION "1.35a"\r
\r