WIP: Move screen size to variables

Non-windows systems are probably broken right now. Color display in
general is probably broken. But, soon, you will be able to change the
screen size and color depth without recompiling. That would be nice.
This commit is contained in:
InvisibleUp 2020-03-05 21:54:02 -05:00
parent 4b9e429c82
commit be71368cf7
16 changed files with 280 additions and 507 deletions

View File

@ -26,10 +26,6 @@
#define IncludeSonyNew 1 #define IncludeSonyNew 1
#define IncludeSonyNameNew 1 #define IncludeSonyNameNew 1
#define vMacScreenHeight 342
#define vMacScreenWidth 512
#define vMacScreenDepth 0
#define kROM_Size 0x00020000 #define kROM_Size 0x00020000
#define IncludePbufs 1 #define IncludePbufs 1
@ -38,7 +34,12 @@
#define EnableMouseMotion 1 #define EnableMouseMotion 1
#define IncludeHostTextClipExchange 1 #define IncludeHostTextClipExchange 1
#define EnableAutoSlow 1
#define EmLocalTalk 0 #define EmLocalTalk 0
#define AutoLocation 1 #define AutoLocation 1
#define AutoTimeZone 1 #define AutoTimeZone 1
// Variable versions of configuration flags
extern bool EnableAutoSlow;
extern uint16_t vMacScreenHeight;
extern uint16_t vMacScreenWidth;
extern uint16_t vMacScreenDepth;

View File

@ -198,11 +198,8 @@ GLOBALFUNC bool RTC_Init(void)
#endif #endif
RTC.PARAMRAM[1 + Group2Base] = prb_volClickLo; RTC.PARAMRAM[1 + Group2Base] = prb_volClickLo;
RTC.PARAMRAM[2 + Group2Base] = prb_miscHi; RTC.PARAMRAM[2 + Group2Base] = prb_miscHi;
RTC.PARAMRAM[3 + Group2Base] = prb_miscLo RTC.PARAMRAM[3 + Group2Base] = prb_miscLo \
#if 0 != vMacScreenDepth | (vMacScreenDepth != 0) ? 0x80 : 0;
| 0x80
#endif
;
#if HaveXPRAM /* extended parameter ram initialized */ #if HaveXPRAM /* extended parameter ram initialized */
#if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx) #if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx)
@ -231,14 +228,14 @@ GLOBALFUNC bool RTC_Init(void)
RTC.PARAMRAM[0x46] = /* 0x42 */ 0x76; /* 'v' */ RTC.PARAMRAM[0x46] = /* 0x42 */ 0x76; /* 'v' */
RTC.PARAMRAM[0x47] = /* 0x32 */ 0x4D; /* 'M' */ RTC.PARAMRAM[0x47] = /* 0x32 */ 0x4D; /* 'M' */
/* mode */ /* mode */
#if (0 == vMacScreenDepth) || (vMacScreenDepth >= 4) if ((0 == vMacScreenDepth) || (vMacScreenDepth >= 4)) {
RTC.PARAMRAM[0x48] = 0x80; RTC.PARAMRAM[0x48] = 0x80;
#else } else {
RTC.PARAMRAM[0x48] = 0x81; RTC.PARAMRAM[0x48] = 0x81;
/* 0x81 doesn't quite work right at boot */ /* 0x81 doesn't quite work right at boot */
/* no, it seems to work now (?) */ /* no, it seems to work now (?) */
/* but only if depth <= 3 */ /* but only if depth <= 3 */
#endif }
#endif #endif
#if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx) #if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx)

View File

