else if (strcasecmp(ext, "cso") == 0)\r
{\r
cso_struct *cso = NULL, *tmp = NULL;\r
- int size;\r
+ int i, size;\r
f = fopen(path, "rb");\r
if (f == NULL)\r
goto cso_failed;\r
elprintf(EL_STATUS, "cso: premature EOF");\r
goto cso_failed;\r
}\r
+ for (i = 0; i < size/4; i++)\r
+ cso->index[i] = CPU_LE4(cso->index[i]);\r
\r
// all ok\r
cso->fpos_in = ftell(f);\r
chd->file.file = chd;\r
chd->file.type = PMT_CHD;\r
// subchannel data is skipped, remove it from total size\r
- chd->file.size = chd_get_header(cf)->logicalbytes / CD_FRAME_SIZE * CD_MAX_SECTOR_DATA;\r
+ chd->file.size = head->logicalbytes / CD_FRAME_SIZE * CD_MAX_SECTOR_DATA;\r
strncpy(chd->file.ext, ext, sizeof(chd->file.ext) - 1);\r
return &chd->file;\r
\r
if (len > bytes)\r
len = bytes;\r
\r
-#ifdef CPU_IS_LE\r
+#if CPU_IS_LE\r
if (is_audio) {\r
// convert big endian audio samples\r
u16 *dst = ptr, v;\r
\r
// Unusual region 'code'\r
if (rom_strcmp(0x1f0, "EUROPE") == 0 || rom_strcmp(0x1f0, "Europe") == 0)\r
- *(int *) (Pico.rom + 0x1f0) = 0x20204520;\r
+ *(u32 *) (Pico.rom + 0x1f0) = CPU_LE4(0x20204520);\r
}\r
\r
// vim:shiftwidth=2:expandtab\r
\r
goto write_comm;\r
case 6:\r
- Pico_mcd->bios[0x72 + 1] = d; // simple hint vector changer\r
+ Pico_mcd->bios[MEM_BE2(0x72)] = d; // simple hint vector changer\r
return;\r
case 7:\r
- Pico_mcd->bios[0x72] = d;\r
+ Pico_mcd->bios[MEM_BE2(0x73)] = d;\r
elprintf(EL_CDREGS, "hint vector set to %04x%04x",\r
((u16 *)Pico_mcd->bios)[0x70/2], ((u16 *)Pico_mcd->bios)[0x72/2]);\r
return;\r
\r
#define READ_FONT_DATA(basemask) \\r
{ \\r
- unsigned int fnt = *(unsigned int *)(Pico_mcd->s68k_regs + 0x4c); \\r
+ unsigned int fnt = CPU_LE4(*(u32 *)(Pico_mcd->s68k_regs + 0x4c)); \\r
unsigned int col0 = (fnt >> 8) & 0x0f, col1 = (fnt >> 12) & 0x0f; \\r
if (fnt & (basemask << 0)) d = col1 ; else d = col0; \\r
if (fnt & (basemask << 1)) d |= col1 << 4; else d |= col0 << 4; \\r
}
addr = ch->addr;
- inc = *(unsigned short *)&ch->regs[2];
+ inc = ch->regs[2] + (ch->regs[3]<<8);
mul_l = ((int)ch->regs[0] * (ch->regs[1] & 0xf)) >> (5+1);
mul_r = ((int)ch->regs[0] * (ch->regs[1] >> 4)) >> (5+1);
// test for loop signal
if (smp == 0xff)
{
- addr = *(unsigned short *)&ch->regs[4]; // loop_addr
+ addr = ch->regs[4] + (ch->regs[5]<<8); // loop_addr
smp = Pico_mcd->pcm_ram[addr];
addr <<= PCM_STEP_SHIFT;
if (smp == 0xff)
#define MEM_LE2(a) (a)
#define MEM_LE4(a) (a)
// swapping
-#define CPU_BE2(v) ((u32)((u64)(v)<<16)|((v)>>16))
+#define CPU_BE2(v) ((u32)((u64)(v)<<16)|((u32)(v)>>16))
#define CPU_BE4(v) (((u32)(v)>>24)|(((v)>>8)&0x00ff00)| \
(((v)<<8)&0xff0000)|(u32)((v)<<24))
#define CPU_LE2(v) (v) // swap of 2*u16 in u32
// swapping
#define CPU_BE2(v) (v)
#define CPU_BE4(v) (v)
-#define CPU_LE2(v) ((u32)((u64)(v)<<16)|((v)>>16))
+#define CPU_LE2(v) ((u32)((u64)(v)<<16)|((u32)(v)>>16))
#define CPU_LE4(v) (((u32)(v)>>24)|(((v)>>8)&0x00ff00)| \
(((v)<<8)&0xff0000)|(u32)((v)<<24))
#endif