void (*PicoCartLoadProgressCB)(int percent) = NULL;\r
void (*PicoCDLoadProgressCB)(int percent) = NULL; // handled in Pico/cd/cd_file.c\r
\r
+static void PicoCartDetect(void);\r
+\r
/* cso struct */\r
typedef struct _cso_struct\r
{\r
file->size = ftell(f);\r
file->type = PMT_UNCOMPRESSED;\r
fseek(f, 0, SEEK_SET);\r
+\r
return file;\r
}\r
\r
// notaz: add a 68k "jump one op back" opcode to the end of ROM.\r
// This will hang the emu, but will prevent nasty crashes.\r
// note: 4 bytes are padded to every ROM\r
- if(rom != NULL)\r
+ if (rom != NULL)\r
*(unsigned long *)(rom+romsize) = 0xFFFE4EFA; // 4EFA FFFE byteswapped\r
\r
Pico.rom=rom;\r
Pico.romsize=romsize;\r
\r
+ if (SRam.data) {\r
+ free(SRam.data);\r
+ SRam.data = NULL;\r
+ }\r
+\r
if (PicoCartUnloadHook != NULL) {\r
PicoCartUnloadHook();\r
PicoCartUnloadHook = NULL;\r
* various cart-specific things, which can't be handled by generic code\r
* (maybe I should start using CRC for this stuff?)\r
*/\r
-void PicoCartDetect(void)\r
+static void PicoCartDetect(void)\r
{\r
int sram_size = 0, csum;\r
- if(SRam.data) free(SRam.data); SRam.data=0;\r
Pico.m.sram_reg = 0;\r
\r
csum = PicoRead32(0x18c) & 0xffff;\r
if (sram_size)\r
{\r
SRam.data = (unsigned char *) calloc(sram_size, 1);\r
- if(!SRam.data) return;\r
+ if (SRam.data == NULL) return;\r
}\r
SRam.changed = 0;\r
\r
#define CHUNK_CARTHW 64\r
\r
// Cart.c\r
-PICO_INTERNAL void PicoCartDetect(void);\r
extern void (*PicoCartUnloadHook)(void);\r
\r
// Debug.c\r
#endif
// use SRam.data for RAM cart
- if (SRam.data) free(SRam.data);
- SRam.data = NULL;
- if (PicoOpt&0x8000)
- SRam.data = calloc(1, 0x12000);
+ if (PicoOpt&0x8000) {
+ if (SRam.data == NULL)
+ SRam.data = calloc(1, 0x12000);
+ }
+ else if (SRam.data != NULL) {
+ free(SRam.data);
+ SRam.data = NULL;
+ }
SRam.start = SRam.end = 0; // unused
return 0;
* Changed config file format, files are now human-readable. Game specific\r
configs are now held in single file (but old game config files are still\r
read).\r
- * Fixed a bug where some key combos didn't work.\r
- * Fixed a regression in renderer (rare graphic glitches).\r
+ * Fixed a bug where some key combos didn't work as expected.\r
+ * Fixed a regression in renderer (some graphic glitches in rare cases).\r
* Adjusted fast rernderer to work with more games, including VR.\r
+ * Fixed a problem where SegaCD RAM cart data was getting lost on reset.\r
\r
1.35b\r
* PSP: mp3 code should no longer fail on 1.5 firmware.\r
int size;
FILE *f;
- if (strlen(lastRomFile) == 0) return 0;
+ if (strlen(lastRomFile) == 0) return -1;
f = fopen(fname, "r");
if (f != NULL)
FILE *f;
f = fopen(fname, "r");
- if (f == NULL) return 0;
+ if (f == NULL) return -1;
if (section != NULL)
{
#include <linux/limits.h>\r
#include <ctype.h>\r
#include <unistd.h>\r
-#include <sched.h>\r
\r
#include <stdarg.h>\r
\r
gettimeofday(&tval, 0);\r
if (thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
\r
- if (tval.tv_usec < lim_time)\r
- sched_yield();\r
-\r
while (tval.tv_usec < lim_time)\r
{\r
spend_cycles(1024);\r
}\r
\r
if (unrecognized) {\r
- printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2007\n");\r
+ printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2008\n");\r
printf("usage: %s [options] [romfile]\n", argv[0]);\r
printf( "options:\n"\r
"-menu <menu_path> launch a custom program on exit instead of default gp2xmenu\n"\r