VOGONS


ioctl vs. noioctl ways in Vista

Topic actions

First post, by gidierre

User metadata
Rank Member
Rank
Member

did a little debugging compare work between -ioctl (failing) & -noioctl (working) cdrom mount in Vista, used TR1 as the dos app to test with,
using to be precise a fresh dosbox install with DOSBox0.72-Debug-win32-installer.exe (the DOSBox 0.72 heavy debug version install package dated 2007-8-31 @ 11:51 am by Qbix)

see attached ioctl/noioctl debug logs,

now, extracting for you some lines from those logs, in short I spotted these snippets,
one from noioctl log (working with cdaudio tracks playing) :

33918684: MISC:MSCDEX: INT 2F 1500 BX= 0000 CX=0000
33918702: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918702: MISC:MSCDEX: Driver Function 85
33918702: MISC:MSCDEX: Status : 0100
33918720: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918720: MISC:MSCDEX: Driver Function 03
33918720: MISC:MSCDEX: IOCTL INPUT Subfunction 09
33918720: MISC:MSCDEX: Status : 0100
33918738: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918738: MISC:MSCDEX: Driver Function 03
33918738: MISC:MSCDEX: IOCTL INPUT Subfunction 06
33918738: MISC:MSCDEX: Status : 0100
33918756: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918756: MISC:MSCDEX: Driver Function 03
33918756: MISC:MSCDEX: IOCTL INPUT Subfunction 0A
33918756: MISC:MSCDEX: Status : 0100
33918774: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918774: MISC:MSCDEX: Driver Function 03
33918774: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
33918774: MISC:MSCDEX: Status : 0100
33918792: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918792: MISC:MSCDEX: Driver Function 03
33918792: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
33918792: MISC:MSCDEX: Status : 0100

and the other is its approximate paragon from ioctl log (no cdaudio play) :

23347310: MISC:MSCDEX: INT 2F 1500 BX= 0000 CX=0000
23347328: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347328: MISC:MSCDEX: Driver Function 85
23347328: MISC:MSCDEX: Status : 0100
23347346: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347346: MISC:MSCDEX: Driver Function 03
23347346: MISC:MSCDEX: IOCTL INPUT Subfunction 09
23347346: MISC:MSCDEX: Status : 0100
23347364: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347364: MISC:MSCDEX: Driver Function 03
23347364: MISC:MSCDEX: IOCTL INPUT Subfunction 06
23347364: MISC:MSCDEX: Status : 0100
23347382: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347382: MISC:MSCDEX: Driver Function 03
23347382: MISC:MSCDEX: IOCTL INPUT Subfunction 0A
23347382: MISC:MSCDEX: Status : 0100
23347400: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347400: MISC:MSCDEX: Driver Function 03
23347400: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347400: MISC:MSCDEX: Status : 0100
23347418: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347418: MISC:MSCDEX: Driver Function 03
23347418: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347418: MISC:MSCDEX: Status : 0100
23347436: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347436: MISC:MSCDEX: Driver Function 03
23347436: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347436: MISC:MSCDEX: Status : 0100
23347454: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347454: MISC:MSCDEX: Driver Function 03
23347454: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347454: MISC:MSCDEX: Status : 0100
23347472: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347472: MISC:MSCDEX: Driver Function 03
23347472: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347472: MISC:MSCDEX: Status : 0100
23347490: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347490: MISC:MSCDEX: Driver Function 03
23347490: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347490: MISC:MSCDEX: Status : 0100
23347508: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347508: MISC:MSCDEX: Driver Function 03
23347508: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347508: MISC:MSCDEX: Status : 0100
23347526: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347526: MISC:MSCDEX: Driver Function 03
23347526: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347526: MISC:MSCDEX: Status : 0100
23347544: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347544: MISC:MSCDEX: Driver Function 03
23347544: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347544: MISC:MSCDEX: Status : 0100
23347562: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347562: MISC:MSCDEX: Driver Function 03
23347562: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347562: MISC:MSCDEX: Status : 0100

the way I can get it, it's clear the paths part here with

33918792: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
33918792: MISC:MSCDEX: Driver Function 03
33918792: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
33918792: MISC:MSCDEX: Status : 0100

that's where -noioctl presumably takes off to SDL interface (CDROM_Interface_SDL as per cdrom.cpp)
after a couple of failed (I think, because MSCDEX status : 0100 then bit 15 : set) attempts to call
INT 2F 1510,
driver function 03,
ioctl input subfunction 0B,
corresponding to Audio Track Info request,

