Final Burn Neo > FBN Development

Neogeo cd mode1/2352 support

(1/2) > >>

barbudreadmon:
Hi,

I hooked the neogeo cd emulation in lr-fbalpha yesterday, and now i'm trying to get cue with a MODE1/2352 track to load (they don't in standalone either, which is sad since popular dumps like those from redump use this format), an example cue would be like this :

--- Code: ---FILE "Last Resort (Japan) (En,Ja) (Track 01).bin" BINARY
  TRACK 01 MODE1/2352
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 02).bin" BINARY
  TRACK 02 AUDIO
    FLAGS DCP
    INDEX 00 00:00:00
    INDEX 01 00:03:00
FILE "Last Resort (Japan) (En,Ja) (Track 03).bin" BINARY
  TRACK 03 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 04).bin" BINARY
  TRACK 04 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 05).bin" BINARY
  TRACK 05 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 06).bin" BINARY
  TRACK 06 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 07).bin" BINARY
  TRACK 07 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 08).bin" BINARY
  TRACK 08 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 09).bin" BINARY
  TRACK 09 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 10).bin" BINARY
  TRACK 10 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 11).bin" BINARY
  TRACK 11 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 12).bin" BINARY
  TRACK 12 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 13).bin" BINARY
  TRACK 13 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 14).bin" BINARY
  TRACK 14 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 15).bin" BINARY
  TRACK 15 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 16).bin" BINARY
  TRACK 16 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 17).bin" BINARY
  TRACK 17 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 18).bin" BINARY
  TRACK 18 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 19).bin" BINARY
  TRACK 19 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00
FILE "Last Resort (Japan) (En,Ja) (Track 20).bin" BINARY
  TRACK 20 AUDIO
    FLAGS DCP
    INDEX 01 00:00:00

--- End code ---

From what i understand in https://github.com/mamedev/mame/blob/master/src/lib/util/cdrom.cpp, they are tracks with a sector size of 2336 bytes and an offset of 16 bytes, so i tried to do the following in fba's code :

--- Code: ---struct isowavTRACK_DATA {
char Control;
int Mode;
char TrackNumber;
char Address[4];
TCHAR* Filename;
};

static int isowavGetTrackSizes()
{
// determine the lenght of the .iso / .mp3 files to complete the TOC

FILE*  h;

for (int i = isowavTOC->FirstTrack - 1; i < isowavTOC->LastTrack; i++) {

const char* address;

if (isowavTOC->TrackData[i].Control & 4) {

// data track

h = _tfopen(isowavTOC->TrackData[i].Filename, _T("rb"));
if (h == NULL) return 1;

if (isowavTOC->TrackData[i].Mode == 2352) {
fseek(h, 16, SEEK_END);
address = isowavLBAToMSF((ftell(h) + 2335) / 2336 + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
} else {
fseek(h, 0, SEEK_END);
address = isowavLBAToMSF((ftell(h) + 2047) / 2048 + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
}

if(h) fclose(h);

} else {

// audio track

h = _tfopen(isowavTOC->TrackData[i].Filename, _T("rb"));
if (h == NULL)return 1;

fseek(h, 0, SEEK_END);

address = isowavLBAToMSF(((ftell(h) + 2047) / 2048) + isowavMSFToLBA(isowavTOC->TrackData[i].Address));
if(h) fclose(h);
}

isowavTOC->TrackData[i + 1].Address[0] += 0; // always 0 [?]
isowavTOC->TrackData[i + 1].Address[1] += address[1]; // M
isowavTOC->TrackData[i + 1].Address[2] += address[2]; // S
isowavTOC->TrackData[i + 1].Address[3] += address[3]; // F
}

return 0;
}


static int isowavParseCueFile()
{
[...]
// type of track

if ((t = LabelCheck(s, _T("MODE1/2048"))) != 0) {
isowavTOC->TrackData[track - 1].Control = 4;
isowavTOC->TrackData[track - 1].Mode = 2048;

continue;
}
if ((t = LabelCheck(s, _T("MODE1/2352"))) != 0) {
isowavTOC->TrackData[track - 1].Control = 4;
isowavTOC->TrackData[track - 1].Mode = 2352;

continue;
}
if ((t = LabelCheck(s, _T("AUDIO"))) != 0) {
isowavTOC->TrackData[track - 1].Control = 0;

continue;
}
[...]
}

--- End code ---

Of course it doesn't work, any idea what i'm doing wrong ?

Best regards :).

dink:
Nice, really looking forward to bin/cue support in fba :D

I found some info that suggests that mode1/2352 has a 2048 sector size and offset of 16 (maybe?)  weird? hmm, give it a try?

check out this little proggy - binchunker, it converts .bin/.cue to .iso/.wav, and has a lot of nice info in it:
https://github.com/phracker/bchunk/blob/master/bchunk.c

best regards & good luck,
- dink

barbudreadmon:
Actually i noticed this one from my other libretro port project. It gives the same feeling as the fba cd implementation and accept all formats except chd. I definitely think i can somehow port it to fba.

SirVH:

--- Quote from: barbudreadmon on May 31, 2018, 02:01:07 AM ---Actually i noticed this one from my other libretro port project. It gives the same feeling as the fba cd implementation and accept all formats except chd. I definitely think i can somehow port it to fba.

--- End quote ---

Did you managed to port that into FBA?

barbudreadmon:

--- Quote from: SirVH on April 15, 2019, 01:52:27 AM ---Did you managed to port that into FBA?

--- End quote ---
Nope, i failed, and cd reading implementation in fbalpha was rewritten (along with ngcd emulation) since then, it's now only accepting ccd/sub/img iso (aka trurip) and single file MODE1/2352 bin/cue.

Navigation

[0] Message Index

[#] Next page

Go to full version