@ -176,10 +176,8 @@ GLOBALFUNC bool Vid_Init(void)
uint8_t * pTo_sMacOS68020; uint8_t * pTo_sMacOS68020;
uint8_t * pTo_OneBitMode; uint8_t * pTo_OneBitMode;
uint8_t * pTo_OneVidParams; uint8_t * pTo_OneVidParams;
#if 0 != vMacScreenDepth
uint8_t * pTo_ColorBitMode = nullpr; uint8_t * pTo_ColorBitMode = nullpr;
uint8_t * pTo_ColorVidParams; uint8_t * pTo_ColorVidParams;
#endif
pPatch = VidROM; pPatch = VidROM;
@ -263,11 +261,9 @@ GLOBALFUNC bool Vid_Init(void)
pTo_MajorLength = ReservePatchOSLstEntry(); pTo_MajorLength = ReservePatchOSLstEntry();
#endif #endif
pTo_OneBitMode = ReservePatchOSLstEntry(); pTo_OneBitMode = ReservePatchOSLstEntry();
#if 0 != vMacScreenDepth if ((vMacScreenDepth != 0) && ColorModeWorks) {
if (ColorModeWorks) {
pTo_ColorBitMode = ReservePatchOSLstEntry(); pTo_ColorBitMode = ReservePatchOSLstEntry();
} }
#endif
PatchAnEndOfLst(); PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_VideoType, 0x01 /* sRsrcType */); PatchAReservedOSLstEntry(pTo_VideoType, 0x01 /* sRsrcType */);
@ -344,8 +340,7 @@ GLOBALFUNC bool Vid_Init(void)
PatchAWord(0x0001); /* bmCmpSize */ PatchAWord(0x0001); /* bmCmpSize */
PatchALong(0x00000000); /* bmPlaneBytes */ PatchALong(0x00000000); /* bmPlaneBytes */
#if 0 != vMacScreenDepth if ((vMacScreenDepth != 0) && ColorModeWorks) {
if (ColorModeWorks) {
PatchAReservedOSLstEntry(pTo_ColorBitMode, 0x81); PatchAReservedOSLstEntry(pTo_ColorBitMode, 0x81);
pTo_ColorVidParams = ReservePatchOSLstEntry(); pTo_ColorVidParams = ReservePatchOSLstEntry();
@ -373,21 +368,20 @@ GLOBALFUNC bool Vid_Init(void)
PatchAWord(1 << vMacScreenDepth); /* bmPixelSize */ PatchAWord(1 << vMacScreenDepth); /* bmPixelSize */
PatchAWord((vMacScreenDepth < 4) ? 0x0001 : 0x0003); PatchAWord((vMacScreenDepth < 4) ? 0x0001 : 0x0003);
/* bmCmpCount */ /* bmCmpCount */
#if 4 == vMacScreenDepth if (4 == vMacScreenDepth) {
PatchAWord(0x0005); /* bmCmpSize */ PatchAWord(0x0005); /* bmCmpSize */
#elif 5 == vMacScreenDepth } else if (5 == vMacScreenDepth) {
PatchAWord(0x0008); /* bmCmpSize */ PatchAWord(0x0008); /* bmCmpSize */
#else } else {
PatchAWord(1 << vMacScreenDepth); /* bmCmpSize */ PatchAWord(1 << vMacScreenDepth); /* bmCmpSize */
#endif }
PatchALong(0x00000000); /* bmPlaneBytes */ PatchALong(0x00000000); /* bmPlaneBytes */
} }
#endif
UsedSoFar = (pPatch - VidROM) + 20; UsedSoFar = (pPatch - VidROM) + 20;
if (UsedSoFar > kVidROM_Size) { if (UsedSoFar > kVidROM_Size) {
ReportAbnormalID(0x0A01, "kVidROM_Size to small"); ReportAbnormalID(0x0A01, "kVidROM_Size too small");
return false; return false;
} }
@ -407,14 +401,14 @@ GLOBALFUNC bool Vid_Init(void)
ChecksumSlotROM(); ChecksumSlotROM();
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4) if ((0 != vMacScreenDepth) && (vMacScreenDepth < 4)) {
CLUT_reds[0] = 0xFFFF; CLUT_reds[0] = 0xFFFF;
CLUT_greens[0] = 0xFFFF; CLUT_greens[0] = 0xFFFF;
CLUT_blues[0] = 0xFFFF; CLUT_blues[0] = 0xFFFF;
CLUT_reds[CLUT_size - 1] = 0; CLUT_reds[CLUT_size - 1] = 0;
CLUT_greens[CLUT_size - 1] = 0; CLUT_greens[CLUT_size - 1] = 0;
CLUT_blues[CLUT_size - 1] = 0; CLUT_blues[CLUT_size - 1] = 0;
#endif }
return true; return true;
} }
@ -431,31 +425,27 @@ GLOBALPROC Vid_Update(void)
LOCALFUNC uint16_t Vid_GetMode(void) LOCALFUNC uint16_t Vid_GetMode(void)
{ {
return return (UseColorMode && (vMacScreenDepth != 0)) ? 129 : 128;
#if 0 != vMacScreenDepth
UseColorMode ? 129 :
#endif
128;
} }
LOCALFUNC tMacErr Vid_SetMode(uint16_t v) LOCALFUNC tMacErr Vid_SetMode(uint16_t v)
{ {
#if 0 == vMacScreenDepth if (
UnusedParam(v); (vMacScreenDepth == 0)
#else && UseColorMode != ((v != 128)
if (UseColorMode != ((v != 128) && ColorModeWorks)) { && ColorModeWorks)
) {
UseColorMode = ! UseColorMode; UseColorMode = ! UseColorMode;
ColorMappingChanged = true; ColorMappingChanged = true;
} }
#endif
return mnvm_noErr; return mnvm_noErr;
} }
GLOBALFUNC uint16_t Vid_Reset(void) GLOBALFUNC uint16_t Vid_Reset(void)
{ {
#if 0 != vMacScreenDepth if (0 != vMacScreenDepth) {
UseColorMode = false; UseColorMode = false;
#endif }
return 128; return 128;
} }
@ -491,37 +481,30 @@ LOCALPROC FillScreenWithGrayPattern(void)
int j; int j;
uint32_t *p1 = (uint32_t *)VidMem; uint32_t *p1 = (uint32_t *)VidMem;
#if 0 != vMacScreenDepth if (vMacScreenDepth > 0 && UseColorMode) {
if (UseColorMode) { uint32_t pat;
#if 1 == vMacScreenDepth switch (vMacScreenDepth) {
uint32_t pat = 0xCCCCCCCC; case 1: pat = 0xCCCCCCCC; break;
#elif 2 == vMacScreenDepth case 2: pat = 0xF0F0F0F0; break;
uint32_t pat = 0xF0F0F0F0; case 3: pat = 0xFF00FF00; break;
#elif 3 == vMacScreenDepth case 4: pat = 0x00007FFF; break;
uint32_t pat = 0xFF00FF00; default:
#elif 4 == vMacScreenDepth case 5: pat = 0x00000000; break;
uint32_t pat = 0x00007FFF; }
#elif 5 == vMacScreenDepth
uint32_t pat = 0x00000000;
#endif
for (i = vMacScreenHeight; --i >= 0; ) { for (i = vMacScreenHeight; --i >= 0; ) {
for (j = vMacScreenByteWidth >> 2; --j >= 0; ) { for (j = vMacScreenByteWidth >> 2; --j >= 0; ) {
*p1++ = pat; *p1++ = pat;
#if 5 == vMacScreenDepth if (vMacScreenDepth == 5) {
pat = (~ pat) & 0x00FFFFFF; pat = (~ pat) & 0x00FFFFFF;
#endif
} }
pat = (~ pat)
#if 4 == vMacScreenDepth
& 0x7FFF7FFF
#elif 5 == vMacScreenDepth
& 0x00FFFFFF
#endif
;
} }
} else if (vMacScreenDepth == 4) {
#endif pat = (~ pat) & 0x7FFF7FFF;
{ } else if (vMacScreenDepth == 5) {
pat = (~ pat) & 0x00FFFFFF;
}
}
} else {
uint32_t pat = 0xAAAAAAAA; uint32_t pat = 0xAAAAAAAA;
for (i = vMacScreenHeight; --i >= 0; ) { for (i = vMacScreenHeight; --i >= 0; ) {
@ -624,8 +607,7 @@ GLOBALPROC ExtnVideo_Access(CPTR p)
"Video_Access kCmndVideoControl, " "Video_Access kCmndVideoControl, "
"SetEntries"); "SetEntries");
#endif #endif
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4) if ((0 != vMacScreenDepth) && (vMacScreenDepth < 4) && UseColorMode) {
if (UseColorMode) {
CPTR csTable = get_vm_long( CPTR csTable = get_vm_long(
csParam + VDSetEntryRecord_csTable); csParam + VDSetEntryRecord_csTable);
uint16_t csStart = get_vm_word( uint16_t csStart = get_vm_word(
@ -699,9 +681,7 @@ GLOBALPROC ExtnVideo_Access(CPTR p)
ColorMappingChanged = true; ColorMappingChanged = true;
result = mnvm_noErr; result = mnvm_noErr;
} }
} else } else {
#endif
{
/* not implemented */ /* not implemented */
} }
break; break;

View File

