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 IncludeSonyNameNew 1
#define vMacScreenHeight 342
#define vMacScreenWidth 512
#define vMacScreenDepth 0
#define kROM_Size 0x00020000
#define IncludePbufs 1
@ -38,7 +34,12 @@
#define EnableMouseMotion 1
#define IncludeHostTextClipExchange 1
#define EnableAutoSlow 1
#define EmLocalTalk 0
#define AutoLocation 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
RTC.PARAMRAM[1 + Group2Base] = prb_volClickLo;
RTC.PARAMRAM[2 + Group2Base] = prb_miscHi;
RTC.PARAMRAM[3 + Group2Base] = prb_miscLo
#if 0 != vMacScreenDepth
| 0x80
#endif
;
RTC.PARAMRAM[3 + Group2Base] = prb_miscLo \
| (vMacScreenDepth != 0) ? 0x80 : 0;
#if HaveXPRAM /* extended parameter ram initialized */
#if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx)
@ -231,14 +228,14 @@ GLOBALFUNC bool RTC_Init(void)
RTC.PARAMRAM[0x46] = /* 0x42 */ 0x76; /* 'v' */
RTC.PARAMRAM[0x47] = /* 0x32 */ 0x4D; /* 'M' */
/* mode */
#if (0 == vMacScreenDepth) || (vMacScreenDepth >= 4)
if ((0 == vMacScreenDepth) || (vMacScreenDepth >= 4)) {
RTC.PARAMRAM[0x48] = 0x80;
#else
} else {
RTC.PARAMRAM[0x48] = 0x81;
/* 0x81 doesn't quite work right at boot */
/* no, it seems to work now (?) */
/* but only if depth <= 3 */
#endif
}
#endif
#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_OneBitMode;
uint8_t * pTo_OneVidParams;
#if 0 != vMacScreenDepth
uint8_t * pTo_ColorBitMode = nullpr;
uint8_t * pTo_ColorVidParams;
#endif
pPatch = VidROM;
@ -263,11 +261,9 @@ GLOBALFUNC bool Vid_Init(void)
pTo_MajorLength = ReservePatchOSLstEntry();
#endif
pTo_OneBitMode = ReservePatchOSLstEntry();
#if 0 != vMacScreenDepth
if (ColorModeWorks) {
if ((vMacScreenDepth != 0) && ColorModeWorks) {
pTo_ColorBitMode = ReservePatchOSLstEntry();
}
#endif
PatchAnEndOfLst();
PatchAReservedOSLstEntry(pTo_VideoType, 0x01 /* sRsrcType */);
@ -344,8 +340,7 @@ GLOBALFUNC bool Vid_Init(void)
PatchAWord(0x0001); /* bmCmpSize */
PatchALong(0x00000000); /* bmPlaneBytes */
#if 0 != vMacScreenDepth
if (ColorModeWorks) {
if ((vMacScreenDepth != 0) && ColorModeWorks) {
PatchAReservedOSLstEntry(pTo_ColorBitMode, 0x81);
pTo_ColorVidParams = ReservePatchOSLstEntry();
@ -373,21 +368,20 @@ GLOBALFUNC bool Vid_Init(void)
PatchAWord(1 << vMacScreenDepth); /* bmPixelSize */
PatchAWord((vMacScreenDepth < 4) ? 0x0001 : 0x0003);
/* bmCmpCount */
#if 4 == vMacScreenDepth
if (4 == vMacScreenDepth) {
PatchAWord(0x0005); /* bmCmpSize */
#elif 5 == vMacScreenDepth
} else if (5 == vMacScreenDepth) {
PatchAWord(0x0008); /* bmCmpSize */
#else
} else {
PatchAWord(1 << vMacScreenDepth); /* bmCmpSize */
#endif
}
PatchALong(0x00000000); /* bmPlaneBytes */
}
#endif
UsedSoFar = (pPatch - VidROM) + 20;
if (UsedSoFar > kVidROM_Size) {
ReportAbnormalID(0x0A01, "kVidROM_Size to small");
ReportAbnormalID(0x0A01, "kVidROM_Size too small");
return false;
}
@ -407,14 +401,14 @@ GLOBALFUNC bool Vid_Init(void)
ChecksumSlotROM();
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
if ((0 != vMacScreenDepth) && (vMacScreenDepth < 4)) {
CLUT_reds[0] = 0xFFFF;
CLUT_greens[0] = 0xFFFF;
CLUT_blues[0] = 0xFFFF;
CLUT_reds[CLUT_size - 1] = 0;
CLUT_greens[CLUT_size - 1] = 0;
CLUT_blues[CLUT_size - 1] = 0;
#endif
}
return true;
}
@ -431,31 +425,27 @@ GLOBALPROC Vid_Update(void)
LOCALFUNC uint16_t Vid_GetMode(void)
{
return
#if 0 != vMacScreenDepth
UseColorMode ? 129 :
#endif
128;
return (UseColorMode && (vMacScreenDepth != 0)) ? 129 : 128;
}
LOCALFUNC tMacErr Vid_SetMode(uint16_t v)
{
#if 0 == vMacScreenDepth
UnusedParam(v);
#else
if (UseColorMode != ((v != 128) && ColorModeWorks)) {
if (
(vMacScreenDepth == 0)
&& UseColorMode != ((v != 128)
&& ColorModeWorks)
) {
UseColorMode = ! UseColorMode;
ColorMappingChanged = true;
}
#endif
return mnvm_noErr;
}
GLOBALFUNC uint16_t Vid_Reset(void)
{
#if 0 != vMacScreenDepth
if (0 != vMacScreenDepth) {
UseColorMode = false;
#endif
}
return 128;
}
@ -491,37 +481,30 @@ LOCALPROC FillScreenWithGrayPattern(void)
int j;
uint32_t *p1 = (uint32_t *)VidMem;
#if 0 != vMacScreenDepth
if (UseColorMode) {
#if 1 == vMacScreenDepth
uint32_t pat = 0xCCCCCCCC;
#elif 2 == vMacScreenDepth
uint32_t pat = 0xF0F0F0F0;
#elif 3 == vMacScreenDepth
uint32_t pat = 0xFF00FF00;
#elif 4 == vMacScreenDepth
uint32_t pat = 0x00007FFF;
#elif 5 == vMacScreenDepth
uint32_t pat = 0x00000000;
#endif
if (vMacScreenDepth > 0 && UseColorMode) {
uint32_t pat;
switch (vMacScreenDepth) {
case 1: pat = 0xCCCCCCCC; break;
case 2: pat = 0xF0F0F0F0; break;
case 3: pat = 0xFF00FF00; break;
case 4: pat = 0x00007FFF; break;
default:
case 5: pat = 0x00000000; break;
}
for (i = vMacScreenHeight; --i >= 0; ) {
for (j = vMacScreenByteWidth >> 2; --j >= 0; ) {
*p1++ = pat;
#if 5 == vMacScreenDepth
if (vMacScreenDepth == 5) {
pat = (~ pat) & 0x00FFFFFF;
#endif
}
pat = (~ pat)
#if 4 == vMacScreenDepth
& 0x7FFF7FFF
#elif 5 == vMacScreenDepth
& 0x00FFFFFF
#endif
;
}
} else
#endif
{
if (vMacScreenDepth == 4) {
pat = (~ pat) & 0x7FFF7FFF;
} else if (vMacScreenDepth == 5) {
pat = (~ pat) & 0x00FFFFFF;
}
}
} else {
uint32_t pat = 0xAAAAAAAA;
for (i = vMacScreenHeight; --i >= 0; ) {
@ -624,8 +607,7 @@ GLOBALPROC ExtnVideo_Access(CPTR p)
"Video_Access kCmndVideoControl, "
"SetEntries");
#endif
#if (0 != vMacScreenDepth) && (vMacScreenDepth < 4)
if (UseColorMode) {
if ((0 != vMacScreenDepth) && (vMacScreenDepth < 4) && UseColorMode) {
CPTR csTable = get_vm_long(
csParam + VDSetEntryRecord_csTable);
uint16_t csStart = get_vm_word(
@ -699,9 +681,7 @@ GLOBALPROC ExtnVideo_Access(CPTR p)
ColorMappingChanged = true;
result = mnvm_noErr;
}
} else
#endif
{
} else {
/* not implemented */
}
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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