Make WINE detect an image as a CD drive with an audio disc

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
User avatar
boltronics
Newbie
Newbie
Posts: 3
Joined: Sun Dec 27, 2009 2:05 am

Make WINE detect an image as a CD drive with an audio disc

Post by boltronics »

I've been trying to figure this one out for some time now without success and can't find anyone else with this exact problem, so hopefully there's a guru around here that might be able to point me in the right direction.

I've got a copy of Dark Reign I want to play on my netbook. The problem is that I only have a USB CD drive which I don't normally connect, but can for a once-off install. This is one of those weird multi-track CDs where the first track is data and the remaining tracks are normal CD audio... and I want audio in my game. So I ripped the whole image to bin format using AcetoneISO, and can mount that on the loopback (/dev/loop0) fine.

Code: Select all

fdisk -l /dev/loop0
reports the expected size (658Mb) so I don't think there's any issue with the way the image was ripped or looped.

So I've got:

Code: Select all

$ sudo losetup /dev/loop0 dark_reign.bin
$ sudo mount /dev/loop0 /media/loop0
and I configured d: device in winecfg to be type CD-ROM or Autodetect. Either will be sufficient to get the game to run. However, I just can't get CD audio tracks (the background music) working. It does work fine if I insert the disc, let it automount and change the path in winecfg to where it automounted, but as stated I don't always have the drive with me. There must be some way to get wine to recognise these tracks on a loopback device.

I've tried setting various system link configurations under dosdevices based on hints I found via Google. eg:

Code: Select all

c: -> ../drive_c
cdrom0 -> /dev/loop0
d: -> /media/loop0/
d:: -> /dev/loop0
z: -> /
Nothing works.

How do I get Wine or the Linux kernel to make /dev/loop0 appear as a real CD-ROM device so I can hear the audio tracks? Or maybe I'm going about this all wrong?
DaVince
Level 8
Level 8
Posts: 1099
Joined: Wed Oct 29, 2008 4:53 pm

Post by DaVince »

I'm not sure about it, but perhaps the mount command just can't tell if a bin has audio tracks or not? Considering a bin file is still different from an actual CD...
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

I'm not sure if this can work properly using loopback. I would try to use cdemu which emulates a proper fake cd drive.
User avatar
boltronics
Newbie
Newbie
Posts: 3
Joined: Sun Dec 27, 2009 2:05 am

[SOLVED] Make WINE detect an image as a CD drive with an aud

Post by boltronics »

Thunderbird wrote:I'm not sure if this can work properly using loopback. I would try to use cdemu which emulates a proper fake cd drive.
Perfect! CDemu was the answer. I'd never heard of it before, and it was a PITA to get it going (no Debian build, multiple packages, various compile errors, a bit of learning how to use it, etc.)... but now it works exactly as it should. Thanks guys!
User avatar
SpawnHappyJake
Level 5
Level 5
Posts: 272
Joined: Sun Feb 06, 2011 5:57 am

Post by SpawnHappyJake »

Yep. Y'all correct. I go into more detail here: http://forum.winehq.org/viewtopic.php?p ... ght=#63474, which itself has a link to further detail.
Though, Boltronics, I seriously wonder how you managed to compile CDemu from source. Maybe you can pm me?
The reason why audio tracks don't work with the loopback device is because the loopback mounter only mounts a single filesystem. Audio tracks have no filesystem. They contain no files, only almost raw audio data. When you insert an audio CD into Linux, Mac OS X, or Windows, each operating system has its own unique attempt to make it appear as though there are audio files on the CD, but they are all spoofs.
And you can only mount one filesystem by itself with this method per mount. Floppy images are just a single partition formatted to a filesystem without anything else - no mbr, no "track0", nothing else, so they can be mounted directly with the sudo mount command. Iso images work out the same way. With hard drive images, you can only mount one partition in that image with this method (per mount), and you must offset to where the partition begins. BTW, qemu-nbd is a great tool for mounting hard drive images as a block device when the mount command doesn't cut it.

Cheers,
Jake
Locked