1.35a psp bugfix release

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@300 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-11-20 21:38:07 +00:00
parent aefb65bc6a
commit c6196c0f01
14 changed files with 72 additions and 34 deletions

View file

@ -257,7 +257,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize)
// Allocate space for the rom plus padding // Allocate space for the rom plus padding
rom=PicoCartAlloc(size); rom=PicoCartAlloc(size);
if (rom==NULL) { if (rom==NULL) {
printf("out of memory (wanted %i)\n", size); elprintf(EL_STATUS, "out of memory (wanted %i)", size);
return 1; return 1;
} }
@ -281,7 +281,7 @@ int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize)
else else
bytes_read = pm_read(rom,size,f); // Load up the rom bytes_read = pm_read(rom,size,f); // Load up the rom
if (bytes_read <= 0) { if (bytes_read <= 0) {
printf("read failed\n"); elprintf(EL_STATUS, "read failed");
free(rom); free(rom);
return 1; return 1;
} }

View file

@ -150,7 +150,7 @@ static int g_read_offs = 0;
#define R_ERROR_RETURN(error) \ #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; \ return 1; \
} }
@ -165,7 +165,7 @@ static int g_read_offs = 0;
#define CHECKED_READ2(len2,data) \ #define CHECKED_READ2(len2,data) \
if (len2 != len) { \ 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."); \ if (len > len2) R_ERROR_RETURN("failed."); \
/* else read anyway and hope for the best.. */ \ /* else read anyway and hope for the best.. */ \
} \ } \
@ -235,7 +235,7 @@ PICO_INTERNAL int PicoCdLoadState(void *file)
case CHUNK_MISC_CD: CHECKED_READ_BUFF(Pico_mcd->m); break; case CHUNK_MISC_CD: CHECKED_READ_BUFF(Pico_mcd->m); break;
default: 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); areaSeek(file, len, SEEK_CUR);
break; break;
} }

View file

@ -43,7 +43,7 @@ void PicoCDBufferFree(void)
cd_buffer = NULL; cd_buffer = NULL;
} }
if (reads) 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);
} }
@ -80,7 +80,6 @@ PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba)
dprintf("CD buffer seek %i -> %i\n", prev_lba, lba); dprintf("CD buffer seek %i -> %i\n", prev_lba, lba);
pm_seek(Pico_mcd->TOC.Tracks[0].F, where_seek, SEEK_SET); 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 miss %i -> %i\n", prev_lba, lba);
@ -90,7 +89,6 @@ else if (prev_lba == 0x80000000) printf("wtf?\n");
dprintf("CD buffer move=%i, read_len=%i", PicoCDBuffers - read_len, read_len); 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); memmove(cd_buffer + read_len*2048, cd_buffer, (PicoCDBuffers - read_len)*2048);
moved = 1; moved = 1;
if (prev_lba == 0x80000000) printf("wtf?\n");
} }
else else
{ {

View file

@ -660,7 +660,7 @@ PICO_INTERNAL int Close_Tray_CDD_cC(void)
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
printf("tray close\n"); elprintf(EL_STATUS, "tray close\n");
if (PicoMCDcloseTray != NULL) if (PicoMCDcloseTray != NULL)
CD_Present = PicoMCDcloseTray(); CD_Present = PicoMCDcloseTray();
@ -685,7 +685,7 @@ PICO_INTERNAL int Open_Tray_CDD_cD(void)
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
printf("tray open\n"); elprintf(EL_STATUS, "tray open\n");
Unload_ISO(); Unload_ISO();
CD_Present = 0; CD_Present = 0;

View file

@ -56,7 +56,7 @@ PICO_INTERNAL void pcm_set_rate(int rate)
step *= 256*256/4; step *= 256*256/4;
g_rate = (unsigned int) step; g_rate = (unsigned int) step;
if (step - (float) g_rate >= 0.5) g_rate++; 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);
} }

View file