@ -1750,7 +1750,6 @@ LOCALFUNC char * GetSubstitutionStr(char x)
s = kStrStoppedOff; s = kStrStoppedOff;
} }
break; break;
#if EnableAutoSlow
case 'l': case 'l':
if (WantNotAutoSlow) { if (WantNotAutoSlow) {
s = kStrStoppedOff; s = kStrStoppedOff;
@ -1758,7 +1757,6 @@ LOCALFUNC char * GetSubstitutionStr(char x)
s = kStrStoppedOn; s = kStrStoppedOn;
} }
break; break;
#endif
case 's': case 's':
switch (SpeedValue) { switch (SpeedValue) {
case 0: case 0:

View File

@ -45,18 +45,11 @@
#include "PROGMAIN.h" #include "PROGMAIN.h"
/* // Temporary location for config variables
ReportAbnormalID unused 0x1002 - 0x10FF bool EnableAutoSlow = true;
*/ uint16_t vMacScreenHeight = 342;
uint16_t vMacScreenWidth = 512;
const bool _EmVIA2 = false; uint16_t vMacScreenDepth = 0;
const bool _EmRTC = true;
const bool _EmVidCard = false;
const bool _EmClassicKbrd = true;
const bool _EmPMU = false;
const bool _EmMMU = false;
const bool _EmASC = false;
const bool _EmADB = false;
// Let's define a bunch of function structure thingies // Let's define a bunch of function structure thingies
@ -506,7 +499,7 @@ LOCALVAR uint32_t ExtraSubTicksToDo = 0;
LOCALPROC DoEmulateOneTick(void) LOCALPROC DoEmulateOneTick(void)
{ {
#if EnableAutoSlow if (EnableAutoSlow) {
uint32_t NewQuietTime = QuietTime + 1; uint32_t NewQuietTime = QuietTime + 1;
uint32_t NewQuietSubTicks = QuietSubTicks + kNumSubTicks; uint32_t NewQuietSubTicks = QuietSubTicks + kNumSubTicks;
@ -518,7 +511,7 @@ LOCALPROC DoEmulateOneTick(void)
/* if not overflow */ /* if not overflow */
QuietSubTicks = NewQuietSubTicks; QuietSubTicks = NewQuietSubTicks;
} }
#endif }
SixtiethSecondNotify(); SixtiethSecondNotify();
m68k_go_nCycles_1(CyclesScaledPerTick); m68k_go_nCycles_1(CyclesScaledPerTick);
@ -542,15 +535,14 @@ LOCALFUNC bool MoreSubTicksToDo(void)
bool v = false; bool v = false;
if (ExtraTimeNotOver() && (ExtraSubTicksToDo > 0)) { if (ExtraTimeNotOver() && (ExtraSubTicksToDo > 0)) {
#if EnableAutoSlow if (
if ((QuietSubTicks >= 16384) EnableAutoSlow
&& (QuietSubTicks >= 16384)
&& (QuietTime >= 34) && (QuietTime >= 34)
&& ! WantNotAutoSlow) && ! WantNotAutoSlow
{ ) {
ExtraSubTicksToDo = 0; ExtraSubTicksToDo = 0;
} else } else {
#endif
{
v = true; v = true;
} }
} }
@ -568,14 +560,14 @@ LOCALPROC DoEmulateExtraTime(void)
if (MoreSubTicksToDo()) { if (MoreSubTicksToDo()) {
ExtraTimeBeginNotify(); ExtraTimeBeginNotify();
do { do {
#if EnableAutoSlow if (EnableAutoSlow) {
uint32_t NewQuietSubTicks = QuietSubTicks + 1; uint32_t NewQuietSubTicks = QuietSubTicks + 1;
if (NewQuietSubTicks > QuietSubTicks) { if (NewQuietSubTicks > QuietSubTicks) {
/* if not overflow */ /* if not overflow */
QuietSubTicks = NewQuietSubTicks; QuietSubTicks = NewQuietSubTicks;
} }
#endif }
m68k_go_nCycles_1(CyclesScaledPerSubTick); m68k_go_nCycles_1(CyclesScaledPerSubTick);
--ExtraSubTicksToDo; --ExtraSubTicksToDo;
} while (MoreSubTicksToDo()); } while (MoreSubTicksToDo());

View File

@ -64,20 +64,14 @@ GLOBALVAR uint32_t CurMacLongitude = 0;
GLOBALVAR uint32_t CurMacDelta = 0; GLOBALVAR uint32_t CurMacDelta = 0;
#endif #endif
#if 0 != vMacScreenDepth
GLOBALVAR bool UseColorMode = false; GLOBALVAR bool UseColorMode = false;
GLOBALVAR bool ColorModeWorks = false; GLOBALVAR bool ColorModeWorks = false;
#endif
#if 0 != vMacScreenDepth
GLOBALVAR bool ColorMappingChanged = false; GLOBALVAR bool ColorMappingChanged = false;
#endif
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
GLOBALVAR uint16_t CLUT_reds[CLUT_size]; GLOBALVAR uint16_t CLUT_reds[CLUT_size];
GLOBALVAR uint16_t CLUT_greens[CLUT_size]; GLOBALVAR uint16_t CLUT_greens[CLUT_size];
GLOBALVAR uint16_t CLUT_blues[CLUT_size]; GLOBALVAR uint16_t CLUT_blues[CLUT_size];
#endif
LOCALVAR bool RequestMacOff = false; LOCALVAR bool RequestMacOff = false;
@ -89,9 +83,7 @@ GLOBALVAR bool WantMacReset = false;
GLOBALVAR uint8_t SpeedValue = WantInitSpeedValue; GLOBALVAR uint8_t SpeedValue = WantInitSpeedValue;
#if EnableAutoSlow
GLOBALVAR bool WantNotAutoSlow = (WantInitNotAutoSlow != 0); GLOBALVAR bool WantNotAutoSlow = (WantInitNotAutoSlow != 0);
#endif
GLOBALVAR uint16_t CurMouseV = 0; GLOBALVAR uint16_t CurMouseV = 0;
GLOBALVAR uint16_t CurMouseH = 0; GLOBALVAR uint16_t CurMouseH = 0;
@ -100,10 +92,8 @@ GLOBALVAR uint16_t CurMouseH = 0;
LOCALVAR bool HaveMouseMotion = false; LOCALVAR bool HaveMouseMotion = false;
#endif #endif
#if EnableAutoSlow
GLOBALVAR uint32_t QuietTime = 0; GLOBALVAR uint32_t QuietTime = 0;
GLOBALVAR uint32_t QuietSubTicks = 0; GLOBALVAR uint32_t QuietSubTicks = 0;
#endif
#ifndef GrabKeysFullScreen #ifndef GrabKeysFullScreen
#define GrabKeysFullScreen 1 #define GrabKeysFullScreen 1
@ -399,8 +389,7 @@ LOCALFUNC bool ScreenFindChanges(uint8_t * screencurrentbuff,
MaxRowsDrawnPerTick = vMacScreenHeight / 4; MaxRowsDrawnPerTick = vMacScreenHeight / 4;
} }
#if 0 != vMacScreenDepth if (UseColorMode && vMacScreenDepth > 0) {
if (UseColorMode) {
if (ColorMappingChanged) { if (ColorMappingChanged) {
ColorMappingChanged = false; ColorMappingChanged = false;
j0h = 0; j0h = 0;
@ -455,9 +444,9 @@ LOCALFUNC bool ScreenFindChanges(uint8_t * screencurrentbuff,
(vMacScreenBitWidth / uiblockbitsn), (vMacScreenBitWidth / uiblockbitsn),
j0v, j1v, &LeftMin, &LeftMask, &RightMax, &RightMask); j0v, j1v, &LeftMin, &LeftMask, &RightMax, &RightMask);
#if vMacScreenDepth > ln2uiblockbitsn if (vMacScreenDepth > ln2uiblockbitsn) {
j0h = (LeftMin >> (vMacScreenDepth - ln2uiblockbitsn)); j0h = (LeftMin >> (vMacScreenDepth - ln2uiblockbitsn));
#elif ln2uiblockbitsn > vMacScreenDepth } else if (ln2uiblockbitsn > vMacScreenDepth) {
for (j = 0; j < (1 << (ln2uiblockbitsn - vMacScreenDepth)); for (j = 0; j < (1 << (ln2uiblockbitsn - vMacScreenDepth));
++j) ++j)
{ {
@ -470,13 +459,13 @@ LOCALFUNC bool ScreenFindChanges(uint8_t * screencurrentbuff,
} }
Label_1c: Label_1c:
j0h = (LeftMin << (ln2uiblockbitsn - vMacScreenDepth)) + j; j0h = (LeftMin << (ln2uiblockbitsn - vMacScreenDepth)) + j;
#else } else {
j0h = LeftMin; j0h = LeftMin;
#endif }
#if vMacScreenDepth > ln2uiblockbitsn if (vMacScreenDepth > ln2uiblockbitsn) {
j1h = (RightMax >> (vMacScreenDepth - ln2uiblockbitsn)) + 1; j1h = (RightMax >> (vMacScreenDepth - ln2uiblockbitsn)) + 1;
#elif ln2uiblockbitsn > vMacScreenDepth } else if (ln2uiblockbitsn > vMacScreenDepth) {
for (j = (uiblockbitsn >> vMacScreenDepth); --j >= 0; ) { for (j = (uiblockbitsn >> vMacScreenDepth); --j >= 0; ) {
if (0 != (RightMask if (0 != (RightMask
& (((((uibr)1) << (1 << vMacScreenDepth)) - 1) & (((((uibr)1) << (1 << vMacScreenDepth)) - 1)
@ -486,21 +475,17 @@ Label_1c:
} }
} }
Label_2c: Label_2c:
j1h = (RightMax << (ln2uiblockbitsn - vMacScreenDepth)) j1h = (RightMax << (ln2uiblockbitsn - vMacScreenDepth)) + j + 1;
+ j + 1; } else {
#else
j1h = RightMax + 1; j1h = RightMax + 1;
#endif }
} }
copyrows = j1v - j0v; copyrows = j1v - j0v;
copyoffset = j0v * vMacScreenByteWidth; copyoffset = j0v * vMacScreenByteWidth;
copysize = copyrows * vMacScreenByteWidth; copysize = copyrows * vMacScreenByteWidth;
} else } else {
#endif if (vMacScreenDepth > 0 && ColorMappingChanged) {
{
#if 0 != vMacScreenDepth
if (ColorMappingChanged) {
ColorMappingChanged = false; ColorMappingChanged = false;
j0h = 0; j0h = 0;
j1h = vMacScreenWidth; j1h = vMacScreenWidth;
@ -509,9 +494,7 @@ Label_2c:
#if WantColorTransValid #if WantColorTransValid
ColorTransValid = false; ColorTransValid = false;
#endif #endif
} else } else {
#endif
{
if (! FindFirstChangeInLVecs( if (! FindFirstChangeInLVecs(
(uibb *)screencurrentbuff (uibb *)screencurrentbuff
+ NextDrawRow * (vMacScreenWidth / uiblockbitsn), + NextDrawRow * (vMacScreenWidth / uiblockbitsn),
@ -624,12 +607,12 @@ LOCALPROC ScreenChangedAll(void)
ScreenChangedRight = vMacScreenWidth; ScreenChangedRight = vMacScreenWidth;
} }
#if EnableAutoSlow /*
LOCALVAR int16_t ScreenChangedQuietTop = vMacScreenHeight; LOCALVAR int16_t ScreenChangedQuietTop = vMacScreenHeight;
LOCALVAR int16_t ScreenChangedQuietLeft = vMacScreenWidth; LOCALVAR int16_t ScreenChangedQuietLeft = vMacScreenWidth;
LOCALVAR int16_t ScreenChangedQuietBottom = 0; LOCALVAR int16_t ScreenChangedQuietBottom = 0;
LOCALVAR int16_t ScreenChangedQuietRight = 0; LOCALVAR int16_t ScreenChangedQuietRight = 0;
#endif */
GLOBALOSGLUPROC Screen_OutputFrame(uint8_t * screencurrentbuff) GLOBALOSGLUPROC Screen_OutputFrame(uint8_t * screencurrentbuff)
{ {
@ -655,7 +638,8 @@ GLOBALOSGLUPROC Screen_OutputFrame(uint8_t * screencurrentbuff)
ScreenChangedRight = right; ScreenChangedRight = right;
} }
#if EnableAutoSlow // Autoslow conditionals
/*
if (top < ScreenChangedQuietTop) { if (top < ScreenChangedQuietTop) {
ScreenChangedQuietTop = top; ScreenChangedQuietTop = top;
} }
@ -680,7 +664,7 @@ GLOBALOSGLUPROC Screen_OutputFrame(uint8_t * screencurrentbuff)
QuietEnds(); QuietEnds();
} }
#endif */
} }
} }
} }

View File

@ -59,17 +59,17 @@ LOCALPROC DrawCell(unsigned int h, unsigned int v, int x)
int i; int i;
uint8_t * p0 = ((uint8_t *)CellData) + 16 * x; uint8_t * p0 = ((uint8_t *)CellData) + 16 * x;
#if 0 != vMacScreenDepth if (vMacScreenDepth > 0 && UseColorMode) {
if (UseColorMode) {
uint8_t * p = CntrlDisplayBuff uint8_t * p = CntrlDisplayBuff
+ ((h + 1) << vMacScreenDepth) + ((h + 1) << vMacScreenDepth)
+ (v * 16 + 11) * vMacScreenByteWidth; + (v * 16 + 11) * vMacScreenByteWidth;
for (i = 16; --i >= 0; ) { for (i = 16; --i >= 0; ) {
#if 1 == vMacScreenDepth
int k; int k;
uint32_t v;
uint8_t t0 = *p0; uint8_t t0 = *p0;
uint8_t * p2 = p; uint8_t * p2 = p;
if (1 == vMacScreenDepth) {
for (k = 2; --k >= 0; ) { for (k = 2; --k >= 0; ) {
*p2++ = (((t0) & 0x80) ? 0xC0 : 0x00) *p2++ = (((t0) & 0x80) ? 0xC0 : 0x00)
| (((t0) & 0x40) ? 0x30 : 0x00) | (((t0) & 0x40) ? 0x30 : 0x00)
@ -78,29 +78,19 @@ LOCALPROC DrawCell(unsigned int h, unsigned int v, int x)
/* black RRGGBBAA, white RRGGBBAA */ /* black RRGGBBAA, white RRGGBBAA */
t0 <<= 4; t0 <<= 4;
} }
#elif 2 == vMacScreenDepth } else if (2 == vMacScreenDepth) {
int k;
uint8_t t0 = *p0;
uint8_t * p2 = p;
for (k = 4; --k >= 0; ) { for (k = 4; --k >= 0; ) {
*p2++ = (((t0) & 0x40) ? 0x0F : 0x00) *p2++ = (((t0) & 0x40) ? 0x0F : 0x00)
| (((t0) & 0x80) ? 0xF0 : 0x00); | (((t0) & 0x80) ? 0xF0 : 0x00);
/* black RRGGBBAA, white RRGGBBAA */ /* black RRGGBBAA, white RRGGBBAA */
t0 <<= 2; t0 <<= 2;
} }
#elif 3 == vMacScreenDepth } else if (3 == vMacScreenDepth) {
int k;
uint8_t t0 = *p0;
uint8_t * p2 = p;
for (k = 8; --k >= 0; ) { for (k = 8; --k >= 0; ) {
*p2++ = ((t0 >> k) & 0x01) ? 0xFF : 0x00; *p2++ = ((t0 >> k) & 0x01) ? 0xFF : 0x00;
/* black RRGGBBAA, white RRGGBBAA */ /* black RRGGBBAA, white RRGGBBAA */
} }
#elif 4 == vMacScreenDepth } else if (4 == vMacScreenDepth) {
int k;
uint16_t v;
uint8_t t0 = *p0;
uint8_t * p2 = p;
for (k = 8; --k >= 0; ) { for (k = 8; --k >= 0; ) {
v = ((t0 >> k) & 0x01) ? 0x0000 : 0x7FFF; v = ((t0 >> k) & 0x01) ? 0x0000 : 0x7FFF;
/* black RRGGBBAA, white RRGGBBAA */ /* black RRGGBBAA, white RRGGBBAA */
@ -108,11 +98,7 @@ LOCALPROC DrawCell(unsigned int h, unsigned int v, int x)
*p2++ = v >> 8; *p2++ = v >> 8;
*p2++ = v; *p2++ = v;
} }
#elif 5 == vMacScreenDepth } else if (5 == vMacScreenDepth) {
int k;
uint32_t v;
uint8_t t0 = *p0;
uint8_t * p2 = p;
for (k = 8; --k >= 0; ) { for (k = 8; --k >= 0; ) {
v = ((t0 >> k) & 0x01) ? 0x00000000 : 0x00FFFFFF; v = ((t0 >> k) & 0x01) ? 0x00000000 : 0x00FFFFFF;
/* black RRGGBBAA, white RRGGBBAA */ /* black RRGGBBAA, white RRGGBBAA */
@ -122,13 +108,11 @@ LOCALPROC DrawCell(unsigned int h, unsigned int v, int x)
*p2++ = v >> 8; *p2++ = v >> 8;
*p2++ = v; *p2++ = v;
} }
#endif }
p += vMacScreenByteWidth; p += vMacScreenByteWidth;
p0 ++; p0 ++;
} }
} else } else {
#endif
{
uint8_t * p = CntrlDisplayBuff + (h + 1) uint8_t * p = CntrlDisplayBuff + (h + 1)
+ (v * 16 + 11) * vMacScreenMonoByteWidth; + (v * 16 + 11) * vMacScreenMonoByteWidth;
@ -460,12 +444,8 @@ LOCALVAR int ControlMessage = 0;
enum { enum {
kCntrlModeOff, kCntrlModeOff,
kCntrlModeBase, kCntrlModeBase,
#if WantEnblCtrlRst
kCntrlModeConfirmReset, kCntrlModeConfirmReset,
#endif
#if WantEnblCtrlInt
kCntrlModeConfirmInterrupt, kCntrlModeConfirmInterrupt,
#endif
kCntrlModeConfirmQuit, kCntrlModeConfirmQuit,
kCntrlModeSpeedControl, kCntrlModeSpeedControl,
@ -474,39 +454,25 @@ enum {
enum { enum {
kCntrlMsgBaseStart, kCntrlMsgBaseStart,
#if EnableMagnify
kCntrlMsgMagnify, kCntrlMsgMagnify,
#endif
#if VarFullScreen
kCntrlMsgFullScreen, kCntrlMsgFullScreen,
#endif
#if WantEnblCtrlRst
kCntrlMsgConfirmResetStart, kCntrlMsgConfirmResetStart,
kCntrlMsgHaveReset, kCntrlMsgHaveReset,
kCntrlMsgResetCancelled, kCntrlMsgResetCancelled,
#endif
#if WantEnblCtrlInt
kCntrlMsgConfirmInterruptStart, kCntrlMsgConfirmInterruptStart,
kCntrlMsgHaveInterrupted, kCntrlMsgHaveInterrupted,
kCntrlMsgInterruptCancelled, kCntrlMsgInterruptCancelled,
#endif
kCntrlMsgConfirmQuitStart, kCntrlMsgConfirmQuitStart,
kCntrlMsgQuitCancelled, kCntrlMsgQuitCancelled,
#if WantEnblCtrlKtg
kCntrlMsgEmCntrl, kCntrlMsgEmCntrl,
#endif
kCntrlMsgSpeedControlStart, kCntrlMsgSpeedControlStart,
kCntrlMsgNewSpeed, kCntrlMsgNewSpeed,
kCntrlMsgNewStopped, kCntrlMsgNewStopped,
kCntrlMsgNewRunInBack, kCntrlMsgNewRunInBack,
#if EnableAutoSlow
kCntrlMsgNewAutoSlow, kCntrlMsgNewAutoSlow,
#endif
kCntrlMsgAbout, kCntrlMsgAbout,
kCntrlMsgHelp, kCntrlMsgHelp,
#if IncludePbufs
kCntrlMsgOptionsStrCopied, kCntrlMsgOptionsStrCopied,
#endif
kNumCntrlMsgs kNumCntrlMsgs
}; };
@ -782,13 +748,11 @@ LOCALPROC DoControlModeKey(uint8_t key)
ControlMessage = kCntrlMsgNewStopped; ControlMessage = kCntrlMsgNewStopped;
} }
break; break;
#if EnableAutoSlow
case MKC_W: case MKC_W:
WantNotAutoSlow = ! WantNotAutoSlow; WantNotAutoSlow = ! WantNotAutoSlow;
CurControlMode = kCntrlModeBase; CurControlMode = kCntrlModeBase;
ControlMessage = kCntrlMsgNewAutoSlow; ControlMessage = kCntrlMsgNewAutoSlow;
break; break;
#endif
case MKC_Z: case MKC_Z:
SetSpeedValue(0); SetSpeedValue(0);
break; break;
@ -912,9 +876,9 @@ LOCALPROC DrawCellsControlModeBody(void)
DrawCellsBlankLine(); DrawCellsBlankLine();
DrawCellsKeyCommand("D", kStrSpeedStopped); DrawCellsKeyCommand("D", kStrSpeedStopped);
DrawCellsKeyCommand("B", kStrSpeedBackToggle); DrawCellsKeyCommand("B", kStrSpeedBackToggle);
#if EnableAutoSlow if (EnableAutoSlow) {
DrawCellsKeyCommand("W", kStrSpeedAutoSlowToggle); DrawCellsKeyCommand("W", kStrSpeedAutoSlowToggle);
#endif }
DrawCellsBlankLine(); DrawCellsBlankLine();
DrawCellsKeyCommand("E", kStrSpeedExit); DrawCellsKeyCommand("E", kStrSpeedExit);
break; break;
@ -927,11 +891,9 @@ LOCALPROC DrawCellsControlModeBody(void)
case kCntrlMsgNewStopped: case kCntrlMsgNewStopped:
DrawCellsOneLineStr(kStrNewStopped); DrawCellsOneLineStr(kStrNewStopped);
break; break;
#if EnableAutoSlow
case kCntrlMsgNewAutoSlow: case kCntrlMsgNewAutoSlow:
DrawCellsOneLineStr(kStrNewAutoSlow); DrawCellsOneLineStr(kStrNewAutoSlow);
break; break;
#endif
#if EnableMagnify #if EnableMagnify
case kCntrlMsgMagnify: case kCntrlMsgMagnify:
DrawCellsOneLineStr(kStrNewMagnify); DrawCellsOneLineStr(kStrNewMagnify);
@ -1031,10 +993,10 @@ LOCALFUNC uint8_t * GetCurDrawBuff(void)
uint8_t * p = screencomparebuff; uint8_t * p = screencomparebuff;
if (0 != SpecialModes) { if (0 != SpecialModes) {
MoveBytes((anyp)p, (anyp)CntrlDisplayBuff, MoveBytes(
#if 0 != vMacScreenDepth (anyp)p, (anyp)CntrlDisplayBuff,
UseColorMode ? vMacScreenNumBytes : (vMacScreenDepth > 0 && UseColorMode) ?
#endif vMacScreenNumBytes :
vMacScreenMonoNumBytes vMacScreenMonoNumBytes
); );
p = CntrlDisplayBuff; p = CntrlDisplayBuff;

View File

@ -1682,17 +1682,11 @@ LOCALVAR uint8_t * CLUT_final;
#define CLUT_finalsz1 (256 * 8) #define CLUT_finalsz1 (256 * 8)
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
#define CLUT_finalClrSz (256 << (5 - vMacScreenDepth)) #define CLUT_finalClrSz (256 << (5 - vMacScreenDepth))
#define CLUT_finalsz ((CLUT_finalClrSz > CLUT_finalsz1) \ #define CLUT_finalsz ((CLUT_finalClrSz > CLUT_finalsz1) \
? CLUT_finalClrSz : CLUT_finalsz1) ? CLUT_finalClrSz : CLUT_finalsz1)
#else
#define CLUT_finalsz CLUT_finalsz1
#endif
#define ScrnMapr_DoMap UpdateBWLuminanceCopy #define ScrnMapr_DoMap UpdateBWLuminanceCopy
#define ScrnMapr_Src GetCurDrawBuff() #define ScrnMapr_Src GetCurDrawBuff()
@ -1704,8 +1698,6 @@ LOCALVAR uint8_t * CLUT_final;
#include "HW/SCREEN/SCRNMAPR.h" #include "HW/SCREEN/SCRNMAPR.h"
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
#define ScrnMapr_DoMap UpdateMappedColorCopy #define ScrnMapr_DoMap UpdateMappedColorCopy
#define ScrnMapr_Src GetCurDrawBuff() #define ScrnMapr_Src GetCurDrawBuff()
#define ScrnMapr_Dst ScalingBuff #define ScrnMapr_Dst ScalingBuff
@ -1715,10 +1707,6 @@ LOCALVAR uint8_t * CLUT_final;
#include "HW/SCREEN/SCRNMAPR.h" #include "HW/SCREEN/SCRNMAPR.h"
#endif
#if vMacScreenDepth >= 4
#define ScrnTrns_DoTrans UpdateTransColorCopy #define ScrnTrns_DoTrans UpdateTransColorCopy
#define ScrnTrns_Src GetCurDrawBuff() #define ScrnTrns_Src GetCurDrawBuff()
#define ScrnTrns_Dst ScalingBuff #define ScrnTrns_Dst ScalingBuff
@ -1728,18 +1716,13 @@ LOCALVAR uint8_t * CLUT_final;
#include "HW/SCREEN/SCRNTRNS.h" #include "HW/SCREEN/SCRNTRNS.h"
#endif
LOCALPROC UpdateLuminanceCopy(int16_t top, int16_t left, LOCALPROC UpdateLuminanceCopy(int16_t top, int16_t left,
int16_t bottom, int16_t right) int16_t bottom, int16_t right)
{ {
int i; int i;
#if 0 != vMacScreenDepth if (vMacScreenDepth > 0 && UseColorMode) {
if (UseColorMode) { if (vMacScreenDepth < 4) {
#if vMacScreenDepth < 4
if (! ColorTransValid) { if (! ColorTransValid) {
int j; int j;
int k; int k;
@ -1756,16 +1739,12 @@ LOCALPROC UpdateLuminanceCopy(int16_t top, int16_t left,
} }
ColorTransValid = true; ColorTransValid = true;
} }
UpdateMappedColorCopy(top, left, bottom, right); UpdateMappedColorCopy(top, left, bottom, right);
} else {
#else
UpdateTransColorCopy(top, left, bottom, right); UpdateTransColorCopy(top, left, bottom, right);
#endif }
} else } else {
#endif
{
if (! ColorTransValid) { if (! ColorTransValid) {
int k; int k;
uint8_t * p4 = (uint8_t *)CLUT_final; uint8_t * p4 = (uint8_t *)CLUT_final;
@ -1838,17 +1817,14 @@ LOCALPROC DrawWithOpenGL(uint16_t top, uint16_t left, uint16_t bottom, uint16_t
UpdateLuminanceCopy(top, left, bottom, right); UpdateLuminanceCopy(top, left, bottom, right);
glRasterPos2i(GLhOffset + left2, GLvOffset - top2); glRasterPos2i(GLhOffset + left2, GLvOffset - top2);
#if 0 != vMacScreenDepth if (vMacScreenDepth > 0 && UseColorMode) {
if (UseColorMode) {
glDrawPixels(right - left, glDrawPixels(right - left,
bottom - top, bottom - top,
GL_RGBA, GL_RGBA,
GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8,
ScalingBuff + (left + top * vMacScreenWidth) * 4 ScalingBuff + (left + top * vMacScreenWidth) * 4
); );
} else } else {
#endif
{
glDrawPixels(right - left, glDrawPixels(right - left,
bottom - top, bottom - top,
GL_LUMINANCE, GL_LUMINANCE,
@ -3224,9 +3200,7 @@ LOCALFUNC bool GetOpnGLCntxt(void)
AdjustGLforSize(NewWinRect.size.width, AdjustGLforSize(NewWinRect.size.width,
NewWinRect.size.height); NewWinRect.size.height);
#if 0 != vMacScreenDepth if (0 != vMacScreenDepth) { ColorModeWorks = true; }
ColorModeWorks = true;
#endif
} }
v = true; v = true;
@ -4231,13 +4205,9 @@ LOCALPROC CheckForSavedTasks(void)
#endif #endif
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (
(gBackgroundFlag && ! RunInBackground SpeedStopped || (gBackgroundFlag && ! RunInBackground)
#if EnableAutoSlow && 0 )) {
&& (QuietSubTicks >= 4092)
#endif
)))
{
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {
EnterSpeedStopped(); EnterSpeedStopped();
@ -4535,20 +4505,7 @@ label_retry:
} }
if (ExtraTimeNotOver()) { if (ExtraTimeNotOver()) {
#if 1 NSTimeInterval inTimeout = NextTickChangeTime - LatestTime;
#if 0 && EnableAutoSlow
if ((QuietSubTicks >= 16384)
&& (QuietTime >= 34)
&& ! WantNotAutoSlow)
{
TheUntil = [NSDate
dateWithTimeIntervalSinceReferenceDate:
(NextTickChangeTime + 0.50)];
} else
#endif
{
NSTimeInterval inTimeout =
NextTickChangeTime - LatestTime;
if (inTimeout > 0.0) { if (inTimeout > 0.0) {
struct timespec rqt; struct timespec rqt;
struct timespec rmt; struct timespec rmt;
@ -4558,22 +4515,10 @@ label_retry:
(void) nanosleep(&rqt, &rmt); (void) nanosleep(&rqt, &rmt);
} }
TheUntil = TheDistantPast; TheUntil = TheDistantPast;
}
#else
/*
This has higher overhead.
*/
TheUntil = TheNextTick;
#endif
goto label_retry; goto label_retry;
} }
#if 0
if (! gTrueBackgroundFlag) {
CheckMouseState();
}
#endif
if (CheckDateTime()) { if (CheckDateTime()) {
#if SoundEnabled #if SoundEnabled
Sound_SecondNotify(); Sound_SecondNotify();
@ -4831,11 +4776,11 @@ LOCALPROC ReserveAllocAll(void)
vMacScreenNumBytes, 5, false); vMacScreenNumBytes, 5, false);
#endif #endif
ReserveAllocOneBlock(&ScalingBuff, vMacScreenNumPixels ReserveAllocOneBlock(
#if 0 != vMacScreenDepth &ScalingBuff,
* 4 vMacScreenNumPixels * (vMacScreenDepth > 0) ? 4 : 1,
#endif 5, false
, 5, false); ;
ReserveAllocOneBlock(&CLUT_final, CLUT_finalsz, 5, false); ReserveAllocOneBlock(&CLUT_final, CLUT_finalsz, 5, false);
#if SoundEnabled #if SoundEnabled

View File

@ -891,9 +891,7 @@ LOCALPROC dbglog_close0(void)
#endif #endif
#if 1 /* (0 != vMacScreenDepth) && (vMacScreenDepth < 4) */
#define WantColorTransValid 1 #define WantColorTransValid 1
#endif
#include "UI/COMOSGLU.h" #include "UI/COMOSGLU.h"
@ -1252,16 +1250,12 @@ LOCALVAR uint8_t * CLUT_final;
#define CLUT_finalsz1 (256 * 8) #define CLUT_finalsz1 (256 * 8)
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
#define CLUT_finalClrSz (256 << (5 - vMacScreenDepth)) #define CLUT_finalClrSz (256 << (5 - vMacScreenDepth))
#define CLUT_finalsz ((CLUT_finalClrSz > CLUT_finalsz1) \ #define CLUT_finalsz ((CLUT_finalClrSz > CLUT_finalsz1) \
? CLUT_finalClrSz : CLUT_finalsz1) ? CLUT_finalClrSz : CLUT_finalsz1)
#else
#define CLUT_finalsz CLUT_finalsz1 #define CLUT_finalsz CLUT_finalsz1
#endif
#define ScrnMapr_DoMap UpdateBWLuminanceCopy #define ScrnMapr_DoMap UpdateBWLuminanceCopy
@ -1274,8 +1268,6 @@ LOCALVAR uint8_t * CLUT_final;
#include "HW/SCREEN/SCRNMAPR.h" #include "HW/SCREEN/SCRNMAPR.h"
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
#define ScrnMapr_DoMap UpdateMappedColorCopy #define ScrnMapr_DoMap UpdateMappedColorCopy
#define ScrnMapr_Src GetCurDrawBuff() #define ScrnMapr_Src GetCurDrawBuff()
#define ScrnMapr_Dst ScalingBuff #define ScrnMapr_Dst ScalingBuff
@ -1285,10 +1277,6 @@ LOCALVAR uint8_t * CLUT_final;
#include "HW/SCREEN/SCRNMAPR.h" #include "HW/SCREEN/SCRNMAPR.h"
#endif
#if vMacScreenDepth >= 4
#define ScrnTrns_DoTrans UpdateTransColorCopy #define ScrnTrns_DoTrans UpdateTransColorCopy
#define ScrnTrns_Src GetCurDrawBuff() #define ScrnTrns_Src GetCurDrawBuff()
#define ScrnTrns_Dst ScalingBuff #define ScrnTrns_Dst ScalingBuff
@ -1298,18 +1286,14 @@ LOCALVAR uint8_t * CLUT_final;
#include "HW/SCREEN/SCRNTRNS.h" #include "HW/SCREEN/SCRNTRNS.h"
#endif
LOCALPROC UpdateLuminanceCopy(int16_t top, int16_t left, LOCALPROC UpdateLuminanceCopy(int16_t top, int16_t left,
int16_t bottom, int16_t right) int16_t bottom, int16_t right)
{ {
int i; int i;
#if 0 != vMacScreenDepth if (vMacScreenDepth > 0 && UseColorMode) {
if (UseColorMode) {
#if vMacScreenDepth < 4
if (vMacScreenDepth < 4) {
if (! ColorTransValid) { if (! ColorTransValid) {
int j; int j;
int k; int k;
@ -1326,16 +1310,11 @@ LOCALPROC UpdateLuminanceCopy(int16_t top, int16_t left,
} }
ColorTransValid = true; ColorTransValid = true;
} }
UpdateMappedColorCopy(top, left, bottom, right); UpdateMappedColorCopy(top, left, bottom, right);
} else {
#else
UpdateTransColorCopy(top, left, bottom, right); UpdateTransColorCopy(top, left, bottom, right);
#endif }
} else {
} else
#endif
{
if (! ColorTransValid) { if (! ColorTransValid) {
int k; int k;
uint8_t * p4 = (uint8_t *)CLUT_final; uint8_t * p4 = (uint8_t *)CLUT_final;
@ -4737,11 +4716,7 @@ LOCALPROC CheckForSavedTasks(void)
#endif #endif
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gTrueBackgroundFlag && ! RunInBackground (gTrueBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {

View File

@ -178,22 +178,17 @@ EXPORTVAR(uint32_t, CurMacDelta)
#define vMacScreenMonoNumBytes (vMacScreenNumPixels / 8) #define vMacScreenMonoNumBytes (vMacScreenNumPixels / 8)
#define vMacScreenMonoByteWidth ((long)vMacScreenWidth / 8) #define vMacScreenMonoByteWidth ((long)vMacScreenWidth / 8)
#if 0 != vMacScreenDepth
EXPORTVAR(bool, UseColorMode) EXPORTVAR(bool, UseColorMode)
EXPORTVAR(bool, ColorModeWorks) EXPORTVAR(bool, ColorModeWorks)
#endif
#if 0 != vMacScreenDepth
EXPORTVAR(bool, ColorMappingChanged) EXPORTVAR(bool, ColorMappingChanged)
#endif
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4) //#define CLUT_size (1 << (1 << vMacScreenDepth))
#define CLUT_size (1 << (1 << vMacScreenDepth)) #define CLUT_size 256 // total guesstimate
EXPORTVAR(uint16_t, CLUT_reds[CLUT_size]) EXPORTVAR(uint16_t, CLUT_reds[CLUT_size])
EXPORTVAR(uint16_t, CLUT_greens[CLUT_size]) EXPORTVAR(uint16_t, CLUT_greens[CLUT_size])
EXPORTVAR(uint16_t, CLUT_blues[CLUT_size]) EXPORTVAR(uint16_t, CLUT_blues[CLUT_size])
#endif
EXPORTVAR(bool, EmVideoDisable) EXPORTVAR(bool, EmVideoDisable)
EXPORTVAR(int8_t, EmLagTime) EXPORTVAR(int8_t, EmLagTime)
@ -211,15 +206,12 @@ EXPORTOSGLUFUNC bool ExtraTimeNotOver(void);
EXPORTVAR(uint8_t, SpeedValue) EXPORTVAR(uint8_t, SpeedValue)
#if EnableAutoSlow
EXPORTVAR(bool, WantNotAutoSlow) EXPORTVAR(bool, WantNotAutoSlow)
#endif
/* where emulated machine thinks mouse is */ /* where emulated machine thinks mouse is */
EXPORTVAR(uint16_t, CurMouseV) EXPORTVAR(uint16_t, CurMouseV)
EXPORTVAR(uint16_t, CurMouseH) EXPORTVAR(uint16_t, CurMouseH)
#if EnableAutoSlow
EXPORTVAR(uint32_t, QuietTime) EXPORTVAR(uint32_t, QuietTime)
EXPORTVAR(uint32_t, QuietSubTicks) EXPORTVAR(uint32_t, QuietSubTicks)
@ -228,9 +220,6 @@ EXPORTVAR(uint32_t, QuietSubTicks)
QuietTime = 0; \ QuietTime = 0; \
QuietSubTicks = 0; \ QuietSubTicks = 0; \
} }
#else
#define QuietEnds()
#endif
#if 3 == kLn2SoundSampSz #if 3 == kLn2SoundSampSz
#define trSoundSamp uint8_t #define trSoundSamp uint8_t

View File

@ -5005,11 +5005,7 @@ LOCALPROC CheckForSavedTasks(void)
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gBackgroundFlag && ! RunInBackground (gBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {

View File

@ -1142,7 +1142,7 @@ LOCALPROC SetUpScalingTabl(void)
} }
#endif #endif
#if EnableMagnify && (0 != vMacScreenDepth) && (vMacScreenDepth < 4) //#if EnableMagnify && (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
LOCALPROC SetUpColorScalingTabl(void) LOCALPROC SetUpColorScalingTabl(void)
{ {
int i; int i;
@ -1165,9 +1165,8 @@ LOCALPROC SetUpColorScalingTabl(void)
} }
} }
} }
#endif
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4) //#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
LOCALPROC SetUpColorTabl(void) LOCALPROC SetUpColorTabl(void)
{ {
int i; int i;
@ -1185,9 +1184,8 @@ LOCALPROC SetUpColorTabl(void)
} }
} }
} }
#endif
#if EnableMagnify && UseColorImage //#if EnableMagnify && UseColorImage
LOCALPROC SetUpBW2ColorScalingTabl(void) LOCALPROC SetUpBW2ColorScalingTabl(void)
{ {
int i; int i;
@ -1211,9 +1209,8 @@ LOCALPROC SetUpBW2ColorScalingTabl(void)
} }
} }
} }
#endif
#if UseColorImage //#if UseColorImage
LOCALPROC SetUpBW2ColorTabl(void) LOCALPROC SetUpBW2ColorTabl(void)
{ {
int i; int i;
@ -1233,7 +1230,6 @@ LOCALPROC SetUpBW2ColorTabl(void)
} }
} }
} }
#endif
#if EnableMagnify && ! UseColorImage #if EnableMagnify && ! UseColorImage
@ -4133,11 +4129,7 @@ LOCALPROC CheckForSavedTasks(void)
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gBackgroundFlag && ! RunInBackground (gBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {

View File

@ -2783,15 +2783,8 @@ enum {
}; };
#if (1 == vMacScreenDepth) || (vMacScreenDepth >= 4)
#define EnableScalingBuff 1 #define EnableScalingBuff 1
#else
#define EnableScalingBuff (1 && EnableMagnify && (WindowScale == 2))
#endif
#if EnableScalingBuff
LOCALVAR uint8_t * ScalingBuff = NULL; LOCALVAR uint8_t * ScalingBuff = NULL;
#endif
LOCALVAR HDC MainWndDC = NULL; LOCALVAR HDC MainWndDC = NULL;
@ -3110,9 +3103,9 @@ LOCALFUNC bool ReCreateMainWindow(void)
TRUE); TRUE);
} }
#if 0 != vMacScreenDepth if (0 != vMacScreenDepth) {
ColorModeWorks = true; ColorModeWorks = true;
#endif }
{ {
POINT p; POINT p;
@ -3294,11 +3287,8 @@ LOCALFUNC bool AlreadyRunningCheck(void)
typedef struct BITMAPINFOHEADER256 { typedef struct BITMAPINFOHEADER256 {
BITMAPINFOHEADER bmi; BITMAPINFOHEADER bmi;
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
RGBQUAD colors[CLUT_size]; RGBQUAD colors[CLUT_size];
#else //RGBQUAD colors[2];
RGBQUAD colors[2];
#endif
} BITMAPINFOHEADER256; } BITMAPINFOHEADER256;
#if EnableMagnify #if EnableMagnify
@ -3377,52 +3367,50 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
} }
} }
#endif #endif
#if 0 != vMacScreenDepth if (vMacScreenDepth > 0 && UseColorMode) {
if (UseColorMode) {
int i; int i;
int nDestWidth = (right - left); int nDestWidth = (right - left);
int nDestHeight = (bottom - top); int nDestHeight = (bottom - top);
#if 1 == vMacScreenDepth uint8_t *p;
uint8_t *p if (vMacScreenDepth == 1) {
= ScalingBuff + ((uint32_t)vMacScreenWidth / 4) * top; p = ScalingBuff + ((uint32_t)vMacScreenWidth / 4) * top;
#elif vMacScreenDepth >= 4 } else if (vMacScreenDepth >= 4) {
uint8_t *p = ScalingBuff + (uint32_t)vMacScreenByteWidth * top; p = ScalingBuff + (uint32_t)vMacScreenByteWidth * top;
#else } else {
uint8_t *p = cdb + (uint32_t)vMacScreenByteWidth * top; p = cdb + (uint32_t)vMacScreenByteWidth * top;
#endif }
memset(&bmh, 0, sizeof (bmh)); memset(&bmh, 0, sizeof (bmh));
bmh.bmi.biSize = sizeof(BITMAPINFOHEADER); bmh.bmi.biSize = sizeof(BITMAPINFOHEADER);
bmh.bmi.biWidth = vMacScreenWidth; bmh.bmi.biWidth = vMacScreenWidth;
bmh.bmi.biHeight = - (bottom - top); bmh.bmi.biHeight = - (bottom - top);
bmh.bmi.biPlanes = 1; bmh.bmi.biPlanes = 1;
#if 1 == vMacScreenDepth if (1 == vMacScreenDepth) {
bmh.bmi.biBitCount = 4; bmh.bmi.biBitCount = 4;
#else } else {
bmh.bmi.biBitCount = (1 << vMacScreenDepth); bmh.bmi.biBitCount = (1 << vMacScreenDepth);
#endif }
bmh.bmi.biCompression= BI_RGB; bmh.bmi.biCompression= BI_RGB;
bmh.bmi.biSizeImage = 0; bmh.bmi.biSizeImage = 0;
bmh.bmi.biXPelsPerMeter = 0; bmh.bmi.biXPelsPerMeter = 0;
bmh.bmi.biYPelsPerMeter = 0; bmh.bmi.biYPelsPerMeter = 0;
#if 1 == vMacScreenDepth if (vMacScreenDepth == 1) {
bmh.bmi.biClrUsed = 4; bmh.bmi.biClrUsed = 4;
#else } else {
bmh.bmi.biClrUsed = 0; bmh.bmi.biClrUsed = 0;
#endif }
bmh.bmi.biClrImportant = 0; bmh.bmi.biClrImportant = 0;
#if vMacScreenDepth < 4 if (vMacScreenDepth < 4) {
for (i = 0; i < CLUT_size; ++i) { for (i = 0; i < CLUT_size; ++i) {
bmh.colors[i].rgbRed = CLUT_reds[i] >> 8; bmh.colors[i].rgbRed = CLUT_reds[i] >> 8;
bmh.colors[i].rgbGreen = CLUT_greens[i] >> 8; bmh.colors[i].rgbGreen = CLUT_greens[i] >> 8;
bmh.colors[i].rgbBlue = CLUT_blues[i] >> 8; bmh.colors[i].rgbBlue = CLUT_blues[i] >> 8;
bmh.colors[i].rgbReserved = 0; bmh.colors[i].rgbReserved = 0;
} }
#endif }
#if 1 == vMacScreenDepth if (1 == vMacScreenDepth) {
{
int j; int j;
uint8_t *p1 = (uint8_t *)(cdb + (uint32_t)vMacScreenByteWidth * top); uint8_t *p1 = (uint8_t *)(cdb + (uint32_t)vMacScreenByteWidth * top);
uint16_t *p2 = (uint16_t *)p; uint16_t *p2 = (uint16_t *)p;
@ -3436,9 +3424,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
| ((t0 & 0x03) << 8); | ((t0 & 0x03) << 8);
} }
} }
} } else if (4 == vMacScreenDepth) {
#elif 4 == vMacScreenDepth
{
int j; int j;
uint16_t *p1 = (uint16_t *)(cdb + (uint32_t)vMacScreenByteWidth * top); uint16_t *p1 = (uint16_t *)(cdb + (uint32_t)vMacScreenByteWidth * top);
uint16_t *p2 = (uint16_t *)p; uint16_t *p2 = (uint16_t *)p;
@ -3449,9 +3435,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
((t0 & 0xFF00) >> 8) | ((t0 & 0x00FF) << 8); ((t0 & 0xFF00) >> 8) | ((t0 & 0x00FF) << 8);
} }
} }
} } else if (5 == vMacScreenDepth) {
#elif 5 == vMacScreenDepth
{
int j; int j;
uint32_t *p1 = (uint32_t *)(cdb + (uint32_t)vMacScreenByteWidth * top); uint32_t *p1 = (uint32_t *)(cdb + (uint32_t)vMacScreenByteWidth * top);
uint32_t *p2 = (uint32_t *)p; uint32_t *p2 = (uint32_t *)p;
@ -3466,7 +3450,6 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
} }
} }
} }
#endif
#if EnableMagnify #if EnableMagnify
if (UseMagnify) { if (UseMagnify) {
@ -3496,9 +3479,7 @@ LOCALPROC HaveChangedScreenBuff(int16_t top, int16_t left,
) == 0) { ) == 0) {
/* ReportWinLastError(); */ /* ReportWinLastError(); */
} }
} else } else {
#endif
{
uint8_t *p = cdb + (uint32_t)vMacScreenMonoByteWidth * top; uint8_t *p = cdb + (uint32_t)vMacScreenMonoByteWidth * top;
memset(&bmh, 0, sizeof (bmh)); memset(&bmh, 0, sizeof (bmh));
@ -5369,11 +5350,7 @@ LOCALPROC CheckForSavedTasks(void)
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gBackgroundFlag && ! RunInBackground (gBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {
@ -5934,15 +5911,12 @@ LOCALPROC ReserveAllocAll(void)
* WindowScale * WindowScale * WindowScale * WindowScale
#endif #endif
; ;
#if 1 == vMacScreenDepth if ((vMacScreenDepth == 1) && (vMacScreenNumBytes * 2 > n)) {
if (vMacScreenNumBytes * 2 > n) {
n = vMacScreenNumBytes * 2; n = vMacScreenNumBytes * 2;
} }
#elif vMacScreenDepth >= 4 else if ((vMacScreenDepth >= 4) && (vMacScreenNumBytes > n)) {
if (vMacScreenNumBytes > n) {
n = vMacScreenNumBytes; n = vMacScreenNumBytes;
} }
#endif
ReserveAllocOneBlock(&ScalingBuff, n, 5, false); ReserveAllocOneBlock(&ScalingBuff, n, 5, false);
} }
#endif #endif

View File

@ -1160,11 +1160,7 @@ LOCALPROC CheckForSavedTasks(void)
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gBackgroundFlag && ! RunInBackground (gBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {

View File

@ -3857,11 +3857,7 @@ LOCALPROC CheckForSavedTasks(void)
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gBackgroundFlag && ! RunInBackground (gBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {

View File

@ -2015,11 +2015,7 @@ LOCALPROC CheckForSavedTasks(void)
} }
if (CurSpeedStopped != (SpeedStopped || if (CurSpeedStopped != (SpeedStopped ||
(gBackgroundFlag && ! RunInBackground (gBackgroundFlag && ! RunInBackground)))
#if EnableAutoSlow && 0
&& (QuietSubTicks >= 4092)
#endif
)))
{ {
CurSpeedStopped = ! CurSpeedStopped; CurSpeedStopped = ! CurSpeedStopped;
if (CurSpeedStopped) { if (CurSpeedStopped) {