Previous Thread
Next Thread
Print Thread
Page 52 of 69 1 2 50 51 52 53 54 68 69
CD-i Fan #55797 10/30/09 05:49 PM
Joined: May 2009
Posts: 2,234
Likes: 410
J
Very Senior Member
Very Senior Member
J Offline
Joined: May 2009
Posts: 2,234
Likes: 410
Originally Posted by CD-i Fan
I'm still reading smile

It probably wants correct subcode Q data; this must be put in cdram directly after the data at offset 0x924 (I left that out in the code I sent you). The BIOS looks for subcode Q mode 1 packets, these have the following format:

CTRL TRACK INDEX MIN SEC FRAC ZERO AMIN ASEC AFRAC CRC1 CRC2

The value of CTRL is 0x01 for audio, 0x41 for data; the remainder should be obvious (the BIOS doesn't check AMIN/ASEC/AFRAC). This is all described in the CDDA spec; the details are vague as it's long ago I checked.

After the subcode Q data should probably follow the subcode R-W data, used for e.g. CD-Graphics, I haven't gotten around to verify this. The subcode Q data is is already de-interleaved, I'm not sure about the rest.

During a TOC read the TOC data should go here as well, in it's full native glory (packets for each track and for points A0/A1/A2). See CDDA spec, somewhat tedious to get right frown

Grah! That sounds like it's going to be a pain and a half, but it's doable, since AFAIK the CHD format includes subcode Q data and subcode R-W data... theoretically.

Just Desserts #55798 10/30/09 07:09 PM
Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
It does if the rip provides them, but those fields can all be trivially synthesized if necessary too. For CDDA what will be important is the audio flag and the track/index/minutes/seconds/frames values.

Just Desserts #55799 10/30/09 07:12 PM
Joined: Apr 2004
Posts: 1,563
Likes: 12
J
Very Senior Member
Very Senior Member
J Online: Content
Joined: Apr 2004
Posts: 1,563
Likes: 12
The chd format does support the subcode channels. There does not seem to be code to return the subcode information during a TOC read.

judge #55800 10/30/09 07:24 PM
Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
The TOC has no subcodes. What planet are your CDs from? smile

R. Belmont #55801 10/30/09 07:26 PM
Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
Anyway, cdrom_read_subcode() will read the subcode data if it was stored in the rip (which it isn't for any of these CD-i games as far as I can tell). Otherwise it returns garbage. Sorry smile

R. Belmont #55802 10/30/09 07:36 PM
Joined: Apr 2004
Posts: 1,563
Likes: 12
J
Very Senior Member
Very Senior Member
J Online: Content
Joined: Apr 2004
Posts: 1,563
Likes: 12
Quote
in the Lead-in area, successive q-Data fields contain the table of contents of the disc. Each q subcode block contains the data for a single track, and the data for each track is repeated in three successive blocks before going on to the next one.

Btw, for pce cd support I put in some code which creates subcode based on the location on the disc.

R. Belmont #55803 10/30/09 09:45 PM
Joined: Sep 2009
Posts: 223
C
Senior Member
Senior Member
C Offline
Joined: Sep 2009
Posts: 223
Originally Posted by R. Belmont
It does if the rip provides them, but those fields can all be trivially synthesized if necessary too. For CDDA what will be important is the audio flag and the track/index/minutes/seconds/frames values.
Yep, CD-i Emulator synthesizes them too. It doesn't even use the subcode info if the disc image has it, which it really should smile

R. Belmont #55804 10/30/09 09:47 PM
Joined: Sep 2009
Posts: 223
C
Senior Member
Senior Member
C Offline
Joined: Sep 2009
Posts: 223
Originally Posted by R. Belmont
The TOC has no subcodes. What planet are your CDs from? smile
Oops, originally my mistake. I should have termed it "lead-in read" smile The TOC is recorded in the Q subcode channel of the lead-in area.

CD-i Fan #55811 10/31/09 11:33 AM
Joined: May 2009
Posts: 2,234
Likes: 410
J
Very Senior Member
Very Senior Member
J Offline
Joined: May 2009
Posts: 2,234
Likes: 410
Originally Posted by CD-i Fan
It probably wants correct subcode Q data; this must be put in cdram directly after the data at offset 0x924 (I left that out in the code I sent you).

This is not the case, sadly. Something else is upsetting the BIOS when the game tries to play a CDDA track. I can tell, because at no point is the BIOS even getting far enough in the CDDA processing to read from offset 0x924... frown

My current methodology is:

- First, upon a CDDA request, begin processing after either 1/75th of a second or the current time remaining until a CD sector transfer, whichever comes first
- After processing commences due to the callback...
- Calculate the current MSF frame, calculated by taking CDIC_TIME & 0xffff7f00
- Calculate the next MSF frame, by taking CDIC_TIME & 0xffff7f00 and incrementing by BCD 0x00000100.
- Calculate the next MSF frame, rounded to the next second, by taking CDIC_TIME & 0xffff0000 and incrementing by BCD 0x00010000.
- Set CDIC_TIME to be the next MSF frame
- Read a sector's worth of data at CDIC_TIME
- If we're at frame 0, begin playing a second's worth of CDDA audio by just playing it through the "CDDA" audio device in MESS
- If we're also at frame 0, trigger an interrupt
- Set a callback to trigger after 1/75th of a second, to poll the next MSF frame

I can't seem to determine what CDIC register bits should be set or cleared upon CDDA read...

Just Desserts #55813 10/31/09 11:57 AM
Joined: May 2004
Posts: 1,782
Likes: 38
H
Very Senior Member
Very Senior Member
H Offline
Joined: May 2004
Posts: 1,782
Likes: 38
from a quick look, it seems that you're holding the 68k interrupt line for so long it has no chance / time to do anything else while CDDA is playing.

The only interrupt it ever takes is the CDDA related one, and no further processing takes place therefore the game never advances another frame while the CDDA is playing, because Vbl etc. are never taken.

If you hack the 1hz timer, you can get badly distorted music but the game will continue as normal.

As for the correct solution, you're on your own.

Page 52 of 69 1 2 50 51 52 53 54 68 69

Link Copied to Clipboard
Who's Online Now
0 members (), 628 guests, and 6 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,399
Posts122,883
Members5,092
Most Online3,327
Nov 10th, 2025
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0