mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
More Android stub-outs and bug fixes. Fix broken SDL fiber sync.
This commit is contained in:
88
GpApp/Android.mk
Normal file
88
GpApp/Android.mk
Normal file
@@ -0,0 +1,88 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := GpApp
|
||||
|
||||
SDL_PATH := ../SDL2
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/../GpCommon \
|
||||
$(LOCAL_PATH)/../Common \
|
||||
$(LOCAL_PATH)/../PortabilityLayer
|
||||
|
||||
LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
|
||||
|
||||
# Add your application source files here...
|
||||
LOCAL_SRC_FILES := \
|
||||
About.cpp \
|
||||
AnimCursor.cpp \
|
||||
AppleEvents.cpp \
|
||||
Banner.cpp \
|
||||
ColorUtils.cpp \
|
||||
Coordinates.cpp \
|
||||
DialogUtils.cpp \
|
||||
DynamicMaps.cpp \
|
||||
Dynamics.cpp \
|
||||
Dynamics2.cpp \
|
||||
Dynamics3.cpp \
|
||||
Environ.cpp \
|
||||
Events.cpp \
|
||||
FileError.cpp \
|
||||
GameOver.cpp \
|
||||
GpAppInterface.cpp \
|
||||
Grease.cpp \
|
||||
HighScores.cpp \
|
||||
House.cpp \
|
||||
HouseInfo.cpp \
|
||||
HouseIO.cpp \
|
||||
HouseLegal.cpp \
|
||||
Input.cpp \
|
||||
Interactions.cpp \
|
||||
InterfaceInit.cpp \
|
||||
Link.cpp \
|
||||
Main.cpp \
|
||||
MainWindow.cpp \
|
||||
Map.cpp \
|
||||
Marquee.cpp \
|
||||
Menu.cpp \
|
||||
Modes.cpp \
|
||||
Music.cpp \
|
||||
ObjectAdd.cpp \
|
||||
ObjectDraw.cpp \
|
||||
ObjectDraw2.cpp \
|
||||
ObjectDrawAll.cpp \
|
||||
ObjectEdit.cpp \
|
||||
ObjectInfo.cpp \
|
||||
ObjectRects.cpp \
|
||||
Objects.cpp \
|
||||
Play.cpp \
|
||||
Player.cpp \
|
||||
Prefs.cpp \
|
||||
RectUtils.cpp \
|
||||
Render.cpp \
|
||||
Room.cpp \
|
||||
RoomGraphics.cpp \
|
||||
RoomInfo.cpp \
|
||||
RubberBands.cpp \
|
||||
SavedGames.cpp \
|
||||
Scoreboard.cpp \
|
||||
Scrap.cpp \
|
||||
SelectHouse.cpp \
|
||||
Settings.cpp \
|
||||
Sound.cpp \
|
||||
SoundSync_Cpp11.cpp \
|
||||
StringUtils.cpp \
|
||||
StructuresInit.cpp \
|
||||
StructuresInit2.cpp \
|
||||
Tools.cpp \
|
||||
Transit.cpp \
|
||||
Transitions.cpp \
|
||||
Triggers.cpp \
|
||||
Trip.cpp \
|
||||
Utilities.cpp \
|
||||
WindowUtils.cpp
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := PortabilityLayer
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -233,7 +233,7 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
|
||||
short i, j;
|
||||
IGpCursor *hwCursor;
|
||||
Boolean result = true;
|
||||
|
||||
|
||||
if (ballCursH)
|
||||
{
|
||||
j = (*ballCursH)->n; // Get the number of cursors
|
||||
@@ -266,8 +266,8 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
|
||||
void InitAnimatedCursor (acurHandle ballCursH)
|
||||
{
|
||||
compiledAcurHandle compiledBallCursorH;
|
||||
|
||||
if (ballCursH == nil)
|
||||
|
||||
if (ballCursH == nil)
|
||||
ballCursH = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('acur', 128).StaticCast<acurRec>();
|
||||
if (ballCursH && ballCursH != animCursorH)
|
||||
{
|
||||
@@ -288,7 +288,7 @@ void InitAnimatedCursor (acurHandle ballCursH)
|
||||
|
||||
//-------------------------------------------------------------- LoadCursors
|
||||
|
||||
// Just calls the above function. Other code could be added here though<EFBFBD>
|
||||
// Just calls the above function. Other code could be added here though?
|
||||
// to add additional cursors.
|
||||
|
||||
void LoadCursors (void)
|
||||
@@ -302,8 +302,8 @@ void LoadCursors (void)
|
||||
|
||||
void DisposCursors (void)
|
||||
{
|
||||
register short i, j;
|
||||
|
||||
short i, j;
|
||||
|
||||
if (compiledAnimCursorH != nil)
|
||||
{
|
||||
j = (*animCursorH)->n;
|
||||
@@ -372,7 +372,7 @@ void SpinCursor (short incrementIndex)
|
||||
{
|
||||
UInt32 dummyLong;
|
||||
short i;
|
||||
|
||||
|
||||
for (i = 0; i < incrementIndex; i++)
|
||||
{
|
||||
IncrementCursor();
|
||||
@@ -388,7 +388,7 @@ void BackSpinCursor (short decrementIndex)
|
||||
{
|
||||
UInt32 dummyLong;
|
||||
short i;
|
||||
|
||||
|
||||
for (i = 0; i < decrementIndex; i++)
|
||||
{
|
||||
DecrementCursor();
|
||||
|
||||
@@ -76,7 +76,7 @@ short GetThisVolumeRefNum (void)
|
||||
{
|
||||
PLError_t theErr;
|
||||
short vRef;
|
||||
|
||||
|
||||
theErr = GetVol(nil, &vRef);
|
||||
return (vRef);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ short GetThisVolumeRefNum (void)
|
||||
long GetThisCurrentDirectoryID (void)
|
||||
{
|
||||
long dirID;
|
||||
|
||||
|
||||
dirID = LMGetCurDirStore();
|
||||
return (dirID);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ Boolean DoWeHaveGestalt (void)
|
||||
return (TrapExists(kGestaltTrap));
|
||||
}
|
||||
*/
|
||||
//-------------------------------------------------------------- DoWeHaveWNE
|
||||
//-------------------------------------------------------------- DoWeHaveWNE
|
||||
|
||||
// Specifically tests for the availablity of the WaitNextEvent() trap.
|
||||
/*
|
||||
@@ -119,25 +119,25 @@ Boolean DoWeHaveWNE (void)
|
||||
return (TrapExists(kWNETrap));
|
||||
}
|
||||
*/
|
||||
//-------------------------------------------------------------- DoWeHaveColor
|
||||
//-------------------------------------------------------------- DoWeHaveColor
|
||||
// Determines if ROMs support Color QuickDraw (monitor not neccessarily color).
|
||||
/*
|
||||
Boolean DoWeHaveColor (void)
|
||||
{
|
||||
SysEnvRec thisWorld;
|
||||
|
||||
|
||||
SysEnvirons(2, &thisWorld);
|
||||
return (thisWorld.hasColorQD);
|
||||
}
|
||||
*/
|
||||
//-------------------------------------------------------------- DoWeHaveSystem602
|
||||
//-------------------------------------------------------------- DoWeHaveSystem602
|
||||
// Determines if the System version is at least 6.0.2 or more recent.
|
||||
/*
|
||||
Boolean DoWeHaveSystem602 (void)
|
||||
{
|
||||
SysEnvRec thisWorld;
|
||||
Boolean haveIt;
|
||||
|
||||
|
||||
SysEnvirons(2, &thisWorld);
|
||||
if (thisWorld.systemVersion >= 0x0602)
|
||||
haveIt = true;
|
||||
@@ -146,14 +146,14 @@ Boolean DoWeHaveSystem602 (void)
|
||||
return (haveIt);
|
||||
}
|
||||
*/
|
||||
//-------------------------------------------------------------- DoWeHaveSystem605
|
||||
//-------------------------------------------------------------- DoWeHaveSystem605
|
||||
// Determines if the System version is at least 6.0.5 or more recent.
|
||||
/*
|
||||
Boolean DoWeHaveSystem605 (void)
|
||||
{
|
||||
SysEnvRec thisWorld;
|
||||
Boolean haveIt;
|
||||
|
||||
|
||||
SysEnvirons(2, &thisWorld);
|
||||
if (thisWorld.systemVersion >= 0x0605)
|
||||
haveIt = true;
|
||||
@@ -161,16 +161,16 @@ Boolean DoWeHaveSystem605 (void)
|
||||
haveIt = false;
|
||||
return (haveIt);
|
||||
}
|
||||
/
|
||||
//-------------------------------------------------------------- DoWeHaveSystem7
|
||||
*/
|
||||
//-------------------------------------------------------------- DoWeHaveSystem7
|
||||
|
||||
// Determines if the System version is at least 7.0.0 or more recent.
|
||||
|
||||
/*
|
||||
Boolean DoWeHaveSystem7 (void)
|
||||
{
|
||||
SysEnvRec thisWorld;
|
||||
Boolean haveIt;
|
||||
|
||||
|
||||
SysEnvirons(2, &thisWorld);
|
||||
if (thisWorld.systemVersion >= 0x0700)
|
||||
haveIt = true;
|
||||
@@ -178,7 +178,7 @@ Boolean DoWeHaveSystem7 (void)
|
||||
haveIt = false;
|
||||
return (haveIt);
|
||||
}
|
||||
|
||||
*/
|
||||
//-------------------------------------------------------------- DoWeHaveSoundManager3
|
||||
// Determines if the Sound Manager version is at least 3.0.0 or more recent.
|
||||
/*
|
||||
@@ -186,12 +186,12 @@ Boolean DoWeHaveSoundManager3 (void)
|
||||
{
|
||||
// NumVersion version;
|
||||
Boolean hasIt;
|
||||
|
||||
|
||||
hasIt = true;
|
||||
|
||||
|
||||
version = SndSoundManagerVersion();
|
||||
hasIt = (version.majorRev >= 3);
|
||||
|
||||
|
||||
return hasIt;
|
||||
}
|
||||
*/
|
||||
@@ -213,35 +213,35 @@ void SwitchToDepth (short, Boolean)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CanWeDisplay4Bit
|
||||
//-------------------------------------------------------------- CanWeDisplay4Bit
|
||||
// Determines if device (monitor) capable of supporting 4 bit (16 colors/grays).
|
||||
/*
|
||||
Boolean CanWeDisplay4Bit (GDHandle theDevice)
|
||||
{
|
||||
short canDepth;
|
||||
Boolean canDo;
|
||||
|
||||
|
||||
canDo = false;
|
||||
canDepth = HasDepth(theDevice, 4, 1, 0);
|
||||
if (canDepth != 0)
|
||||
canDo = true;
|
||||
|
||||
|
||||
return (canDo);
|
||||
}
|
||||
*/
|
||||
//-------------------------------------------------------------- CanWeDisplay1Bit
|
||||
//-------------------------------------------------------------- CanWeDisplay1Bit
|
||||
// Determines if device (monitor) capable of supporting 1 bit (black & white).
|
||||
/*
|
||||
Boolean CanWeDisplay1Bit (GDHandle theDevice)
|
||||
{
|
||||
short canDepth;
|
||||
Boolean canDo;
|
||||
|
||||
|
||||
canDo = false;
|
||||
canDepth = HasDepth(theDevice, 1, 1, 0);
|
||||
if (canDepth != 0)
|
||||
canDo = true;
|
||||
|
||||
|
||||
return (canDo);
|
||||
}
|
||||
*/
|
||||
@@ -278,12 +278,12 @@ void FlushResolutionChange(void)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CheckOurEnvirons
|
||||
// Calls all the above functions in order to fill out a sort of "spec sheet"<22>
|
||||
//-------------------------------------------------------------- CheckOurEnvirons
|
||||
// Calls all the above functions in order to fill out a sort of "spec sheet"<22>
|
||||
// for the current Mac.
|
||||
|
||||
void CheckOurEnvirons (void)
|
||||
{
|
||||
{
|
||||
thisMac.vRefNum = 0; // TEMP
|
||||
thisMac.dirID = 0; // TEMP
|
||||
thisMac.hasGestalt = true; // TEMP
|
||||
@@ -294,7 +294,7 @@ void CheckOurEnvirons (void)
|
||||
thisMac.hasSM3 = true; // TEMP
|
||||
thisMac.hasQT = DoWeHaveQuickTime();
|
||||
thisMac.hasDrag = DoWeHaveDragManager();
|
||||
|
||||
|
||||
thisMac.can1Bit = true;
|
||||
thisMac.can4Bit = true;
|
||||
thisMac.can8Bit = true;
|
||||
@@ -368,13 +368,13 @@ void InstallResolutionHandler(void)
|
||||
void ReflectSecondMonitorEnvirons (Boolean use1Bit, Boolean use4Bit, Boolean use8Bit)
|
||||
{
|
||||
GDHandle tempGDevice;
|
||||
|
||||
|
||||
tempGDevice = GetDeviceList();
|
||||
while (tempGDevice != nil)
|
||||
{
|
||||
if (TestDeviceAttribute(tempGDevice, screenDevice))
|
||||
if ((use1Bit && CanWeDisplay1Bit(tempGDevice)) ||
|
||||
(use4Bit && CanWeDisplay4Bit(tempGDevice)) ||
|
||||
if ((use1Bit && CanWeDisplay1Bit(tempGDevice)) ||
|
||||
(use4Bit && CanWeDisplay4Bit(tempGDevice)) ||
|
||||
(use8Bit && CanWeDisplay8Bit(tempGDevice)))
|
||||
if (!TestDeviceAttribute(tempGDevice, mainScreen))
|
||||
{
|
||||
@@ -418,8 +418,8 @@ void HandleDepthSwitching (void)
|
||||
|
||||
//-------------------------------------------------------------- CheckMemorySize
|
||||
|
||||
// Tests for a specific amount of memory available. If the required memory<72>
|
||||
// is not available, attempts to turn off various game features (music, etc.)<29>
|
||||
// Tests for a specific amount of memory available. If the required memory<72>
|
||||
// is not available, attempts to turn off various game features (music, etc.)<29>
|
||||
// in order to accomodate the constrained memory available.
|
||||
|
||||
void CheckMemorySize (void)
|
||||
@@ -428,10 +428,10 @@ void CheckMemorySize (void)
|
||||
#define kPaddingBytes 204800L // 200K Padding
|
||||
long bytesNeeded;
|
||||
long soundBytes, musicBytes;
|
||||
|
||||
|
||||
dontLoadMusic = false;
|
||||
dontLoadSounds = false;
|
||||
|
||||
|
||||
bytesNeeded = kBaseBytesNeeded; // base memory
|
||||
soundBytes = SoundBytesNeeded(); // sound memory
|
||||
if (soundBytes <= 0L)
|
||||
@@ -444,15 +444,15 @@ void CheckMemorySize (void)
|
||||
else
|
||||
bytesNeeded += musicBytes;
|
||||
bytesNeeded += 4L * (long)thisMac.constrainedScreen.bottom; // main screen
|
||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
|
||||
((long)houseRect.bottom + 1 - (long)houseRect.top) *
|
||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
|
||||
((long)houseRect.bottom + 1 - (long)houseRect.top) *
|
||||
(long)thisMac.isDepth) / 8L; // work map
|
||||
bytesNeeded += 4L * (long)houseRect.bottom;
|
||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
|
||||
((long)houseRect.bottom + 1 - (long)houseRect.top) *
|
||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
|
||||
((long)houseRect.bottom + 1 - (long)houseRect.top) *
|
||||
(long)thisMac.isDepth) / 8L; // back map
|
||||
bytesNeeded += 4L * houseRect.bottom;
|
||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) * 21 *
|
||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) * 21 *
|
||||
(long)thisMac.isDepth) / 8L; // scoreboard map
|
||||
bytesNeeded += (6396L * (long)thisMac.isDepth) / 8L; // more scoreboard
|
||||
bytesNeeded += (32112L * (long)thisMac.isDepth) / 8L; // glider map
|
||||
@@ -516,7 +516,7 @@ void CheckMemorySize (void)
|
||||
bytesNeeded += sizeof(dynaType) * kMaxDynamicObs;
|
||||
bytesNeeded += sizeof(objDataType) * kMaxMasterObjects;
|
||||
bytesNeeded += kDemoLength; SpinCursor(1);
|
||||
|
||||
|
||||
SpinCursor(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ typedef struct
|
||||
objectType objects[kMaxRoomObs]; // 24 * 12
|
||||
} roomType, *roomPtr; // total = 348
|
||||
|
||||
typedef struct
|
||||
struct houseType
|
||||
{
|
||||
int16_t version; // 2
|
||||
int16_t unusedShort; // 2
|
||||
@@ -198,9 +198,12 @@ typedef struct
|
||||
|
||||
int16_t padding;
|
||||
roomType rooms[1]; // 348 * nRooms
|
||||
// total = 866 +
|
||||
|
||||
static const size_t kBinaryDataSize = 866;
|
||||
} houseType, *housePtr; // total = 866 +
|
||||
};
|
||||
|
||||
typedef houseType *housePtr;
|
||||
|
||||
typedef THandle<houseType> houseHand;
|
||||
|
||||
|
||||
30
GpApp/SoundSync_Cpp11.cpp
Normal file
30
GpApp/SoundSync_Cpp11.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "SoundSync.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
static std::atomic<uint64_t> gs_prioritiesBlob(0);
|
||||
|
||||
SoundSyncState SoundSync_ReadAll()
|
||||
{
|
||||
const uint64_t priorities = gs_prioritiesBlob.load(std::memory_order_relaxed);
|
||||
|
||||
SoundSyncState state;
|
||||
state.priority0 = static_cast<uint16_t>((priorities >> 0) & 0xffff);
|
||||
state.priority1 = static_cast<uint16_t>((priorities >> 16) & 0xffff);
|
||||
state.priority2 = static_cast<uint16_t>((priorities >> 32) & 0xffff);
|
||||
state.priority3 = static_cast<uint16_t>((priorities >> 48) & 0xffff);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void SoundSync_ClearPriority(int index)
|
||||
{
|
||||
const uint64_t clearMask = ~(static_cast<int64_t>(0xffff) << (index * 16));
|
||||
gs_prioritiesBlob &= clearMask;
|
||||
}
|
||||
|
||||
void SoundSync_PutPriority(int index, int16_t priority)
|
||||
{
|
||||
const uint64_t insertMask = static_cast<int64_t>(priority) << (index * 16);
|
||||
gs_prioritiesBlob |= insertMask;
|
||||
}
|
||||
Reference in New Issue
Block a user