mirror of
https://github.com/autc04/Retro68.git
synced 2026-04-22 00:17:31 +00:00
Switch tab-indented files to 4-space indent
This commit is contained in:
@@ -25,10 +25,10 @@
|
||||
# Build the code resource as a regular executable
|
||||
# (not using the add_application macro)
|
||||
add_executable(SystemExtension
|
||||
SystemExtension.c
|
||||
ShowInitIcon.c
|
||||
SystemExtension.r
|
||||
ShowInitIcon.h)
|
||||
SystemExtension.c
|
||||
ShowInitIcon.c
|
||||
SystemExtension.r
|
||||
ShowInitIcon.h)
|
||||
|
||||
if(TARGET retrocrt)
|
||||
# Hack: if we are building as part of the Retro68 source tree,
|
||||
@@ -40,23 +40,23 @@ endif(TARGET retrocrt)
|
||||
|
||||
|
||||
set_target_properties(SystemExtension PROPERTIES
|
||||
OUTPUT_NAME SystemExtension.flt
|
||||
|
||||
# set a linker flag that says we want a flat piece
|
||||
# of code in a data file
|
||||
LINK_FLAGS -Wl,--mac-flat)
|
||||
OUTPUT_NAME SystemExtension.flt
|
||||
|
||||
# set a linker flag that says we want a flat piece
|
||||
# of code in a data file
|
||||
LINK_FLAGS -Wl,--mac-flat)
|
||||
|
||||
# Use Rez to put it together
|
||||
# Use Rez to put it together
|
||||
add_custom_command(
|
||||
OUTPUT SystemExtension.bin SystemExtension.dsk
|
||||
COMMAND ${REZ} -I ${REZ_INCLUDE_PATH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SystemExtension.r
|
||||
--copy ${CMAKE_CURRENT_SOURCE_DIR}/Icons.rsrc.bin
|
||||
-o SystemExtension.bin
|
||||
--cc SystemExtension.dsk
|
||||
--cc SystemExtension
|
||||
-t INIT
|
||||
DEPENDS SystemExtension SystemExtension.r Icons.rsrc.bin)
|
||||
OUTPUT SystemExtension.bin SystemExtension.dsk
|
||||
COMMAND ${REZ} -I ${REZ_INCLUDE_PATH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SystemExtension.r
|
||||
--copy ${CMAKE_CURRENT_SOURCE_DIR}/Icons.rsrc.bin
|
||||
-o SystemExtension.bin
|
||||
--cc SystemExtension.dsk
|
||||
--cc SystemExtension
|
||||
-t INIT
|
||||
DEPENDS SystemExtension SystemExtension.r Icons.rsrc.bin)
|
||||
|
||||
|
||||
add_custom_target(SystemExtension_INIT ALL DEPENDS SystemExtension.dsk)
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
// The MPW C compiler doesn't accept variables declared at an absolute address, so I use these macros instead.
|
||||
// Only one macro is defined per variable; there is no need to define a Set and a Get accessor like in <LowMem.h>.
|
||||
|
||||
#define LMVCheckSum (* (unsigned short*) 0x928)
|
||||
#define LMVCoord (* ( short*) 0x92A)
|
||||
#define LMHCoord (* ( short*) 0x92C)
|
||||
#define LMHCheckSum (* (unsigned short*) 0x92E)
|
||||
#define LMVCheckSum (* (unsigned short*) 0x928)
|
||||
#define LMVCoord (* ( short*) 0x92A)
|
||||
#define LMHCoord (* ( short*) 0x92C)
|
||||
#define LMHCheckSum (* (unsigned short*) 0x92E)
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
// Prototypes for the subroutines. The main routine comes first; this is necessary to make THINK C's "Custom Header" option work.
|
||||
@@ -50,41 +50,41 @@ static void DrawBWIcon (short iconID, Rect *iconRect);
|
||||
// Main routine.
|
||||
|
||||
typedef struct {
|
||||
QDGlobals qd; // Storage for the QuickDraw globals
|
||||
long qdGlobalsPtr; // A5 points to this place; it will contain a pointer to qd
|
||||
QDGlobals qd; // Storage for the QuickDraw globals
|
||||
long qdGlobalsPtr; // A5 points to this place; it will contain a pointer to qd
|
||||
} QDStorage;
|
||||
|
||||
pascal void ShowInitIcon (short iconFamilyID, Boolean advance)
|
||||
{
|
||||
long oldA5; // Original value of register A5
|
||||
QDStorage qds; // Fake QD globals
|
||||
CGrafPort colorPort;
|
||||
GrafPort bwPort;
|
||||
Rect destRect;
|
||||
SysEnvRec environment; // Machine configuration.
|
||||
|
||||
oldA5 = SetA5((long) &qds.qdGlobalsPtr); // Tell A5 to point to the end of the fake QD Globals
|
||||
InitGraf(&qds.qd.thePort); // Initialize the fake QD Globals
|
||||
|
||||
SysEnvirons(curSysEnvVers, &environment); // Find out what kind of machine this is
|
||||
long oldA5; // Original value of register A5
|
||||
QDStorage qds; // Fake QD globals
|
||||
CGrafPort colorPort;
|
||||
GrafPort bwPort;
|
||||
Rect destRect;
|
||||
SysEnvRec environment; // Machine configuration.
|
||||
|
||||
oldA5 = SetA5((long) &qds.qdGlobalsPtr); // Tell A5 to point to the end of the fake QD Globals
|
||||
InitGraf(&qds.qd.thePort); // Initialize the fake QD Globals
|
||||
|
||||
SysEnvirons(curSysEnvVers, &environment); // Find out what kind of machine this is
|
||||
|
||||
ComputeIconRect(&destRect, &qds.qd.screenBits.bounds); // Compute where the icon should be drawn
|
||||
ComputeIconRect(&destRect, &qds.qd.screenBits.bounds); // Compute where the icon should be drawn
|
||||
|
||||
if (environment.systemVersion >= 0x0700 && environment.hasColorQD) {
|
||||
OpenCPort(&colorPort);
|
||||
PlotIconID(&destRect, atNone, ttNone, iconFamilyID);
|
||||
CloseCPort(&colorPort);
|
||||
}
|
||||
else {
|
||||
OpenPort(&bwPort);
|
||||
DrawBWIcon(iconFamilyID, &destRect);
|
||||
ClosePort(&bwPort);
|
||||
}
|
||||
|
||||
if (advance)
|
||||
AdvanceIconPosition (&destRect);
|
||||
|
||||
SetA5(oldA5); // Restore A5 to its previous value
|
||||
if (environment.systemVersion >= 0x0700 && environment.hasColorQD) {
|
||||
OpenCPort(&colorPort);
|
||||
PlotIconID(&destRect, atNone, ttNone, iconFamilyID);
|
||||
CloseCPort(&colorPort);
|
||||
}
|
||||
else {
|
||||
OpenPort(&bwPort);
|
||||
DrawBWIcon(iconFamilyID, &destRect);
|
||||
ClosePort(&bwPort);
|
||||
}
|
||||
|
||||
if (advance)
|
||||
AdvanceIconPosition (&destRect);
|
||||
|
||||
SetA5(oldA5); // Restore A5 to its previous value
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
@@ -92,7 +92,7 @@ pascal void ShowInitIcon (short iconFamilyID, Boolean advance)
|
||||
|
||||
static unsigned short CheckSum (short x)
|
||||
{
|
||||
return (unsigned short)(((x << 1) | (x >> 15)) ^ 0x1021);
|
||||
return (unsigned short)(((x << 1) | (x >> 15)) ^ 0x1021);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
@@ -100,56 +100,56 @@ static unsigned short CheckSum (short x)
|
||||
|
||||
static void ComputeIconRect (Rect* iconRect, Rect* screenBounds)
|
||||
{
|
||||
if (CheckSum(LMHCoord) != LMHCheckSum) // If we are first, we need to initialize the shared data.
|
||||
LMHCoord = 8;
|
||||
if (CheckSum(LMVCoord) != LMVCheckSum)
|
||||
LMVCoord = (short)(screenBounds->bottom - 40);
|
||||
|
||||
if (LMHCoord + 34 > screenBounds->right) { // Check whether we must wrap
|
||||
iconRect->left = 8;
|
||||
iconRect->top = (short)(LMVCoord - 40);
|
||||
}
|
||||
else {
|
||||
iconRect->left = LMHCoord;
|
||||
iconRect->top = LMVCoord;
|
||||
}
|
||||
iconRect->right = (short)(iconRect->left + 32);
|
||||
iconRect->bottom = (short)(iconRect->top + 32);
|
||||
if (CheckSum(LMHCoord) != LMHCheckSum) // If we are first, we need to initialize the shared data.
|
||||
LMHCoord = 8;
|
||||
if (CheckSum(LMVCoord) != LMVCheckSum)
|
||||
LMVCoord = (short)(screenBounds->bottom - 40);
|
||||
|
||||
if (LMHCoord + 34 > screenBounds->right) { // Check whether we must wrap
|
||||
iconRect->left = 8;
|
||||
iconRect->top = (short)(LMVCoord - 40);
|
||||
}
|
||||
else {
|
||||
iconRect->left = LMHCoord;
|
||||
iconRect->top = LMVCoord;
|
||||
}
|
||||
iconRect->right = (short)(iconRect->left + 32);
|
||||
iconRect->bottom = (short)(iconRect->top + 32);
|
||||
}
|
||||
|
||||
// AdvanceIconPosition updates the shared global variables so that the next extension will draw its icon beside ours.
|
||||
|
||||
static void AdvanceIconPosition (Rect* iconRect)
|
||||
{
|
||||
LMHCoord = (short)(iconRect->left + 40); // Update the shared data
|
||||
LMVCoord = iconRect->top;
|
||||
LMHCheckSum = CheckSum(LMHCoord);
|
||||
LMVCheckSum = CheckSum(LMVCoord);
|
||||
LMHCoord = (short)(iconRect->left + 40); // Update the shared data
|
||||
LMVCoord = iconRect->top;
|
||||
LMHCheckSum = CheckSum(LMHCoord);
|
||||
LMVCheckSum = CheckSum(LMVCoord);
|
||||
}
|
||||
|
||||
// DrawBWIcon draws the 'ICN#' member of the icon family. It works under System 6.
|
||||
|
||||
static void DrawBWIcon (short iconID, Rect *iconRect)
|
||||
{
|
||||
Handle icon;
|
||||
BitMap source, destination;
|
||||
GrafPtr port;
|
||||
|
||||
icon = Get1Resource('ICN#', iconID);
|
||||
if (icon != NULL) {
|
||||
HLock(icon);
|
||||
// Prepare the source and destination bitmaps.
|
||||
source.baseAddr = *icon + 128; // Mask address.
|
||||
source.rowBytes = 4;
|
||||
SetRect(&source.bounds, 0, 0, 32, 32);
|
||||
GetPort(&port);
|
||||
destination = port->portBits;
|
||||
// Transfer the mask.
|
||||
CopyBits(&source, &destination, &source.bounds, iconRect, srcBic, nil);
|
||||
// Then the icon.
|
||||
source.baseAddr = *icon;
|
||||
CopyBits(&source, &destination, &source.bounds, iconRect, srcOr, nil);
|
||||
}
|
||||
Handle icon;
|
||||
BitMap source, destination;
|
||||
GrafPtr port;
|
||||
|
||||
icon = Get1Resource('ICN#', iconID);
|
||||
if (icon != NULL) {
|
||||
HLock(icon);
|
||||
// Prepare the source and destination bitmaps.
|
||||
source.baseAddr = *icon + 128; // Mask address.
|
||||
source.rowBytes = 4;
|
||||
SetRect(&source.bounds, 0, 0, 32, 32);
|
||||
GetPort(&port);
|
||||
destination = port->portBits;
|
||||
// Transfer the mask.
|
||||
CopyBits(&source, &destination, &source.bounds, iconRect, srcBic, nil);
|
||||
// Then the icon.
|
||||
source.baseAddr = *icon;
|
||||
CopyBits(&source, &destination, &source.bounds, iconRect, srcOr, nil);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
void _start()
|
||||
{
|
||||
RETRO68_RELOCATE();
|
||||
Retro68CallConstructors();
|
||||
RETRO68_RELOCATE();
|
||||
Retro68CallConstructors();
|
||||
|
||||
ShowInitIcon(130, false);
|
||||
Delay(20, NULL);
|
||||
ShowInitIcon(128, true);
|
||||
Delay(40, NULL);
|
||||
ShowInitIcon(130, false);
|
||||
Delay(20, NULL);
|
||||
ShowInitIcon(128, true);
|
||||
Delay(40, NULL);
|
||||
|
||||
Retro68FreeGlobals();
|
||||
Retro68FreeGlobals();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user