diff --git a/.gitignore b/.gitignore index 01b6c0c..a589c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ InstallerPackages/* ReleasePackageInstaller/obj/* ReleasePackageInstaller/bin/* ReleasePackageInstaller/AerofoilPackageDefs.wxi +ReleasePackageInstaller/AerofoilPackageVersion.wxi packages/* diff --git a/Aerofoil.sln b/Aerofoil.sln index 3391fed..2de2ff6 100644 --- a/Aerofoil.sln +++ b/Aerofoil.sln @@ -46,9 +46,14 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unpacktool", "unpacktool\unpacktool.vcxproj", "{A778D062-DE76-49F6-8D05-EB26852DD605}" EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ReleasePackageInstaller", "ReleasePackageInstaller\ReleasePackageInstaller.wixproj", "{D26BD501-28A7-4849-8130-FB5EA0A2B82F}" + ProjectSection(ProjectDependencies) = postProject + {7EFF1E21-C375-45EA-A069-4E2232C8A72B} = {7EFF1E21-C375-45EA-A069-4E2232C8A72B} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsUnicodeToolShim", "WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj", "{15009625-1120-405E-8BBA-69A16CD6713D}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EmitWiXVersion", "EmitWiXVersion\EmitWiXVersion.vcxproj", "{7EFF1E21-C375-45EA-A069-4E2232C8A72B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -237,6 +242,14 @@ Global {15009625-1120-405E-8BBA-69A16CD6713D}.Release|x64.Build.0 = Release|x64 {15009625-1120-405E-8BBA-69A16CD6713D}.Release|x86.ActiveCfg = Release|Win32 {15009625-1120-405E-8BBA-69A16CD6713D}.Release|x86.Build.0 = Release|Win32 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x64.ActiveCfg = Debug|x64 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x64.Build.0 = Debug|x64 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x86.ActiveCfg = Debug|Win32 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x86.Build.0 = Debug|Win32 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x64.ActiveCfg = Release|x64 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x64.Build.0 = Release|x64 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x86.ActiveCfg = Release|Win32 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ApplicationResourcePatches/DITL/2000.json b/ApplicationResourcePatches/DITL/2000.json new file mode 100644 index 0000000..34d2153 --- /dev/null +++ b/ApplicationResourcePatches/DITL/2000.json @@ -0,0 +1,13 @@ +{ + "items" : + [ + { + "name" : "Okay", + "itemType" : "Button", + "pos" : [ 376, 240 ], + "size" : [ 58, 20 ], + "id" : 1, + "enabled" : true + } + ] +} \ No newline at end of file diff --git a/ApplicationResourcePatches/manifest.json b/ApplicationResourcePatches/manifest.json index c4c3d39..138a1f8 100644 --- a/ApplicationResourcePatches/manifest.json +++ b/ApplicationResourcePatches/manifest.json @@ -1,7 +1,8 @@ { "add" : { - "DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json" + "DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json", + "DITL/2000.json" : "ApplicationResourcePatches/DITL/2000.json" }, "delete" : [ diff --git a/EmitWiXVersion/EmitWiXVersion.cpp b/EmitWiXVersion/EmitWiXVersion.cpp new file mode 100644 index 0000000..4e9beb2 --- /dev/null +++ b/EmitWiXVersion/EmitWiXVersion.cpp @@ -0,0 +1,27 @@ +#include "GpBuildVersion.h" +#include "WindowsUnicodeToolShim.h" + + +int toolMain(int argc, const char **argv) +{ + if (argc != 2) + { + fprintf(stderr, "Usage: EmitWiXVersion \n"); + return -1; + } + + FILE *f = fopen_utf8(argv[1], "wb"); + if (!f) + { + fprintf(stderr, "EmitWiXVersion: Error opening output file\n"); + return -1; + } + + fprintf(f, "\n"); + fprintf(f, "\n"); + fprintf(f, " \n", GP_BUILD_VERSION_MAJOR, GP_BUILD_VERSION_MINOR, GP_BUILD_VERSION_UPDATE); + fprintf(f, "\n"); + fclose(f); + + return 0; +} diff --git a/EmitWiXVersion/EmitWiXVersion.vcxproj b/EmitWiXVersion/EmitWiXVersion.vcxproj new file mode 100644 index 0000000..92b946d --- /dev/null +++ b/EmitWiXVersion/EmitWiXVersion.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {7EFF1E21-C375-45EA-A069-4E2232C8A72B} + EmitWiXVersion + 10.0.17763.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + true + + + + + Level3 + Disabled + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + + + + {6ec62b0f-9353-40a4-a510-3788f1368b33} + + + {15009625-1120-405e-8bba-69a16cd6713d} + + + + + + \ No newline at end of file diff --git a/EmitWiXVersion/EmitWiXVersion.vcxproj.filters b/EmitWiXVersion/EmitWiXVersion.vcxproj.filters new file mode 100644 index 0000000..8f599ca --- /dev/null +++ b/EmitWiXVersion/EmitWiXVersion.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/GpApp/About.cpp b/GpApp/About.cpp index 9a29500..dbc6fe0 100644 --- a/GpApp/About.cpp +++ b/GpApp/About.cpp @@ -7,10 +7,14 @@ #include "PLArrayView.h" #include "PLKeyEncoding.h" #include "PLControlDefinitions.h" +#include "FontFamily.h" +#include "PLButtonWidget.h" +#include "PLLabelWidget.h" #include "PLNumberFormatting.h" #include "PLResources.h" #include "PLSound.h" #include "PLPasStr.h" +#include "PLStandardColors.h" #include "PLSysCalls.h" #include "PLTimeTaggedVOSEvent.h" #include "PLWidgets.h" @@ -19,15 +23,23 @@ #include "DialogUtils.h" #include "Environ.h" #include "Externs.h" +#include "GpApplicationName.h" +#include "GpBuildVersion.h" #include "HostSystemServices.h" +#include "RenderedFont.h" +#include "RenderedFontMetrics.h" +#include "ResolveCachingColor.h" #include "ResourceManager.h" #include "ScanlineMask.h" +#include "WindowDef.h" +#include "WindowManager.h" static void HiLiteOkayButton (DrawSurface *surface); static void UnHiLiteOkayButton (DrawSurface *surface); static void UpdateMainPict (Dialog *); static int16_t AboutFilter(Dialog *, const TimeTaggedVOSEvent *evt); +static int16_t AboutFrameworkFilter(Dialog *, const TimeTaggedVOSEvent *evt); static Point okayButtLowerV, okayButtUpperV; @@ -86,6 +98,66 @@ void DoAbout (void) aboutDialog->Destroy(); } +void DoAboutFramework (void) +{ +#define kAboutFrameworkDialogTemplateID 2000 + + const Rect windowRect = Rect::Create(0, 0, 272, 450); + + PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR("")); + + PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black(); + PortabilityLayer::RenderedFont *font = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true); + PortabilityLayer::RenderedFont *fontLight = GetApplicationFont(8, PortabilityLayer::FontFamilyFlag_None, true); + + int16_t verticalPoint = 16 + font->GetMetrics().m_ascent; + int16_t horizontalOffset = 16; + const int16_t spacing = 12; + + PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance(); + Dialog *dialog = dialogManager->LoadDialogFromTemplate(kAboutFrameworkDialogTemplateID, windowRect, true, false, 0, 0, PL_GetPutInFrontWindowPtr(), PSTR(""), nullptr); + +#ifdef NDEBUG + #define ABOUT_DIALOG_CONFIGURATION_TAG "Release" +#else + #define ABOUT_DIALOG_CONFIGURATION_TAG "Debug" +#endif + + Window *window = dialog->GetWindow(); + + DrawSurface *surface = window->GetDrawSurface(); + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 0), PSTR(GP_APPLICATION_NAME " " GP_APPLICATION_VERSION_STRING " \xa9" GP_APPLICATION_COPYRIGHT_STRING), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 2), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO\xaa."), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 4), PSTR("This software is not maintained by, supported by, endorsed by, or"), blackColor, font); + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 5), PSTR("otherwise associated with the authors and publishers of Glider PRO\xaa."), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 7), PSTR("Please do not contact any of them regarding issues that you have"), blackColor, font); + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 8), PSTR("with " GP_APPLICATION_NAME "."), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 10), PSTR("If you would like to contribute to this project, visit:"), blackColor, font); + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 11), PSTR(GP_APPLICATION_WEBSITE_STRING), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 13), PSTR("To report a problem or request support, submit an issue via"), blackColor, font); + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 14), PSTR("the website above."), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 16), PSTR("For more information, please see the accompanying documentation."), blackColor, font); + + surface->DrawString(Point::Create(horizontalOffset, windowRect.bottom - 16), PSTR("Build: " __TIMESTAMP__ " " ABOUT_DIALOG_CONFIGURATION_TAG), blackColor, fontLight); + + DrawDefaultButton(dialog); + + int16_t hit = 0; + + do + { + hit = dialog->ExecuteModal(AboutFrameworkFilter); + } while (hit != kOkayButton); + + dialog->Destroy(); +} + //============================================================== Static Functions //-------------------------------------------------------------- HiLiteOkayButton // Draws my pseudo-button to appear as though it is clicked on. @@ -253,3 +325,44 @@ static int16_t AboutFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt) return hit; } + + +//-------------------------------------------------------------- AboutFrameworkFilter +// Dialog filter for the About Framework dialog. + +static int16_t AboutFrameworkFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt) +{ + bool handledIt = false; + int16_t hit = -1; + + if (!evt) + return -1; + + Window *window = dialog->GetWindow(); + DrawSurface *surface = window->GetDrawSurface(); + + if (evt->IsKeyDownEvent()) + { + switch (PackVOSKeyCode(evt->m_vosEvent.m_event.m_keyboardInputEvent)) + { + case PL_KEY_SPECIAL(kEnter): + case PL_KEY_NUMPAD_SPECIAL(kEnter): + dialog->GetItems()[kOkayButton - 1].GetWidget()->SetHighlightStyle(kControlButtonPart, true); + PLSysCalls::Sleep(8); + dialog->GetItems()[kOkayButton - 1].GetWidget()->SetHighlightStyle(kControlButtonPart, false); + hit = kOkayButton; + handledIt = true; + break; + + default: + handledIt = false; + break; + } + } + + if (!handledIt) + return -1; + + return hit; +} + diff --git a/GpApp/Externs.h b/GpApp/Externs.h index a553707..0c5e33a 100644 --- a/GpApp/Externs.h +++ b/GpApp/Externs.h @@ -51,6 +51,7 @@ namespace PortabilityLayer #define kErrNeed16Or256Colors 13 #define iAbout 1 +#define iAboutAerofoil 3 #define iNewGame 1 #define iTwoPlayer 2 #define iOpenSavedGame 3 @@ -127,6 +128,7 @@ typedef struct //-------------------------------------------------------------- Prototypes void DoAbout (void); // --- About.c +void DoAboutFramework (void); void LoadCursors (void); // --- AnimCursor.c void DisposCursors (void); diff --git a/GpApp/InterfaceInit.cpp b/GpApp/InterfaceInit.cpp index 4e62e79..0ed10d8 100644 --- a/GpApp/InterfaceInit.cpp +++ b/GpApp/InterfaceInit.cpp @@ -10,9 +10,11 @@ #include "Environ.h" #include "HostDisplayDriver.h" #include "IGpDisplayDriver.h" +#include "GpApplicationName.h" #include "Map.h" #include "MenuManager.h" #include "PLKeyEncoding.h" +#include "PLPasStr.h" #include "RectUtils.h" #include "Tools.h" @@ -46,11 +48,12 @@ extern Boolean twoPlayerGame, paused, hasMirror, splashDrawn; // The menus are loaded from disk and the menu bar set up and drawn. void InitializeMenus (void) -{ +{ appleMenu = GetMenu(kAppleMenuID); if (appleMenu == nil) RedAlert(kErrFailedResourceLoad); //AppendResMenu(appleMenu, 'DRVR'); // GP: We don't support this + AppendMenuItem(appleMenu, 0, 0, 0, 0, true, false, PSTR("About " GP_APPLICATION_NAME "\xc9")); InsertMenu(appleMenu, 0); gameMenu = GetMenu(kGameMenuID); diff --git a/GpApp/Menu.cpp b/GpApp/Menu.cpp index 7b1c40c..19c72e4 100644 --- a/GpApp/Menu.cpp +++ b/GpApp/Menu.cpp @@ -293,6 +293,10 @@ void DoAppleMenu (short theItem) DoAbout(); break; + case iAboutAerofoil: + DoAboutFramework(); + break; + default: // GetMenuItemText(appleMenu, theItem, daName); // GetPort(&wasPort); diff --git a/GpCommon/GpBuildVersion.h b/GpCommon/GpBuildVersion.h new file mode 100644 index 0000000..80ea230 --- /dev/null +++ b/GpCommon/GpBuildVersion.h @@ -0,0 +1,9 @@ +#pragma once + +#define GP_BUILD_VERSION_MAJOR 1 +#define GP_BUILD_VERSION_MINOR 0 +#define GP_BUILD_VERSION_UPDATE 0 + +#define GP_APPLICATION_VERSION_STRING "1.0.0" +#define GP_APPLICATION_COPYRIGHT_STRING "2020 Eric Lasota" +#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil" diff --git a/PortabilityLayer/DialogManager.cpp b/PortabilityLayer/DialogManager.cpp index dcdddd4..431eaef 100644 --- a/PortabilityLayer/DialogManager.cpp +++ b/PortabilityLayer/DialogManager.cpp @@ -611,15 +611,15 @@ namespace PortabilityLayer { public: Dialog *LoadDialog(int16_t resID, Window *behindWindow, const DialogTextSubstitutions *substitutions) override; + Dialog *LoadDialogFromTemplate(int16_t templateResID, const Rect &rect, bool visible, bool hasCloseBox, uint32_t referenceConstant, uint16_t positionSpec, Window *behindWindow, const PLPasStr &title, const DialogTextSubstitutions *substitutions) override; int16_t DisplayAlert(int16_t alertResID, const DialogTextSubstitutions *substitutions) override; + void PositionWindow(Window *window, const Rect &rect) const override; DialogTemplate *LoadDialogTemplate(int16_t resID); static DialogManagerImpl *GetInstance(); private: - void PositionWindow(Window *window, const Rect &rect); - Dialog *LoadDialogFromTemplate(int16_t templateResID, const Rect &rect, bool visible, bool hasCloseBox, uint32_t referenceConstant, uint16_t positionSpec, Window *behindWindow, const PLPasStr &title, const DialogTextSubstitutions *substitutions); static int16_t AlertFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt); @@ -827,7 +827,7 @@ namespace PortabilityLayer return dtemplate; } - void DialogManagerImpl::PositionWindow(Window *window, const Rect &rect) + void DialogManagerImpl::PositionWindow(Window *window, const Rect &rect) const { unsigned int displayWidth, displayHeight; PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&displayWidth, &displayHeight, nullptr); diff --git a/PortabilityLayer/DialogManager.h b/PortabilityLayer/DialogManager.h index c6faab8..347305b 100644 --- a/PortabilityLayer/DialogManager.h +++ b/PortabilityLayer/DialogManager.h @@ -4,8 +4,10 @@ struct Dialog; struct DialogTextSubstitutions; +struct Rect; struct Window; struct TimeTaggedVOSEvent; +class PLPasStr; namespace PortabilityLayer { @@ -16,7 +18,9 @@ namespace PortabilityLayer { public: virtual Dialog *LoadDialog(int16_t resID, Window *behindWindow, const DialogTextSubstitutions *substitutions) = 0; + virtual Dialog *LoadDialogFromTemplate(int16_t templateResID, const Rect &rect, bool visible, bool hasCloseBox, uint32_t referenceConstant, uint16_t positionSpec, Window *behindWindow, const PLPasStr &title, const DialogTextSubstitutions *substitutions) = 0; virtual int16_t DisplayAlert(int16_t alertResID, const DialogTextSubstitutions *substitutions) = 0; + virtual void PositionWindow(Window *window, const Rect &rect) const = 0; static DialogManager *GetInstance(); }; diff --git a/PortabilityLayer/MenuManager.cpp b/PortabilityLayer/MenuManager.cpp index 36c7382..0212a2f 100644 --- a/PortabilityLayer/MenuManager.cpp +++ b/PortabilityLayer/MenuManager.cpp @@ -128,6 +128,8 @@ namespace PortabilityLayer THandle DeserializeMenu(const void *resData) const override; THandle GetMenuByID(int id) const override; + PLError_t AppendMenuItem(const THandle &menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) const override; + void InsertMenuBefore(const THandle &insertingMenu, const THandle &existingMenu) override; void InsertMenuAfter(const THandle &insertingMenu, const THandle &existingMenu) override; void InsertMenuAtEnd(const THandle &insertingMenu) override; @@ -391,6 +393,41 @@ namespace PortabilityLayer return THandle(); } + PLError_t MenuManagerImpl::AppendMenuItem(const THandle &menuHdl, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) const + { + PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance(); + + Menu *menu = *menuHdl; + + // This doesn't need a +1 because 1 is implicit + if (!mm->ResizeHandle(menuHdl.MMBlock(), sizeof(Menu) + menu->numMenuItems * sizeof(MenuItem))) + return PLErrors::kOutOfMemory; + + menu = *menuHdl; + size_t oldStringBlobSize = menu->stringBlobHandle->m_size; + + if (!mm->ResizeHandle(menu->stringBlobHandle, oldStringBlobSize + text.Length() + 1)) + return PLErrors::kOutOfMemory; + + MenuItem *lastItem = menu->menuItems + menu->numMenuItems; + menu->numMenuItems++; + menu->haveMenuLayout = false; + + uint8_t *stringBlob = static_cast(menu->stringBlobHandle->m_contents); + stringBlob[oldStringBlobSize] = text.Length(); + memcpy(stringBlob + oldStringBlobSize + 1, text.UChars(), text.Length()); + + lastItem->iconResID = iconResID; + lastItem->key = key; + lastItem->submenuID = submenuID; + lastItem->textStyle = textStyle; + lastItem->enabled = enabled; + lastItem->checked = checked; + lastItem->nameOffsetInStringBlob = oldStringBlobSize; + + return PLErrors::kNone; + } + void MenuManagerImpl::InsertMenuBefore(const THandle &insertingMenu, const THandle &existingMenu) { m_haveMenuBarLayout = false; diff --git a/PortabilityLayer/MenuManager.h b/PortabilityLayer/MenuManager.h index 4e5cf38..6a36d9e 100644 --- a/PortabilityLayer/MenuManager.h +++ b/PortabilityLayer/MenuManager.h @@ -1,6 +1,7 @@ #pragma once #include +#include "PLErrorCodes.h" template class THandle; @@ -22,6 +23,8 @@ namespace PortabilityLayer virtual THandle DeserializeMenu(const void *resData) const = 0; virtual THandle GetMenuByID(int id) const = 0; + virtual PLError_t AppendMenuItem(const THandle &menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) const = 0; + virtual void InsertMenuBefore(const THandle &insertingMenu, const THandle &existingMenu) = 0; virtual void InsertMenuAfter(const THandle &insertingMenu, const THandle &existingMenu) = 0; virtual void InsertMenuAtEnd(const THandle &insertingMenu) = 0; diff --git a/PortabilityLayer/PLMenus.cpp b/PortabilityLayer/PLMenus.cpp index d0a2245..5c2e0fa 100644 --- a/PortabilityLayer/PLMenus.cpp +++ b/PortabilityLayer/PLMenus.cpp @@ -73,6 +73,13 @@ void CheckMenuItem(MenuHandle menu, int index, Boolean checked) mm->SetItemChecked(menu, index - 1, checked != 0); } + +void AppendMenuItem(MenuHandle menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) +{ + PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance(); + mm->AppendMenuItem(menu, iconResID, key, submenuID, textStyle, enabled, checked, text); +} + void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text) { PL_NotYetImplemented(); diff --git a/PortabilityLayer/PLMenus.h b/PortabilityLayer/PLMenus.h index 68fdf12..6225b14 100644 --- a/PortabilityLayer/PLMenus.h +++ b/PortabilityLayer/PLMenus.h @@ -14,4 +14,6 @@ void DisableMenuItem(MenuHandle menu, int index); void CheckMenuItem(MenuHandle menu, int index, Boolean checked); void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text); +void AppendMenuItem(MenuHandle menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text); + #endif diff --git a/PortabilityLayer/PascalStr.h b/PortabilityLayer/PascalStr.h index 68edf96..81e13c6 100644 --- a/PortabilityLayer/PascalStr.h +++ b/PortabilityLayer/PascalStr.h @@ -13,6 +13,7 @@ namespace PortabilityLayer PascalStr(); PascalStr(size_t size, const char *str); explicit PascalStr(const PLPasStr &pstr); + explicit PascalStr(const char *str); }; } @@ -38,4 +39,10 @@ namespace PortabilityLayer : UnsafePascalStr(pstr.Length(), pstr.Chars()) { } + + template + PascalStr::PascalStr(const char *str) + : UnsafePascalStr((str == nullptr) ? 0 : strlen(str), str) + { + } } diff --git a/ReleasePackageInstaller/Product.wxs b/ReleasePackageInstaller/Product.wxs index c1d94d3..289e685 100644 --- a/ReleasePackageInstaller/Product.wxs +++ b/ReleasePackageInstaller/Product.wxs @@ -1,6 +1,7 @@ +