VOGONS


First post, by Greyhawk

User metadata
Rank Newbie
Rank
Newbie

*Win32 build*

UPDATE and summary

- Found the ioctl bug, and provided solution in 3rd post.
- No solution to SDL found, since SDL doesn't have API for CD data reading, which is required to bypass protection.

END UPDATE

Well I wanted to play Might and Magic: World of Xeen(from RPG collections set), but it said that I had to take out the audio CD and put it the World of Xeen CD in.

I'm a programmer, and even done a NES emulator(unreleased), so I thought I'd look into. After getting the HEAD version, and getting it to compile in debug I started. (Using SDL 1.2.6, SDL net 1.2.5, zlib-1.1.4, and lpng125) (Built under MSVC .net 2003)

What I found out through debugging and research into mscdex IOCTL INPUT, is that dosbox may be setting the wrong bit for data track, in the Audio Track Info(Control Block Code 0x0B). You assign the value directly from SDL, which is 0x04, but according to 2 sources, should really be 0x40.

The two sources are:

http://lrs.fmi.uni-passau.de/support/doc/inte … -57/RB-2760.HTM
(Has some bad formatting, and typo'd)

http://www.he.net/~marcj/ioctl_input_codes.html
(Really definitive)

Now, in an attempt to get it to run, I tried setting that value to every bit, the only time the behavior appears to change is when the bit 0x40 is set. The new behavior is...

General Error

Please insure that a World of Xeen CD-ROM is loaded before re-running!

I will keep looking into this and will post updates when new possible emulation bugs are found during the search, but I noticed that the "digital copy permitted" bit will never be set in the Audio Track Info (Control Block Code 0x0B), which although isn't a cause of the bug, is an unsupported aspect.

BTW, XoZ does the following IOCTL INPUTs(Same order with/without 0x40 fix)...

0x09
0x06
0x09
0x0B
WoZ terminates without anymore calls to MSCDEX_Interrupt_Handler()

PS, Great job so far.

Last edited by Greyhawk on 2003-10-29, 08:30. Edited 1 time in total.

Reply 1 of 3, by Greyhawk

User metadata
Rank Newbie
Rank
Newbie

Yes! I got it to work.

Firstly, WoZ definitely requries the 0x40 bit to set to indicate "data track". Second, it has to be able to read the copyright name. SDL fails because ReadSectors() isn't implemented(always returns false). To bypass, I used -Ioctl, and also had to hack the bit for "data track" for it as well(Was passing back 0x10).

I don't have Aspi installed to check it if it's bit is set correctly.

Reply 2 of 3, by Greyhawk

User metadata
Rank Newbie
Rank
Newbie

Ok, with IOTCL I have a solution:

In cdrom_iotcl_win32.cpp line 78ish:

attr = (toc.TrackData[track-1].Adr << 4) | toc.TrackData[track].Control;

should be

attr = (toc.TrackData[track-1].Control << 4) & 0xEF;

Why?

Adr only specifies the type of data read in and is defined.

ADR Code Description 0h Q Sub-channel mode information not supplied 1h Q Sub-channel encodes current position data (i.e., tra […]
Show full quote

ADR Code Description
0h Q Sub-channel mode information not supplied
1h Q Sub-channel encodes current position data
(i.e., track, index, absolute address, relative address)
2h Q Sub-channel encodes media catalog number
3h Q Sub-channel encodes ISRC
4h - Fh Reserved

It's API and nothing to do with mscdex's IOCTL INPUT 0x0B.

Control << 4 you ask?

Well MSCDEX and T10/1363-D specification match almost identically except that you have to bit shift to match them.

& 0xEF : There is 1 new thing that don't apply to MSCDEX.

01x0b Data track, recorded uninterrupted
01x1b Data track, recorded incremental

MSCDEX just has 01x0 which is Data Track, so we don't need to care. (This might be supported in a later version of MSCDEX so this is optional)

With this, WoZ should work under IOTCL(and isn't a hacky fix).

I'm on vacation so I might get it working proper under SDL too.