mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 20:19:38 +00:00
Clean up warnings
This commit is contained in:
@@ -147,8 +147,6 @@ void CenterDialog (SInt16 dialogID)
|
|||||||
|
|
||||||
void GetDialogRect (Rect *bounds, short dialogID)
|
void GetDialogRect (Rect *bounds, short dialogID)
|
||||||
{
|
{
|
||||||
Byte wasState;
|
|
||||||
|
|
||||||
Handle dlogHandle = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('DLOG', dialogID).StaticCast<void>();
|
Handle dlogHandle = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('DLOG', dialogID).StaticCast<void>();
|
||||||
if (dlogHandle != nil)
|
if (dlogHandle != nil)
|
||||||
{
|
{
|
||||||
@@ -343,10 +341,8 @@ void ZoomOutAlertRect (short alertID)
|
|||||||
|
|
||||||
void FlashDialogButton (Dialog *theDialog, short itemNumber)
|
void FlashDialogButton (Dialog *theDialog, short itemNumber)
|
||||||
{
|
{
|
||||||
Rect itemRect;
|
|
||||||
ControlHandle itemHandle;
|
ControlHandle itemHandle;
|
||||||
UInt32 dummyLong;
|
UInt32 dummyLong;
|
||||||
short itemType;
|
|
||||||
|
|
||||||
PortabilityLayer::Widget *widget = theDialog->GetItems()[itemNumber - 1].GetWidget();
|
PortabilityLayer::Widget *widget = theDialog->GetItems()[itemNumber - 1].GetWidget();
|
||||||
|
|
||||||
@@ -445,9 +441,7 @@ void ToggleDialogItemValue (Dialog *theDialog, short item)
|
|||||||
void SetDialogNumToStr (Dialog *theDialog, short item, long theNumber)
|
void SetDialogNumToStr (Dialog *theDialog, short item, long theNumber)
|
||||||
{
|
{
|
||||||
Str255 theString;
|
Str255 theString;
|
||||||
Rect itemRect;
|
|
||||||
ControlHandle itemHandle;
|
ControlHandle itemHandle;
|
||||||
short itemType;
|
|
||||||
|
|
||||||
NumToString(theNumber, theString);
|
NumToString(theNumber, theString);
|
||||||
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
|
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
|
||||||
@@ -570,7 +564,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
|||||||
{
|
{
|
||||||
ControlHandle iHandle;
|
ControlHandle iHandle;
|
||||||
Str255 stringCopy;
|
Str255 stringCopy;
|
||||||
short iType, i, inset;
|
short inset;
|
||||||
|
|
||||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||||
|
|
||||||
@@ -622,9 +616,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
|||||||
|
|
||||||
void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
|
void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
|
||||||
{
|
{
|
||||||
;
|
|
||||||
Str255 stringCopy;
|
Str255 stringCopy;
|
||||||
short iType;
|
|
||||||
|
|
||||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||||
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
|
||||||
|
|||||||
@@ -108,13 +108,12 @@ void DoHighScores (void)
|
|||||||
void DrawHighScores (DrawSurface *surface)
|
void DrawHighScores (DrawSurface *surface)
|
||||||
{
|
{
|
||||||
DrawSurface *tempMap, *tempMask;
|
DrawSurface *tempMap, *tempMask;
|
||||||
DrawSurface *wasCPort;
|
|
||||||
PLError_t theErr;
|
PLError_t theErr;
|
||||||
houseType *thisHousePtr;
|
houseType *thisHousePtr;
|
||||||
Rect tempRect, tempRect2;
|
Rect tempRect, tempRect2;
|
||||||
Str255 tempStr;
|
Str255 tempStr;
|
||||||
short scoreLeft, bannerWidth, i, dropIt;
|
short scoreLeft, bannerWidth, i, dropIt;
|
||||||
char wasState;
|
|
||||||
PortabilityLayer::ResolveCachingColor blackColor = PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
|
PortabilityLayer::ResolveCachingColor blackColor = PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
|
||||||
PortabilityLayer::ResolveCachingColor yellowColor = PortabilityLayer::RGBAColor::Create(255, 255, 0, 255);
|
PortabilityLayer::ResolveCachingColor yellowColor = PortabilityLayer::RGBAColor::Create(255, 255, 0, 255);
|
||||||
PortabilityLayer::ResolveCachingColor cyanColor = PortabilityLayer::RGBAColor::Create(0, 255, 255, 255);
|
PortabilityLayer::ResolveCachingColor cyanColor = PortabilityLayer::RGBAColor::Create(0, 255, 255, 255);
|
||||||
@@ -277,7 +276,6 @@ void SortHighScores (void)
|
|||||||
houseType *thisHousePtr;
|
houseType *thisHousePtr;
|
||||||
long greatest;
|
long greatest;
|
||||||
short i, h, which;
|
short i, h, which;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
thisHousePtr = *thisHouse;
|
thisHousePtr = *thisHouse;
|
||||||
|
|
||||||
@@ -313,7 +311,6 @@ void ZeroHighScores (void)
|
|||||||
{
|
{
|
||||||
houseType *thisHousePtr;
|
houseType *thisHousePtr;
|
||||||
short i;
|
short i;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
thisHousePtr = *thisHouse;
|
thisHousePtr = *thisHouse;
|
||||||
|
|
||||||
@@ -356,7 +353,6 @@ Boolean TestHighScore (void)
|
|||||||
{
|
{
|
||||||
houseType *thisHousePtr;
|
houseType *thisHousePtr;
|
||||||
short placing, i;
|
short placing, i;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
if (resumedSavedGame)
|
if (resumedSavedGame)
|
||||||
return (false);
|
return (false);
|
||||||
|
|||||||
@@ -602,8 +602,6 @@ Boolean KeepObjectLegal (void)
|
|||||||
#ifndef COMPILEDEMO
|
#ifndef COMPILEDEMO
|
||||||
void WrapBannerAndTrailer (void)
|
void WrapBannerAndTrailer (void)
|
||||||
{
|
{
|
||||||
char wasState;
|
|
||||||
|
|
||||||
WrapText((*thisHouse)->banner, 40);
|
WrapText((*thisHouse)->banner, 40);
|
||||||
WrapText((*thisHouse)->trailer, 64);
|
WrapText((*thisHouse)->trailer, 64);
|
||||||
}
|
}
|
||||||
@@ -615,7 +613,6 @@ void WrapBannerAndTrailer (void)
|
|||||||
void ValidateNumberOfRooms (void)
|
void ValidateNumberOfRooms (void)
|
||||||
{
|
{
|
||||||
long countedRooms, reportsRooms;
|
long countedRooms, reportsRooms;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
reportsRooms = (long)(*thisHouse)->nRooms;
|
reportsRooms = (long)(*thisHouse)->nRooms;
|
||||||
countedRooms = (GetHandleSize(thisHouse.StaticCast<void>()) -
|
countedRooms = (GetHandleSize(thisHouse.StaticCast<void>()) -
|
||||||
@@ -637,7 +634,6 @@ void CheckDuplicateFloorSuite (void)
|
|||||||
#define kRoomsTimesSuites 8192
|
#define kRoomsTimesSuites 8192
|
||||||
short i, numRooms, bitPlace;
|
short i, numRooms, bitPlace;
|
||||||
char *pidgeonHoles;
|
char *pidgeonHoles;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
pidgeonHoles = (char *)NewPtrClear(sizeof(char) * kRoomsTimesSuites);
|
pidgeonHoles = (char *)NewPtrClear(sizeof(char) * kRoomsTimesSuites);
|
||||||
if (pidgeonHoles == nil)
|
if (pidgeonHoles == nil)
|
||||||
@@ -672,7 +668,6 @@ void CheckDuplicateFloorSuite (void)
|
|||||||
void CompressHouse (void)
|
void CompressHouse (void)
|
||||||
{
|
{
|
||||||
short wasFirstRoom, roomNumber, probe;
|
short wasFirstRoom, roomNumber, probe;
|
||||||
char wasState;
|
|
||||||
Boolean compressing, probing;
|
Boolean compressing, probing;
|
||||||
|
|
||||||
wasFirstRoom = (*thisHouse)->firstRoom;
|
wasFirstRoom = (*thisHouse)->firstRoom;
|
||||||
@@ -720,7 +715,6 @@ void LopOffExtraRooms (void)
|
|||||||
{
|
{
|
||||||
long newSize;
|
long newSize;
|
||||||
short r, count;
|
short r, count;
|
||||||
char wasState;
|
|
||||||
Str255 message;
|
Str255 message;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
@@ -756,7 +750,6 @@ void LopOffExtraRooms (void)
|
|||||||
void ValidateRoomNumbers (void)
|
void ValidateRoomNumbers (void)
|
||||||
{
|
{
|
||||||
short i, numRooms;
|
short i, numRooms;
|
||||||
char wasState;
|
|
||||||
Str255 message;
|
Str255 message;
|
||||||
|
|
||||||
numRooms = (*thisHouse)->nRooms;
|
numRooms = (*thisHouse)->nRooms;
|
||||||
@@ -796,7 +789,6 @@ void ValidateRoomNumbers (void)
|
|||||||
void CountUntitledRooms (void)
|
void CountUntitledRooms (void)
|
||||||
{
|
{
|
||||||
short i, numRooms;
|
short i, numRooms;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
numRooms = (*thisHouse)->nRooms;
|
numRooms = (*thisHouse)->nRooms;
|
||||||
for (i = 0; i < numRooms; i++)
|
for (i = 0; i < numRooms; i++)
|
||||||
@@ -814,7 +806,6 @@ void CountUntitledRooms (void)
|
|||||||
void CheckRoomNameLength (void)
|
void CheckRoomNameLength (void)
|
||||||
{
|
{
|
||||||
short i, numRooms;
|
short i, numRooms;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
numRooms = (*thisHouse)->nRooms;
|
numRooms = (*thisHouse)->nRooms;
|
||||||
for (i = 0; i < numRooms; i++)
|
for (i = 0; i < numRooms; i++)
|
||||||
@@ -837,7 +828,6 @@ void CheckRoomNameLength (void)
|
|||||||
void MakeSureNumObjectsJives (void)
|
void MakeSureNumObjectsJives (void)
|
||||||
{
|
{
|
||||||
short i, h, numRooms, count;
|
short i, h, numRooms, count;
|
||||||
char wasState;
|
|
||||||
|
|
||||||
numRooms = (*thisHouse)->nRooms;
|
numRooms = (*thisHouse)->nRooms;
|
||||||
for (i = 0; i < numRooms; i++)
|
for (i = 0; i < numRooms; i++)
|
||||||
@@ -866,7 +856,6 @@ void MakeSureNumObjectsJives (void)
|
|||||||
void KeepAllObjectsLegal (void)
|
void KeepAllObjectsLegal (void)
|
||||||
{
|
{
|
||||||
short i, h, numRooms;
|
short i, h, numRooms;
|
||||||
char wasState;
|
|
||||||
Str255 message;
|
Str255 message;
|
||||||
|
|
||||||
numRooms = (*thisHouse)->nRooms;
|
numRooms = (*thisHouse)->nRooms;
|
||||||
@@ -901,7 +890,6 @@ void KeepAllObjectsLegal (void)
|
|||||||
void CheckForStaircasePairs (void)
|
void CheckForStaircasePairs (void)
|
||||||
{
|
{
|
||||||
short i, h, g, numRooms, neighbor;
|
short i, h, g, numRooms, neighbor;
|
||||||
char wasState;
|
|
||||||
Boolean hasStairs;
|
Boolean hasStairs;
|
||||||
Str255 message;
|
Str255 message;
|
||||||
|
|
||||||
|
|||||||
@@ -176,8 +176,6 @@ void RecomputeInterfaceRects (void)
|
|||||||
|
|
||||||
void VariableInit (void)
|
void VariableInit (void)
|
||||||
{
|
{
|
||||||
short i;
|
|
||||||
|
|
||||||
menusUp = false;
|
menusUp = false;
|
||||||
quitting = false;
|
quitting = false;
|
||||||
houseOpen = false;
|
houseOpen = false;
|
||||||
|
|||||||
@@ -1127,7 +1127,7 @@ void GpDisplayDriverD3D11::Run()
|
|||||||
HMENU menus = NULL;
|
HMENU menus = NULL;
|
||||||
|
|
||||||
// TODO: Fix the resolution here
|
// TODO: Fix the resolution here
|
||||||
RECT wr = { 0, 0, m_windowWidthPhysical, m_windowHeightPhysical };
|
RECT wr = { 0, 0, static_cast<DWORD>(m_windowWidthPhysical), static_cast<DWORD>(m_windowHeightPhysical) };
|
||||||
AdjustWindowRect(&wr, windowStyle, menus != NULL);
|
AdjustWindowRect(&wr, windowStyle, menus != NULL);
|
||||||
|
|
||||||
m_osGlobals->m_hwnd = CreateWindowExW(NULL, L"GPD3D11WindowClass", GP_APPLICATION_NAME_W, WS_OVERLAPPEDWINDOW, 300, 300, wr.right - wr.left, wr.bottom - wr.top, NULL, menus, m_osGlobals->m_hInstance, NULL);
|
m_osGlobals->m_hwnd = CreateWindowExW(NULL, L"GPD3D11WindowClass", GP_APPLICATION_NAME_W, WS_OVERLAPPEDWINDOW, 300, 300, wr.right - wr.left, wr.bottom - wr.top, NULL, menus, m_osGlobals->m_hInstance, NULL);
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
void GpDisplayDriverSurfaceD3D11::Upload(const void *data, size_t x, size_t y, size_t width, size_t height, size_t pitch)
|
void GpDisplayDriverSurfaceD3D11::Upload(const void *data, size_t x, size_t y, size_t width, size_t height, size_t pitch)
|
||||||
{
|
{
|
||||||
D3D11_BOX box;
|
D3D11_BOX box;
|
||||||
box.left = x;
|
box.left = static_cast<UINT>(x);
|
||||||
box.right = x + width;
|
box.right = static_cast<UINT>(x + width);
|
||||||
box.top = y;
|
box.top = static_cast<UINT>(y);
|
||||||
box.bottom = y + height;
|
box.bottom = static_cast<UINT>(y + height);
|
||||||
box.front = 0;
|
box.front = 0;
|
||||||
box.back = 1;
|
box.back = 1;
|
||||||
|
|
||||||
m_deviceContext->UpdateSubresource(m_texture, 0, &box, data, pitch, height * pitch);
|
m_deviceContext->UpdateSubresource(m_texture, 0, &box, data, pitch, static_cast<UINT>(height * pitch));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpDisplayDriverSurfaceD3D11::UploadEntire(const void *data, size_t pitch)
|
void GpDisplayDriverSurfaceD3D11::UploadEntire(const void *data, size_t pitch)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace PortabilityLayer
|
|||||||
for (size_t i = 0; i < 256; i++)
|
for (size_t i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
PortabilityLayer::RGBAColor &color = m_palette[i];
|
PortabilityLayer::RGBAColor &color = m_palette[i];
|
||||||
color.r = color.g = color.b = i;
|
color.r = color.g = color.b = static_cast<uint8_t>(i);
|
||||||
color.a = 255;
|
color.a = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
CacheHeader header;
|
CacheHeader header;
|
||||||
header.m_cacheVersion = kRFontCacheVersion;
|
header.m_cacheVersion = kRFontCacheVersion;
|
||||||
header.m_glyphDataSize = this->m_dataSize;
|
header.m_glyphDataSize = static_cast<uint32_t>(this->m_dataSize);
|
||||||
header.m_isAA = m_isAntiAliased;
|
header.m_isAA = m_isAntiAliased;
|
||||||
header.m_sizeSize = sizeof(size_t);
|
header.m_sizeSize = sizeof(size_t);
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ namespace PortabilityLayer
|
|||||||
mb2Header[MB2FileOffsets::Protected] = fileInfo.m_properties.m_protected;
|
mb2Header[MB2FileOffsets::Protected] = fileInfo.m_properties.m_protected;
|
||||||
BytePack::BigUInt32(mb2Header + MB2FileOffsets::DataForkSize, fileInfo.m_dataForkSize);
|
BytePack::BigUInt32(mb2Header + MB2FileOffsets::DataForkSize, fileInfo.m_dataForkSize);
|
||||||
BytePack::BigUInt32(mb2Header + MB2FileOffsets::ResourceForkSize, fileInfo.m_resourceForkSize);
|
BytePack::BigUInt32(mb2Header + MB2FileOffsets::ResourceForkSize, fileInfo.m_resourceForkSize);
|
||||||
BytePack::BigUInt32(mb2Header + MB2FileOffsets::CreationDate, fileInfo.m_properties.m_creationDate);
|
BytePack::BigUInt32(mb2Header + MB2FileOffsets::CreationDate, static_cast<uint32_t>(fileInfo.m_properties.m_creationDate));
|
||||||
BytePack::BigUInt32(mb2Header + MB2FileOffsets::ModifiedDate, fileInfo.m_properties.m_modifiedDate);
|
BytePack::BigUInt32(mb2Header + MB2FileOffsets::ModifiedDate, static_cast<uint32_t>(fileInfo.m_properties.m_modifiedDate));
|
||||||
|
|
||||||
BytePack::BigUInt16(mb2Header + MB2FileOffsets::CommentLength, fileInfo.m_commentSize);
|
BytePack::BigUInt16(mb2Header + MB2FileOffsets::CommentLength, fileInfo.m_commentSize);
|
||||||
mb2Header[MB2FileOffsets::FinderFlagsLow] = static_cast<uint8_t>(fileInfo.m_properties.m_finderFlags & 0xff);
|
mb2Header[MB2FileOffsets::FinderFlagsLow] = static_cast<uint8_t>(fileInfo.m_properties.m_finderFlags & 0xff);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace
|
|||||||
|
|
||||||
struct MenuItem
|
struct MenuItem
|
||||||
{
|
{
|
||||||
uint32_t nameOffsetInStringBlob;
|
size_t nameOffsetInStringBlob;
|
||||||
int8_t iconResID;
|
int8_t iconResID;
|
||||||
uint8_t key;
|
uint8_t key;
|
||||||
uint8_t submenuID;
|
uint8_t submenuID;
|
||||||
@@ -1055,7 +1055,7 @@ namespace PortabilityLayer
|
|||||||
int32_t yCoordinate = 0;
|
int32_t yCoordinate = 0;
|
||||||
if (!m_menuSelectionState.IsPopup())
|
if (!m_menuSelectionState.IsPopup())
|
||||||
{
|
{
|
||||||
xCoordinate = kMenuBarInitialPadding + selectedMenu->menuIndex * kMenuBarItemPadding * 2 + selectedMenu->cumulativeOffset - kMenuBarItemPadding;
|
xCoordinate = static_cast<int32_t>(kMenuBarInitialPadding + selectedMenu->menuIndex * kMenuBarItemPadding * 2 + selectedMenu->cumulativeOffset - kMenuBarItemPadding);
|
||||||
yCoordinate = kMenuBarHeight;
|
yCoordinate = kMenuBarHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1385,7 +1385,7 @@ namespace PortabilityLayer
|
|||||||
m_popupPosition.m_y = kMenuBarHeight;
|
m_popupPosition.m_y = kMenuBarHeight;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t popupBottom = m_popupPosition.m_y + menu->layoutFinalHeight;
|
int32_t popupBottom = static_cast<int32_t>(m_popupPosition.m_y + menu->layoutFinalHeight);
|
||||||
|
|
||||||
unsigned int displayHeight = 0;
|
unsigned int displayHeight = 0;
|
||||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
|
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
|
||||||
@@ -1486,18 +1486,18 @@ namespace PortabilityLayer
|
|||||||
ResolveCachingColor barMidColor = gs_barMidColor;
|
ResolveCachingColor barMidColor = gs_barMidColor;
|
||||||
|
|
||||||
{
|
{
|
||||||
const Rect rect = Rect::Create(0, 0, menu->layoutFinalHeight, menu->layoutWidth);
|
const Rect rect = Rect::Create(0, 0, static_cast<int16_t>(menu->layoutFinalHeight), menu->layoutWidth);
|
||||||
surface->FillRect(rect, barMidColor);
|
surface->FillRect(rect, barMidColor);
|
||||||
|
|
||||||
ResolveCachingColor whiteColor = StdColors::White();
|
ResolveCachingColor whiteColor = StdColors::White();
|
||||||
|
|
||||||
surface->FillRect(Rect::Create(0, 0, 1, menu->layoutWidth - 1), whiteColor);
|
surface->FillRect(Rect::Create(0, 0, 1, static_cast<int16_t>(menu->layoutWidth - 1)), whiteColor);
|
||||||
surface->FillRect(Rect::Create(1, 0, menu->layoutFinalHeight - 1, 1), whiteColor);
|
surface->FillRect(Rect::Create(1, 0, static_cast<int16_t>(menu->layoutFinalHeight - 1), 1), whiteColor);
|
||||||
|
|
||||||
ResolveCachingColor darkGrayColor = RGBAColor::Create(kDarkGray, kDarkGray, kDarkGray, 255);
|
ResolveCachingColor darkGrayColor = RGBAColor::Create(kDarkGray, kDarkGray, kDarkGray, 255);
|
||||||
|
|
||||||
surface->FillRect(Rect::Create(1, menu->layoutWidth - 1, menu->layoutFinalHeight, menu->layoutWidth), darkGrayColor);
|
surface->FillRect(Rect::Create(1, static_cast<int16_t>(menu->layoutWidth - 1), static_cast<int16_t>(menu->layoutFinalHeight), static_cast<int16_t>(menu->layoutWidth)), darkGrayColor);
|
||||||
surface->FillRect(Rect::Create(menu->layoutFinalHeight - 1, 1, menu->layoutFinalHeight, menu->layoutWidth - 1), darkGrayColor);
|
surface->FillRect(Rect::Create(static_cast<int16_t>(menu->layoutFinalHeight - 1), 1, static_cast<int16_t>(menu->layoutFinalHeight), static_cast<int16_t>(menu->layoutWidth - 1)), darkGrayColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold, true);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|||||||
@@ -1,71 +1,71 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 Eric Lasota
|
Copyright 2019 Eric Lasota
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
the Software without restriction, including without limitation the rights to
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
so, subject to the following conditions:
|
so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CFileStream.h"
|
#include "CFileStream.h"
|
||||||
#include "ScopedPtr.h"
|
#include "ScopedPtr.h"
|
||||||
#include "BinHex4.h"
|
#include "BinHex4.h"
|
||||||
#include "MacBinary2.h"
|
#include "MacBinary2.h"
|
||||||
#include "MacFileMem.h"
|
#include "MacFileMem.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace PortabilityLayer;
|
using namespace PortabilityLayer;
|
||||||
|
|
||||||
int main(int argc, const char **argv)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
if (argc != 4)
|
if (argc != 4)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: hqx2gp <input.hqx> <input.ts> <output>");
|
fprintf(stderr, "Usage: hqx2gp <input.hqx> <input.ts> <output>");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _CRT_INSECURE_DEPRECATE
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
FILE *f = nullptr;
|
FILE *f = nullptr;
|
||||||
if (fopen_s(&f, argv[1], "rb"))
|
if (fopen_s(&f, argv[1], "rb"))
|
||||||
f = nullptr;
|
f = nullptr;
|
||||||
#else
|
#else
|
||||||
FILE *f = fopen(argv[1], "rb");
|
FILE *f = fopen(argv[1], "rb");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open input file");
|
fprintf(stderr, "Could not open input file");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _CRT_INSECURE_DEPRECATE
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
FILE *tsF = nullptr;
|
FILE *tsF = nullptr;
|
||||||
if (fopen_s(&tsF, argv[2], "rb"))
|
if (fopen_s(&tsF, argv[2], "rb"))
|
||||||
tsF = nullptr;
|
tsF = nullptr;
|
||||||
#else
|
#else
|
||||||
FILE *tsF = fopen(argv[2], "rb");
|
FILE *tsF = fopen(argv[2], "rb");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!tsF)
|
if (!tsF)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open timestamp file");
|
fprintf(stderr, "Could not open timestamp file");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t timestamp = 0;
|
int64_t timestamp = 0;
|
||||||
@@ -81,70 +81,70 @@ int main(int argc, const char **argv)
|
|||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
timestamp |= static_cast<int64_t>(encodedTimestamp[i]) << (i * 8);
|
timestamp |= static_cast<int64_t>(encodedTimestamp[i]) << (i * 8);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(tsF);
|
||||||
|
|
||||||
|
CFileStream fs(f, true, false, true);
|
||||||
|
|
||||||
|
ScopedPtr<MacFileMem> memFile = BinHex4::LoadHQX(&fs);
|
||||||
|
|
||||||
|
fs.Close();
|
||||||
|
|
||||||
|
std::string fname = argv[3];
|
||||||
|
|
||||||
fclose(tsF);
|
|
||||||
|
|
||||||
CFileStream fs(f, true, false, true);
|
|
||||||
|
|
||||||
ScopedPtr<MacFileMem> memFile = BinHex4::LoadHQX(&fs);
|
|
||||||
|
|
||||||
fs.Close();
|
|
||||||
|
|
||||||
std::string fname = argv[3];
|
|
||||||
|
|
||||||
const char* extensions[] = { ".gpf", ".gpr", ".gpd", ".gpc" };
|
const char* extensions[] = { ".gpf", ".gpr", ".gpd", ".gpc" };
|
||||||
|
|
||||||
MacFileProperties mfp = memFile->FileInfo().m_properties;
|
MacFileProperties mfp = memFile->FileInfo().m_properties;
|
||||||
mfp.m_creationDate = mfp.m_modifiedDate = timestamp;
|
mfp.m_creationDate = mfp.m_modifiedDate = timestamp;
|
||||||
|
|
||||||
MacFilePropertiesSerialized sp;
|
MacFilePropertiesSerialized sp;
|
||||||
sp.Serialize(mfp);
|
sp.Serialize(mfp);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
const void *bufferToWrite = nullptr;
|
const void *bufferToWrite = nullptr;
|
||||||
size_t sizeToWrite = 0;
|
size_t sizeToWrite = 0;
|
||||||
|
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
bufferToWrite = sp.m_data;
|
bufferToWrite = sp.m_data;
|
||||||
sizeToWrite = sp.kSize;
|
sizeToWrite = sp.kSize;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
bufferToWrite = memFile->ResourceFork();
|
bufferToWrite = memFile->ResourceFork();
|
||||||
sizeToWrite = memFile->FileInfo().m_resourceForkSize;
|
sizeToWrite = memFile->FileInfo().m_resourceForkSize;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
bufferToWrite = memFile->DataFork();
|
bufferToWrite = memFile->DataFork();
|
||||||
sizeToWrite = memFile->FileInfo().m_dataForkSize;
|
sizeToWrite = memFile->FileInfo().m_dataForkSize;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
bufferToWrite = memFile->Comment();
|
bufferToWrite = memFile->Comment();
|
||||||
sizeToWrite = memFile->FileInfo().m_commentSize;
|
sizeToWrite = memFile->FileInfo().m_commentSize;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sizeToWrite == 0)
|
if (sizeToWrite == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string path = fname + extensions[i];
|
std::string path = fname + extensions[i];
|
||||||
|
|
||||||
#ifdef _CRT_INSECURE_DEPRECATE
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
FILE *outF = nullptr;
|
FILE *outF = nullptr;
|
||||||
if (fopen_s(&outF, path.c_str(), "wb"))
|
if (fopen_s(&outF, path.c_str(), "wb"))
|
||||||
outF = nullptr;
|
outF = nullptr;
|
||||||
#else
|
#else
|
||||||
FILE *outF = fopen(path.c_str(), "wb");
|
FILE *outF = fopen(path.c_str(), "wb");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!outF)
|
if (!outF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fwrite(bufferToWrite, 1, sizeToWrite, outF);
|
fwrite(bufferToWrite, 1, sizeToWrite, outF);
|
||||||
fclose(outF);
|
fclose(outF);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user