Changeset 188 for sbliveos2/trunk/drv16


Ignore:
Timestamp:
Sep 9, 2001, 5:31:35 PM (24 years ago)
Author:
sandervl
Message:

joystick reactivated; version increase; Rudi's fixes

Location:
sbliveos2/trunk/drv16
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sbliveos2/trunk/drv16/init.cpp

    r178 r188  
    6565#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002UL
    6666#endif
    67 #define PCI_ID  ((PCI_DEVICE_ID_CREATIVE_EMU10K1<<16UL)|PCI_VENDOR_ID_CREATIVE)
     67
     68#ifndef PCI_DEVICE_ID_CREATIVE_EMU10K1_JOYSTICK
     69#define PCI_DEVICE_ID_CREATIVE_EMU10K1_JOYSTICK 0x7002
     70#endif
     71
     72#define PCI_ID     ((PCI_DEVICE_ID_CREATIVE_EMU10K1<<16UL)|PCI_VENDOR_ID_CREATIVE)
     73#define PCI_IDJOY  ((PCI_DEVICE_ID_CREATIVE_EMU10K1_JOYSTICK<<16UL)|PCI_VENDOR_ID_CREATIVE)
    6874
    6975// Default MIDI timer interval, milliseconds.
     
    7682static char szSBLiveAllocResFailed1[] = "Another device driver was granted exclusive access to IRQ ";
    7783static char szSBLiveAllocResFailed2[] = "Unable to allocate hardware resources! Aborting...";
    78 static char szSBLiveConfig1[]  = "SB Live! configuration: IRQ ";
    79 static char szSBLiveConfig2[]  = ", IO Port 0x";
    80 
     84static char szSBLiveConfig1[]   = "SB Live! configuration: IRQ ";
     85static char szSBLiveConfig2[]   = ", IO Port 0x";
     86static char szSBLiveConfigJoy[] = "SB Live! Joystick     : IO Port 0x";
    8187
    8288//
     
    183189        HexWordToASCII(digit, pResources->uIOBase[0], 0);
    184190        DosWrite(1, (VOID FAR*)digit, strlen(digit), &result);
    185 
    186         DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
    187         DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
    188191   }
    189192   delete pResources;
     193
     194   //Joystick detection
     195   if(pRM->bIsDevDetected(PCI_IDJOY, SEARCH_ID_DEVICEID, TRUE))
     196   {
     197       pResources = pRM->pGetDevResources(PCI_IDJOY, SEARCH_ID_DEVICEID, TRUE, TRUE);
     198       if((pResources) && !pResources->isEmpty() && fVerbose) {
     199           USHORT result;
     200           DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
     201           DosWrite(1, (VOID FAR*)szSBLiveConfigJoy, sizeof(szSBLiveConfigJoy)-1, &result);
     202           HexWordToASCII(digit, pResources->uIOBase[0], 0);
     203           DosWrite(1, (VOID FAR*)digit, strlen(digit), &result);
     204       }
     205       delete pResources;
     206   }
     207   if (fVerbose) {
     208        USHORT result;
     209        DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
     210        DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
     211   }
    190212
    191213   // Build the MPU401 object only if we got a good 2115 init.
  • sbliveos2/trunk/drv16/ioctl.cpp

    r186 r188  
    108108      }
    109109      else {
    110          delete pstream;
     110#if 1
     111        // Rudi: Workaround for MMPM device sharing bug
     112        if (pstream->ulStreamState & STREAM_STREAMING) {
     113          CONTROL_PARM dummy;
     114          pstream->PauseStream(&dummy);
     115          pstream->ResumeStream();
     116          p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum;
     117          p->sReturnCode = 0;
     118          return;
     119        }
     120#endif
     121         delete pstream;
    111122      }
    112123   }
  • sbliveos2/trunk/drv16/wavestrm.cpp

    r178 r188  
    165165                //underrun: stop playback
    166166                dprintf(("underrun: stop playback"));
    167                 pahw->Stop(this);
     167                pahw->Stop(this);
    168168                fUnderrun = TRUE;
    169169                return;
     
    171171        space = OSS16_StreamGetSpace(this);
    172172        while(space) {
    173                 byteswritten = AddBuffer(space);
     173                byteswritten = AddBuffer(space);
     174                if(byteswritten == (ULONG)-1) break;
    174175                space -= byteswritten;
    175                 if(byteswritten == 0) break;
    176         }       
     176        }
    177177   }
    178178}
     
    191191
    192192   if(!pTemp || pTemp->ulBuffpos >= (pTemp->ulBuffsz & 0xFFFFFFFC)) {
    193         pTemp = (PSTREAMBUFFER)qhInProcess.Head();
     193        pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    194194   }
    195195   if(!pTemp) {
    196196        dprintf4(("AddBuffer: pTemp == NULL"));
    197         return 0;
     197        return (ULONG)-1;
    198198   }
    199199
     
    202202   Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
    203203
    204    // write the audio buffer
    205    Buff_left = min(Buff_left, space);
    206    byteswritten = OSS16_StreamAddBuffer(this, pdataBuf, Buff_left);
    207    if(byteswritten == 0) {
    208         return 0; //no more room
    209    }
    210 
    211    // update the buffer pos counter
    212    pTemp->ulBuffpos += byteswritten;
    213 
    214    if(pTemp != qhDone.Tail()) {
    215         qhDone.PushOnTail(qhInProcess.PopHead());
     204   if(Buff_left) {
     205        // write the audio buffer
     206        Buff_left = min(Buff_left, space);
     207        byteswritten = OSS16_StreamAddBuffer(this, pdataBuf, Buff_left);
     208        if(byteswritten == 0) {
     209            return (ULONG)-1; //no more room
     210        }
     211
     212        // update the buffer pos counter
     213        pTemp->ulBuffpos += byteswritten;
     214   }
     215   else byteswritten = 0;
     216
     217   if(pTemp == qhInProcess.Head()) {
     218        qhDone.PushOnTail(qhInProcess.PopHead());
    216219   }
    217220   dprintf4(("AddBuffer %lx size %d, bytes written %d", pdataBuf, (USHORT)Buff_left, (USHORT)byteswritten));
     
    299302          else  break; //shouldn't happen
    300303        }
    301 
    302         //Get rid of empty buffers
    303         ptemp = (PSTREAMBUFFER)qhInProcess.Head();
    304         if(ptemp && (ptemp->ulBuffsz == 0 || ptemp->pBuffptr == NULL)) {
    305                 dprintf(("Returning 0 size buffer immediately"));
    306                 ReturnBuffer();
    307         }
    308         AddBuffers(FALSE);
    309         break;
    310    }
    311    case STREAM_READ:           
    312         while(_vReadAudioBuf());
    313         break;
     304        AddBuffers(FALSE);
     305        break;
     306   }
     307   case STREAM_READ:
     308        while(_vReadAudioBuf());
     309        break;
    314310   default:
    315311      break;
Note: See TracChangeset for help on using the changeset viewer.