diff options
author | Andrei Prykhodko | 2018-07-22 21:19:02 +0300 |
---|---|---|
committer | Andrei Prykhodko | 2018-07-22 21:19:02 +0300 |
commit | f4eda441862f8aacf75417f577907343278708e4 (patch) | |
tree | 9262019b9400cb6f138f634da649959a43690c31 /graphics/macgui/macmenu.cpp | |
parent | 62c66bc67a202694229a46e09d6881eea4ebd77f (diff) | |
download | scummvm-rg350-f4eda441862f8aacf75417f577907343278708e4.tar.gz scummvm-rg350-f4eda441862f8aacf75417f577907343278708e4.tar.bz2 scummvm-rg350-f4eda441862f8aacf75417f577907343278708e4.zip |
GRAPHICS: MACGUI: fixes for menu parser from win exe
Diffstat (limited to 'graphics/macgui/macmenu.cpp')
-rw-r--r-- | graphics/macgui/macmenu.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 427f605614..d48a7f47f9 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -194,6 +194,9 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager int depth = 0; int curMenuItemId = 0; + int action = 0; + bool lastPopUp = false; + bool lastPopUpCopy = false; // no more than 2 level menu for now while (depth >= 0) { uint16 flags = menuData->readUint16LE(); if (flags & kPopUp) { @@ -204,14 +207,32 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager // for now skip readUnicodeString(menuData); } - if (!(flags & kEndMenu)) { - depth++; + if (lastPopUp) { + lastPopUpCopy = lastPopUp; } + + lastPopUp = (flags & kEndMenu) != 0; + depth++; } else { menuData->readUint16LE(); // menu id - menu->addMenuSubItem(curMenuItemId, readUnicodeString(menuData), 0); + Common::U32String name = readUnicodeString(menuData); + if (depth == 1) { + menu->addMenuSubItem(curMenuItemId, name, action); + } + if (!name.empty()) { + action++; + } if (flags & kEndMenu) { - depth--; + if (lastPopUp) + depth -= 2; + else + depth--; + + if (depth == 0) + curMenuItemId++; + + lastPopUp = lastPopUpCopy; + lastPopUpCopy = false; } } } |