as I gather (hoping I'm not getting it all wrong)
from looking up

dos_mscdex.cpp

function MSCDEX_Interrupt_Handler()
switch (funcNr) {
case 0x03 : { /* IOCTL INPUT */
...

static Bit16u MSCDEX_IOCTL_Input(PhysPt buffer,Bit8u drive_unit) {
Bitu ioctl_fct = mem_readb(buffer);

switch (ioctl_fct) {
case 0x0B :{/* Audio Track Info */
Bit8u attr; TMSF start;
Bit8u track = mem_readb(buffer+1);
mscdex->GetTrackInfo(drive_unit,track,attr,start);
mem_writeb(buffer+2,start.fr);
mem_writeb(buffer+3,start.sec);
mem_writeb(buffer+4,start.min);
mem_writeb(buffer+5,0x00);
mem_writeb(buffer+6,attr);
break; };
etc.

In sapucdex.c source, where there's no chance it can resort to noioctl calls and in fact cdaudio music also fails in Vista, I guess that would match

void DevIoctlInput(DRIVE_POINTER *DrvInfo, DEVICE_REQUEST *VdmReq)

the relevant spot being as I figure

void DevIoctlInput(DRIVE_POINTER *DrvInfo, DEVICE_REQUEST *VdmReq);
...
void ApiSendDeviceDriverRequest(void)
{
int drive;
DRIVE_POINTER *DrvInfo;
DEVICE_REQUEST *VdmReq;
....
switch (VdmReq->header.cmd)
{
case DEV_IOCTL_INPUT: // IOCTL INPUT
DevIoctlInput(DrvInfo, VdmReq);
break;

Now my question to the developers would be :

from the ioctl log snippet, no sound being heard in Vista, it's clear that there

23347400: MISC:MSCDEX: INT 2F 1510 BX= 0000 CX=0003
23347400: MISC:MSCDEX: Driver Function 03
23347400: MISC:MSCDEX: IOCTL INPUT Subfunction 0B
23347400: MISC:MSCDEX: Status : 0100

ten times poor subfunction 0B keeps on knocking at the door, until it gives up and it just goes on without music.

If my attempted divination makes sense (does it ?) how could the ioctl failure be bypassed to have sound as noioctl sdl gets, but keeping the more powerful features the ioctl structures could provide ?

Attachments

  • Filename
    ioctl log.txt
    File size
    18.98 KiB
    Downloads
    460 downloads
    File license
    Fair use/fair dealing exception
  • Filename
    noioctl log.txt
    File size
    21.83 KiB
    Downloads
    457 downloads
    File license
    Fair use/fair dealing exception
Last edited by gidierre on 2008-03-31, 21:49. Edited 1 time in total.

Reply 1 of 48, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Does it actually work with sapucdex?

Try adding more logging like

case 0x0B :{/* Audio Track Info */ Bit8u attr; TMSF start; Bit8u track = mem_readb(buffer+1); mscdex->GetTrackInf […]
Show full quote

case 0x0B :{/* Audio Track Info */
Bit8u attr; TMSF start;
Bit8u track = mem_readb(buffer+1);
mscdex->GetTrackInfo(drive_unit,track,attr,start);
LOG_MSG("get audiotrack info, track %d, -> %d:%d:%d attr %x",track,start.fr,start.sec,start.min,attr);

and similar in the respective lowlevel cdrom parts.

Reply 2 of 48, by gidierre

User metadata
Rank Member
Rank
Member
wd wrote:

Does it actually work with sapucdex?

oh, no, no, sapucdex & its ioctl calls are completely useless in Vista.

and you know it can't switch to noioctl or sdl or anything, so sapucdex (and therefore dgVoodoo who relies on it) in Vista
amounts to
no caudio track music at all

like dosbox, I must say, when using -ioctl.

Reply 3 of 48, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

TR 1 dos. Mmm I do have it but it is still in it's original packing. (well it is some rerelease)

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 48, by gidierre

User metadata
Rank Member
Rank
Member
Qbix wrote:

TR 1 dos. Mmm I do have it but it is still in it's original packing. (well it is some rerelease)

Tomb raider 1 is a 1996 dos game which Dosbox 0.72 runs pretty well.

In this thread I'm talking about the "normal" (non 3dfx/glide) exe version, to keep it as simple as it can be.

One thing you must needs know :
talking about rereleases, at one time in the course of videogame wereldgeschiedenis, they had the bright idea of delivering a Sold Out version which... lacks cdaudio music 😵

see
http://www.tombraiderhub.com/faq/tr1.html#sound
http://www.tombraiderhub.com/faq/traudio.html

so if such is what you have I'm afraid it's not the right version to try out ioctl monkey businesses with 🙄

they use Glidos + KMO's gorgeous audiopack for that now
(see KMORelease110.zip which I attach as it's full of very interesting info on this),

or use a replacement cdrom,

or I could send you an image of my own original cdrom if necessary (TR1 as opposed to #2 and above was never localized so I have the English version anyway).

Just thought it fair to inform you before you start checking and find you're losing your time 😦

Attachments

  • Filename
    KMORelease110.zip
    File size
    367.44 KiB
    Downloads
    518 downloads
    File license
    Fair use/fair dealing exception

Reply 6 of 48, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I don't think Gidierre can compile dosbox himself.

I've attached shots of my version. (which includes a photocamera 😀 )

Attachments

  • laraf.JPG
    Filename
    laraf.JPG
    File size
    84.51 KiB
    Views
    4628 views
    File comment
    front
    File license
    Fair use/fair dealing exception
  • larab.JPG
    Filename
    larab.JPG
    File size
    76.77 KiB
    Views
    4628 views
    File comment
    back
    File license
    Fair use/fair dealing exception

Water flows down the stream
How to ask questions the smart way!

Reply 7 of 48, by gidierre

User metadata
Rank Member
Rank
Member
Qbix wrote:

I don't think Gidierre can compile dosbox himself.

I've attached shots of my version. (which includes a photocamera 😀 )

It seems to me it is NOT the defective thing.. only way to be sure is trying it though

well actually, Qbix, I can compile, I did it many times with MinGW/MSYS when I was struggling with glide.cpp and that nasty glide shadow issue..

the simple fact is, wd, I took note of your hint of course and I thank you for it, but..
I'm not sure what logging info would be really relevant to add, beside the GetTrackInfo() part, I mean.

Before entering a quagmire of sorts, could you please give me some more specific advice 😊 ?

Reply 8 of 48, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Use the code i posted above, that is the LOG_MSG line added,
goes into dos_mscdex.cpp (function MSCDEX_IOCTL_Input).
Compare the different outputs when using the ioctl and sdl interfaces.

The returncode 0x0100 means "operation done", error would be 0x8000+.

Reply 9 of 48, by gidierre

User metadata
Rank Member
Rank
Member
wd wrote:

Use the code i posted above, that is the LOG_MSG line added,
goes into dos_mscdex.cpp (function MSCDEX_IOCTL_Input).
Compare the different outputs when using the ioctl and sdl interfaces.

thx, I'll try that
hey, somehow it's like when I was getting around to understanding the glide wrapper functions, I had begun by sneaking a whole bunch of LOG_MSG spotlights all around the place, it took ages just to guess the connections but it was fun 😀

wd wrote:

The returncode 0x0100 means "operation done", error would be 0x8000+.

oops 😊 you got me, bit #15
Give me this day my daily blunder 😒

btw if operation is done, then why doesn't the routine get over it ?

Reply 10 of 48, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I guess that either the attribute field is incorrect (so it doesn't find the
audio tracks) or the track length/last track position is different from what TR
expects, both things might be results of a dummy-only or incomplete
implementation of the TOC ioctl function.

Reply 11 of 48, by gidierre

User metadata
Rank Member
Rank
Member

that's pretty exciting stuff !
It'll take me a couple of days or so until I can do this little debug test and hopefully I'll be coming up with something bright 🙄

---------------------------

I don't know how much/if that would be apropos, but I can't help reminiscing Paul Gardiner's problems & hacks thereof when he found a way to summon back msdcex failing support for the sake of Glidos v1.10 audio capability.
Will it interest you or anyone ? Be on topic here ? Only the Shadow knows!
What if I report here his attitude ?

Was that.. a yes 😜
Since you insist so, it wouldn't be polite of me not to attach a tiny digest of his (and Vladr's) proceedings 🤣

Attachments

  • Filename
    Paul talks!.rtf
    File size
    2.85 KiB
    Downloads
    401 downloads
    File license
    Fair use/fair dealing exception

Reply 12 of 48, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Or you could just post the log again with the additional output,
if it's the same for ioctl and sdl something different is going on,
but if there are difference i'll put up some code that might get
around the problematic ioctl calls.

Reply 13 of 48, by gidierre

User metadata
Rank Member
Rank
Member

wd...? (ouch)

before I go and compile it

hoping
it != "much TODO about nothing";

one question.
I know, me sux 😖

I had noticed you wrote :

"Try adding more logging like
...
LOG_MSG("get audiotrack info, track %d, -> %d:%d:%d attr %x",track,start.fr,start.sec,start.min,attr);
...
and similar in the respective lowlevel cdrom parts"

Now, I've been thumbing through cdrom.h, cdrom.cpp and cdrom_ioctl_win32.cpp a bit

buzzing over class CDROM_Interface_Ioctl & class CDROM_Interface_SDL

I say, is it worthwhile to add more LOG_MSG over there as you hinted ?

In cdrom_ioctl_win32.cpp e.g.

I spotted these

bool CDROM_Interface_Ioctl::GetAudioTracks(int& stTrack, int& endTrack, TMSF& leadOut) 
{
// Open();
CDROM_TOC toc;
DWORD byteCount;
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &byteCount,NULL);
// Close();
if (!bStat) return false;

stTrack = toc.FirstTrack;
endTrack = toc.LastTrack;
leadOut.min = toc.TrackData[endTrack].Address[1];
leadOut.sec = toc.TrackData[endTrack].Address[2];
leadOut.fr = toc.TrackData[endTrack].Address[3];
return true;
};

/////////////

bool CDROM_Interface_Ioctl::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr)
{
// Open();
CDROM_TOC toc;
DWORD byteCount;
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &byteCount,NULL);
// Close();
if (!bStat) return false;

attr = (toc.TrackData[track-1].Control << 4) & 0xEF;
start.min = toc.TrackData[track-1].Address[1];
start.sec = toc.TrackData[track-1].Address[2];
start.fr = toc.TrackData[track-1].Address[3];
return true;
};

likewise, in cdrom.cpp

bool CDROM_Interface_SDL::GetAudioTracks(int& stTrack, int& end, TMSF& leadOut)
{

if (CD_INDRIVE(SDL_CDStatus(cd))) {
stTrack = 1;
end = cd->numtracks;
FRAMES_TO_MSF(cd->track[cd->numtracks].offset,&leadOut.min,&leadOut.sec,&leadOut.fr);
}
return CD_INDRIVE(SDL_CDStatus(cd));
};

///////////

bool CDROM_Interface_SDL::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr)
{
if (CD_INDRIVE(SDL_CDStatus(cd))) {
FRAMES_TO_MSF(cd->track[track-1].offset,&start.min,&start.sec,&start.fr);
attr = cd->track[track-1].type<<4;//sdl uses 0 for audio and 4 for data. instead of 0x00 and 0x40
}
return CD_INDRIVE(SDL_CDStatus(cd));
};

What if append some LOG flares there too, before compiling, along the lines you pointed to ? Or something different (like what) ?

Or is this just what chez Qbix they'd be calling
onbegonnen werk
(a werk that no wise man ever bothers to handle) ?

------------------------------------

P.S.

but,
in dos_mscdex.cpp

though noone's ever gonna read it 😎
shouldn't
line #1094 :

MSCDEX_LOG("MSCDEX: INT 2F %04X BX= %04X CX=%04X",reg_ax,reg_bx,reg_cx);

read :

-> MSCDEX_LOG("MSCDEX: INT 2F AX= %04X BX= %04X CX=%04X",reg_ax,reg_bx,reg_cx);

instead ?

Reply 14 of 48, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Just skip the lowlevel function logging for now, usually placing logging at
the upper levels AND lower levels around problematic code is rather
helpful though as you can track bugs in the parameter passing that way,
check what functions are really called etc.

shouldn't
line #1094 :
read ...

AX or AH usually specify the function of an interrupt, so somebody left out
annotating that explicitly.

Reply 15 of 48, by gidierre

User metadata
Rank Member
Rank
Member
wd wrote:

Just skip the lowlevel function logging for now

copy that.

Anyway, I understand the lowlevel functions I pinpointed were the right ones to search for 😁
(otherwise I guess you would have corrected me 😜 ).

I'm creeping, but, you know, I don't know if you know that I don't know if I know what I'm doing.

------------

Imagine!

Reply 16 of 48, by gidierre

User metadata
Rank Member
Rank
Member

hey,

I thought I was going to compile a debug version of dosbox, but I seem to only get the usual version as have always got before.

Yet this time I was sure to use
./configure --enable-debug
make
in msys as per instructions in the guide.

I don't get the debug window, only the console one. There ironically the LOG_MSG thingy will appear, but I wanted the debugger 😠

What did I do wrong ? Missed some other switch or trick ? A special source packet for the debugger ? I don't think such a separate thing exists.

The exe I compile is functional, except for no debugger.
Alt+Pause pauses the game, won't open any debug window, like no such feature opened on its own. Why is that ?

Help grrrrreatly appreciated 😳

Reply 17 of 48, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

do you have pdcurses installed ?
take a look in config.log to see why the debugger didn't activate (the switch is correct, but it will disable itself if you don't have curses)

Water flows down the stream
How to ask questions the smart way!

Reply 18 of 48, by gidierre

User metadata
Rank Member
Rank
Member
Qbix wrote:

do you have pdcurses installed ?
take a look in config.log to see why the debugger didn't activate (the switch is correct, but it will disable itself if you don't have curses)

WARNING: Can't find curses, debug mode disabled

😢

better go get it

hope installation & use are not too much exotic