@ -372,7 +372,7 @@ PICO_INTERNAL void z80_init(void)
memset(&CZ80, 0, sizeof(CZ80)); memset(&CZ80, 0, sizeof(CZ80));
Cz80_Init(&CZ80); Cz80_Init(&CZ80);
Cz80_Set_Fetch(&CZ80, 0x0000, 0x1fff, (UINT32)Pico.zram); // main RAM Cz80_Set_Fetch(&CZ80, 0x0000, 0x1fff, (UINT32)Pico.zram); // main RAM
Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram - 0x2000); // mirror Cz80_Set_Fetch(&CZ80, 0x2000, 0x3fff, (UINT32)Pico.zram); // mirror
Cz80_Set_ReadB(&CZ80, (UINT8 (*)(UINT32 address))z80_read); // unused (hacked in) Cz80_Set_ReadB(&CZ80, (UINT8 (*)(UINT32 address))z80_read); // unused (hacked in)
Cz80_Set_WriteB(&CZ80, z80_write); Cz80_Set_WriteB(&CZ80, z80_write);
Cz80_Set_INPort(&CZ80, z80_in); Cz80_Set_INPort(&CZ80, z80_in);
@ -395,6 +395,9 @@ PICO_INTERNAL void z80_reset(void)
drZ80.Z80SP = drZ80.z80_rebaseSP(0x2000); // 0xf000 ? drZ80.Z80SP = drZ80.z80_rebaseSP(0x2000); // 0xf000 ?
#elif defined(_USE_CZ80) #elif defined(_USE_CZ80)
Cz80_Reset(&CZ80); Cz80_Reset(&CZ80);
Cz80_Set_Reg(&CZ80, CZ80_IX, 0xffff);
Cz80_Set_Reg(&CZ80, CZ80_IY, 0xffff);
Cz80_Set_Reg(&CZ80, CZ80_SP, 0x2000);
#endif #endif
Pico.m.z80_fakeval = 0; // for faking when Z80 is disabled Pico.m.z80_fakeval = 0; // for faking when Z80 is disabled
} }

View file

@ -49,9 +49,7 @@ If you are running a custom firmware, just copy the whole PicoDrive directory to
/PSP/GAME or /PSP/GAMEXXX directory in your memory stick (it shouldn't matter /PSP/GAME or /PSP/GAMEXXX directory in your memory stick (it shouldn't matter
which one GAME* directory to use). which one GAME* directory to use).
If you are on 1.5, you will have to use KXploit tool to create the needed files If you are on 1.5, there is a separate KXploited version for it.
and directories, and then copy them to /PSP/GAME. I assume 1.5 users know how to
do this, if not, just google for KXploit.
#endif #endif
Note that this emulator may require some tweaking of configuration settings to run Note that this emulator may require some tweaking of configuration settings to run
@ -630,6 +628,13 @@ Additional thanks
Changelog Changelog
--------- ---------
1.35a
* PSP: fixed a bug which prevented to load any ROMs after testing the BIOS.
* PSP: fixed incorrect CZ80 memory map setup, which caused Z80 crashes and
graphics corruption in EU Mega CD model1 BIOS menus.
+ PSP: added additional "set to 4:3 scaled" display option for convenience.
+ Added an option to disable frame limitter (works only with non-auto frameskip).
1.35 1.35
+ PSP port added. Lots of new code for it. Integrated modified FAME/C, CZ80 cores. + PSP port added. Lots of new code for it. Integrated modified FAME/C, CZ80 cores.
+ Some minor generic optimizations. + Some minor generic optimizations.

View file

