minivmac4ios/Mini vMac/mnvm_core/COMOSGLU.h

1 line
23 KiB
C
Raw Normal View History

2016-05-01 17:05:36 +00:00
/* COMOSGLU.h Copyright (C) 2009 Paul C. Pratt You can redistribute this file and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. You should have received a copy of the license along with this file; see the file COPYING. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /* COMmon code for Operating System GLUe */ GLOBALVAR ui3p ROM = nullpr; GLOBALVAR ui5b vSonyWritableMask = 0; GLOBALVAR ui5b vSonyInsertedMask = 0; #if IncludeSonyRawMode GLOBALVAR blnr vSonyRawMode = falseblnr; #endif #if IncludeSonyNew GLOBALVAR blnr vSonyNewDiskWanted = falseblnr; GLOBALVAR ui5b vSonyNewDiskSize; #endif #if IncludeSonyNameNew GLOBALVAR tPbuf vSonyNewDiskName = NotAPbuf; #endif GLOBALVAR ui5b CurMacDateInSeconds = 0; GLOBALVAR ui5b CurMacLatitude = 0; GLOBALVAR ui5b CurMacLongitude = 0; GLOBALVAR ui5b CurMacDelta = 0; #if 0 != vMacScreenDepth GLOBALVAR blnr UseColorMode = falseblnr; GLOBALVAR blnr ColorModeWorks = falseblnr; #endif #if 0 != vMacScreenDepth GLOBALVAR blnr ColorMappingChanged = falseblnr; #endif #if (0 != vMacScreenDepth) && (vMacScreenDepth < 4) GLOBALVAR ui4r CLUT_reds[CLUT_size]; GLOBALVAR ui4r CLUT_greens[CLUT_size]; GLOBALVAR ui4r CLUT_blues[CLUT_size]; #endif LOCALVAR blnr RequestMacOff = falseblnr; GLOBALVAR blnr ForceMacOff = falseblnr; GLOBALVAR blnr WantMacInterrupt = falseblnr; GLOBALVAR blnr WantMacReset = falseblnr; GLOBALVAR ui3b SpeedValue = WantInitSpeedValue; #if EnableAutoSlow GLOBALVAR blnr WantNotAutoSlow = (WantInitNotAutoSlow != 0); #endif GLOBALVAR ui4b CurMouseV = 0; GLOBALVAR ui4b CurMouseH = 0; #if EnableMouseMotion && MayFullScreen LOCALVAR blnr HaveMouseMotion = falseblnr; #endif #if EnableAutoSlow GLOBALVAR ui5r QuietTime = 0; GLOBALVAR ui5r QuietSubTicks = 0; #endif #if IncludePbufs LOCALVAR ui5b PbufAllocatedMask; LOCALVAR ui5b PbufSize[NumPbufs]; #endif #if IncludePbufs #define PbufIsAllocated(i) ((PbufAllocatedMask & ((ui5b)1 << (i))) != 0) #endif #if IncludePbufs LOCALFUNC blnr FirstFreePbuf(tPbuf *r) { tPbuf i; for (i = 0; i < NumPbufs; ++i) { if (! PbufIsAllocated(i)) { *r = i; return trueblnr; } } return falseblnr; } #endif #if IncludePbufs LOCALPROC PbufNewNotify(tPbuf Pbuf_No, ui5b count) { PbufSize[Pbuf_No] = count; PbufAllocatedMask |= ((ui5b)1 << Pbuf_No); } #endif #if IncludePbufs LOCALPROC PbufDisposeNotify(tPbuf Pbuf_No) { PbufAllocatedMask &= ~ ((ui5b)1 << Pbuf_No); } #endif #if IncludePbufs GLOBALFUNC tMacErr CheckPbuf(tPbuf Pbuf_No) { tMacErr result; if (Pbuf_No >= NumPbufs) { result = mnvm_nsDrvErr; } else if (! PbufIsAllocated(Pbuf_No)) { result = mnvm_offLinErr; } else { result = mnvm_noErr; } return result; } #endif #if IncludePbufs GLOBALFUNC tMacErr PbufGetSize(tPbuf Pbuf_No, ui5r *Count) { tMacErr result = CheckPbuf(Pbuf_No); if (mnvm_noErr == result) { *Count = PbufSize[Pbuf_No]; } return result; } #endif LOCALFUNC blnr FirstFreeDisk(tDrive *Drive_No) { tDrive i; for (i = 0; i < NumDrives; ++i) { if (! vSonyIsInserted(i)) { *Drive_No = i; return trueblnr; } } return falseblnr; } GLOBALFUNC blnr AnyDiskInserted(void) { #if 0 tDrive i; for (i = 0; i < NumDrives; ++i) { if (vSonyIsInserted(i)) { return trueblnr; } } return falseblnr; #endif return 0 != vSonyInsertedMask; } GLOBALPROC DiskRevokeWritable(tDrive Drive_No) { vSonyWritableMask &= ~ ((ui5b)1 << Drive_No); } LOCALPROC DiskInsertNotify(tDrive Drive_No, blnr locked) { vSonyInsertedMask |= ((ui5b)1 << Drive_No); if (! locked) { vSonyWritableMask |= ((ui5b)1 << Drive_No); } QuietEnds(); } LOCALPROC DiskEjectedNotify(tDrive Drive_No) { vSonyWritableMask &= ~ ((ui5b)1 << Drive_No); vSonyInsertedMask &= ~ ((ui5b)1 << Drive_No); } /* block type - for operating on multiple ui3b elements at a time. */ #if LittleEndianUnaligned || BigEndianUnaligned #defin