aboutsummaryrefslogtreecommitdiff
path: root/libmpio
diff options
context:
space:
mode:
authorgermeier <germeier>2003-03-25 23:56:51 +0000
committergermeier <germeier>2003-03-25 23:56:51 +0000
commit3a22100bafaa80b126a460e761398c371c92d973 (patch)
tree0deb35ec52d8cc5eecab43581f690c3133da07ce /libmpio
parent59256336cfaaa7feec76f0c4235382fb91eed243 (diff)
downloadmpiosh-3a22100bafaa80b126a460e761398c371c92d973.tar.gz
mpiosh-3a22100bafaa80b126a460e761398c371c92d973.tar.bz2
mpiosh-3a22100bafaa80b126a460e761398c371c92d973.zip
try to support changes in internal FAT structure on newer players.
Diffstat (limited to 'libmpio')
-rw-r--r--libmpio/fat.c39
-rw-r--r--libmpio/mpio.c4
2 files changed, 30 insertions, 13 deletions
diff --git a/libmpio/fat.c b/libmpio/fat.c
index d83dfc5..4dce812 100644
--- a/libmpio/fat.c
+++ b/libmpio/fat.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: fat.c,v 1.22 2003/03/15 14:34:44 germeier Exp $
+ * $Id: fat.c,v 1.23 2003/03/25 23:56:52 germeier Exp $
*
* Library for USB MPIO-*
*
@@ -383,8 +383,13 @@ mpio_fatentry_new(mpio_t *m, mpio_mem_t mem, DWORD sector, BYTE ftype)
new->i_fat[0x0b] = 0x00;
new->i_fat[0x0c] = 0x00;
new->i_fat[0x0d] = 0x00;
- new->i_fat[0x0e] = 'P';
- new->i_fat[0x0f] = 'C';
+ if (m->model >= MPIO_MODEL_FD100) {
+ /* 0x0e is a copy of the file index number */
+ new->i_fat[0x0f] = 0x00;
+ } else {
+ new->i_fat[0x0e] = 'P';
+ new->i_fat[0x0f] = 'C';
+ }
}
if (mem == MPIO_INTERNAL_MEM)
@@ -496,15 +501,25 @@ mpio_fatentry_read(mpio_t *m, mpio_mem_t mem, mpio_fatentry_t *f )
sm = &m->internal;
e = f->entry * 0x10;
/* check if this block became defective */
- if ((sm->fat[e+0x0e] != 'P') ||
- (sm->fat[e+0x0f] != 'C') ||
- ((sm->fat[e+0x00] != 0xaa) &&
- (sm->fat[e+0x00] != 0xee)))
- {
- debug("defective block encountered, abort reading!\n");
-/* return 0xaaaaaaaa; */
- return 0xffffffff;
- }
+ if (m->model >= MPIO_MODEL_FD100) {
+ /* newer models */
+ if ((sm->fat[e+0x0c] != 0) ||
+ (sm->fat[e+0x0f] != 0) ||
+ (sm->fat[e+0x01] != sm->fat[e+0x0e]))
+ {
+ debug("defective block encountered, abort reading! (newer models check)\n");
+ return 0xffffffff;
+ }
+ } else
+ if ((sm->fat[e+0x0e] != 'P') ||
+ (sm->fat[e+0x0f] != 'C') ||
+ ((sm->fat[e+0x00] != 0xaa) &&
+ (sm->fat[e+0x00] != 0xee)))
+ {
+ debug("defective block encountered, abort reading! (older models check)\n");
+ return 0xffffffff;
+ }
+
/* this is a special system file! */
if((sm->fat[e+6] != FTYPE_MUSIC) &&
(sm->fat[e+7] == 0xff) &&
diff --git a/libmpio/mpio.c b/libmpio/mpio.c
index 15b7e82..b112143 100644
--- a/libmpio/mpio.c
+++ b/libmpio/mpio.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: mpio.c,v 1.44 2003/03/24 19:19:18 germeier Exp $
+ * $Id: mpio.c,v 1.45 2003/03/25 23:56:52 germeier Exp $
*
* Library for USB MPIO-*
*
@@ -683,6 +683,8 @@ mpio_file_put_real(mpio_t *m, mpio_mem_t mem, mpio_filename_t i_filename,
f->i_index=mpio_fat_internal_find_fileindex(m);
debugn(2, "fileindex: %02x\n", f->i_index);
f->i_fat[0x01]= f->i_index;
+ if (m->model >= MPIO_MODEL_FD100)
+ f->i_fat[0x0e] = f->i_index;
start = f->i_index;
/* number of blocks needed for file */