@ -137,6 +137,19 @@ int emu_findBios(int region, char **bios_file)
} }
} }
/* check if the name begins with BIOS name */
static int emu_isBios(const char *name)
{
int i;
for (i = 0; i < sizeof(biosfiles_us)/sizeof(biosfiles_us[0]); i++)
if (strstr(name, biosfiles_us[i]) != NULL) return 1;
for (i = 0; i < sizeof(biosfiles_eu)/sizeof(biosfiles_eu[0]); i++)
if (strstr(name, biosfiles_eu[i]) != NULL) return 1;
for (i = 0; i < sizeof(biosfiles_jp)/sizeof(biosfiles_jp[0]); i++)
if (strstr(name, biosfiles_jp[i]) != NULL) return 1;
return 0;
}
/* checks if romFileName points to valid MegaCD image /* checks if romFileName points to valid MegaCD image
* if so, checks for suitable BIOS */ * if so, checks for suitable BIOS */
int emu_cdCheck(int *pregion) int emu_cdCheck(int *pregion)
@ -340,9 +353,12 @@ int emu_ReloadRom(void)
menu_romload_end(); menu_romload_end();
// emu_ReadConfig() might have messed currentConfig.lastRomFile if (!emu_isBios(romFileName))
strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1); {
currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0; // emu_ReadConfig() might have messed currentConfig.lastRomFile
strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1);
currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0;
}
if (PicoPatches) { if (PicoPatches) {
PicoPatchPrepare(); PicoPatchPrepare();

View file

@ -9,7 +9,7 @@ typedef struct {
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode // squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
// craigix_ram, confirm_save, show_cd_leds, confirm_load // craigix_ram, confirm_save, show_cd_leds, confirm_load
// A_SNs_gamma, perfect_vsync, giz_scanlines, giz_dblbuff // 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 PicoOpt; // used for config saving only, see Pico.h
int PsndRate; // ditto int PsndRate; // ditto
int PicoRegion; // ditto int PicoRegion; // ditto

View file

@ -64,11 +64,13 @@ typedef enum
MA_OPT2_RAMTIMINGS, /* gp2x */ MA_OPT2_RAMTIMINGS, /* gp2x */
MA_OPT2_SQUIDGEHACK, /* gp2x */ MA_OPT2_SQUIDGEHACK, /* gp2x */
MA_OPT2_STATUS_LINE, /* psp */ MA_OPT2_STATUS_LINE, /* psp */
MA_OPT2_NO_FRAME_LIMIT, /* psp */
MA_OPT2_DONE, MA_OPT2_DONE,
MA_OPT3_SCALE, /* psp (all OPT3) */ MA_OPT3_SCALE, /* psp (all OPT3) */
MA_OPT3_HSCALE32, MA_OPT3_HSCALE32,
MA_OPT3_HSCALE40, MA_OPT3_HSCALE40,
MA_OPT3_PRES_NOSCALE, MA_OPT3_PRES_NOSCALE,
MA_OPT3_PRES_SCALE43,
MA_OPT3_PRES_FULLSCR, MA_OPT3_PRES_FULLSCR,
MA_OPT3_FILTERING, MA_OPT3_FILTERING,
MA_OPT3_VSYNC, MA_OPT3_VSYNC,

View file

@ -197,7 +197,6 @@ static void set_scaling_params(void)
if (fbimg_width >= 480) { if (fbimg_width >= 480) {
g_vertices[0].u = (fbimg_width-480)/2; g_vertices[0].u = (fbimg_width-480)/2;
g_vertices[1].u = src_width - (fbimg_width-480)/2 - 1; g_vertices[1].u = src_width - (fbimg_width-480)/2 - 1;
if (fbimg_width == 480) border_hack = 1;
fbimg_width = 480; fbimg_width = 480;
fbimg_xoffs = 0; fbimg_xoffs = 0;
} else { } else {
@ -205,6 +204,7 @@ static void set_scaling_params(void)
g_vertices[1].u = src_width; g_vertices[1].u = src_width;
fbimg_xoffs = 240 - fbimg_width/2; fbimg_xoffs = 240 - fbimg_width/2;
} }
if (fbimg_width > 320 && fbimg_width <= 480) border_hack = 1;
if (fbimg_height >= 272) { if (fbimg_height >= 272) {
g_vertices[0].v = (fbimg_height-272)/2; g_vertices[0].v = (fbimg_height-272)/2;
@ -990,7 +990,7 @@ void emu_Loop(void)
for (i = 0; i < currentConfig.Frameskip; i++) { for (i = 0; i < currentConfig.Frameskip; i++) {
updateKeys(); updateKeys();
SkipFrame(); frames_done++; SkipFrame(); frames_done++;
if (PsndOut) { // do framelimitting if sound is enabled if (!(currentConfig.EmuOpt&0x40000)) { // do framelimitting if needed
int tval_diff; int tval_diff;
tval = sceKernelGetSystemTimeLow(); tval = sceKernelGetSystemTimeLow();
tval_diff = (int)(tval - tval_thissec) << 8; tval_diff = (int)(tval - tval_thissec) << 8;
@ -1035,7 +1035,7 @@ void emu_Loop(void)
if (currentConfig.Frameskip < 0 && tval_diff - lim_time >= (300000<<8)) // slowdown detection if (currentConfig.Frameskip < 0 && tval_diff - lim_time >= (300000<<8)) // slowdown detection
reset_timing = 1; 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 // sleep if we are still too fast
if (tval_diff < lim_time) if (tval_diff < lim_time)

View file

@ -335,13 +335,14 @@ end:
} }
static SceIoStat cpstat;
static char *romsel_loop(char *curr_path) static char *romsel_loop(char *curr_path)
{ {
struct my_dirent **namelist; struct my_dirent **namelist;
int n, iret, sel = 0; int n, iret, sel = 0;
unsigned long inp = 0; unsigned long inp = 0;
char *ret = NULL, *fname = NULL; char *ret = NULL, *fname = NULL;
SceIoStat cpstat;
// is this a dir or a full path? // is this a dir or a full path?
memset(&cpstat, 0, sizeof(cpstat)); memset(&cpstat, 0, sizeof(cpstat));
@ -349,8 +350,11 @@ static char *romsel_loop(char *curr_path)
if (iret >= 0 && (cpstat.st_attr & FIO_SO_IFREG)) { // file if (iret >= 0 && (cpstat.st_attr & FIO_SO_IFREG)) { // file
char *p; char *p;
for (p = curr_path + strlen(curr_path) - 1; p > curr_path && *p != '/'; p--); for (p = curr_path + strlen(curr_path) - 1; p > curr_path && *p != '/'; p--);
*p = 0; if (p > curr_path) {
fname = p+1; *p = 0;
fname = p+1;
}
else strcpy(curr_path, "ms0:/");
} }
else if (iret >= 0 && (cpstat.st_attr & FIO_SO_IFDIR)); // dir else if (iret >= 0 && (cpstat.st_attr & FIO_SO_IFDIR)); // dir
else strcpy(curr_path, "ms0:/"); // something else else strcpy(curr_path, "ms0:/"); // something else
@ -402,7 +406,7 @@ static char *romsel_loop(char *curr_path)
p = start + strlen(start) - 1; p = start + strlen(start) - 1;
while (*p == '/' && p > start) p--; while (*p == '/' && p > start) p--;
while (*p != '/' && *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 { strncpy(newdir, start, p-start); newdir[p-start] = 0; }
} else { } else {
strcpy(newdir, curr_path); strcpy(newdir, curr_path);
@ -1004,6 +1008,7 @@ menu_entry opt3_entries[] =
{ NULL, MB_ONOFF, MA_OPT3_FILTERING, &currentConfig.scaling, 1, 0, 0, 1 }, { NULL, MB_ONOFF, MA_OPT3_FILTERING, &currentConfig.scaling, 1, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT3_VSYNC, NULL, 0, 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 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 }, { "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 }, { "done", MB_NONE, MA_OPT3_DONE, NULL, 0, 0, 0, 1 },
}; };
@ -1137,6 +1142,12 @@ static void dispmenu_loop_options(void)
currentConfig.scale = currentConfig.hscale40 = currentConfig.hscale32 = 1.0; currentConfig.scale = currentConfig.hscale40 = currentConfig.hscale32 = 1.0;
menu_opt3_preview(is_32col); menu_opt3_preview(is_32col);
break; 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: case MA_OPT3_PRES_FULLSCR:
currentConfig.scale = 1.20; currentConfig.scale = 1.20;
currentConfig.hscale40 = 1.25; currentConfig.hscale40 = 1.25;
@ -1158,13 +1169,14 @@ static void dispmenu_loop_options(void)
menu_entry opt2_entries[] = menu_entry opt2_entries[] =
{ {
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &currentConfig.PicoOpt,0x00004, 0, 0, 1 }, { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &currentConfig.PicoOpt,0x00004, 0, 0, 1 },
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &currentConfig.PicoOpt,0x00001, 0, 0, 1 }, { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &currentConfig.PicoOpt,0x00001, 0, 0, 1 },
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&currentConfig.PicoOpt,0x00002, 0, 0, 1 }, { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496, &currentConfig.PicoOpt,0x00002, 0, 0, 1 },
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, &currentConfig.EmuOpt, 0x00008, 0, 0, 1 }, { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, &currentConfig.EmuOpt, 0x00008, 0, 0, 1 },
{ "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, &currentConfig.EmuOpt, 0x00020, 0, 0, 1 }, { "Don't save last used ROM", MB_ONOFF, MA_OPT2_NO_LAST_ROM, &currentConfig.EmuOpt, 0x00020, 0, 0, 1 },
{ "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, &currentConfig.EmuOpt, 0x20000, 0, 0, 1 }, { "Status line in main menu", MB_ONOFF, MA_OPT2_STATUS_LINE, &currentConfig.EmuOpt, 0x20000, 0, 0, 1 },
{ "done", MB_NONE, MA_OPT2_DONE, NULL, 0, 0, 0, 1 }, { "Disable frame limitter", MB_ONOFF, MA_OPT2_NO_FRAME_LIMIT, &currentConfig.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])) #define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0]))

View file

@ -212,6 +212,7 @@ char *psp_get_status_line(void)
/* alt logging */ /* alt logging */
#define LOG_FILE "log.txt" #define LOG_FILE "log.txt"
#ifndef LPRINTF_STDIO
typedef struct _log_entry typedef struct _log_entry
{ {
char buff[256]; char buff[256];
@ -219,6 +220,7 @@ typedef struct _log_entry
} log_entry; } log_entry;
static log_entry *le_root = NULL; static log_entry *le_root = NULL;
#endif
void lprintf_f(const char *fmt, ...) void lprintf_f(const char *fmt, ...)
{ {

View file

@ -1,2 +1,2 @@
#define VERSION "1.35" #define VERSION "1.35a"