Jump to content

C++ proposition


Jief_Machak
 Share

823 posts in this topic

Recommended Posts

I think we can move 

REFIT_MENU_SCREEN MainMenu(1, L"Main Menu", L"Automatic boot");

REFIT_MENU_SCREEN AboutMenu(2, L"About", NULL);

REFIT_MENU_SCREEN HelpMenu(3, L"Help", NULL);

into RefitMain local variables. They attached to main menu created here.

Link to comment
Share on other sites

I made some legacy entries.

I add this at the end ScanVolumeBootcode :

*Bootable = TRUE;
Volume->HasBootCode = TRUE;
Volume->LegacyOS->IconName = L"win";
Volume->LegacyOS->Name = L"Windows";
Volume->LegacyOS->Type = OSTYPE_WIN;
Volume->BootType = BOOTING_BY_PBR;

so I got "fake" legacy entries, and it's still working.

Screen Shot 2020-03-04 at 21.31.22.png

Did you try a recompile from scratch. EDK build system is not great and it happened to me to have some old objects link with new code.

Link to comment
Share on other sites

8 hours ago, Slice said:

The problem is

REFIT_ABSTRACT_MENU_ENTRY is not REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER required for virtualization.

You can call, for example "getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()" on any item, regardless of the object you have.

Because method are "virtual", even upcasted to "REFIT_ABSTRACT_MENU_ENTRY", the subclassed method will be call : the furthest down the hierarchy. So, if the item is a "REFIT_ABSTRACT_MENU_ENTRY" or one of its subclass, the method that return this is called. If it's not a "REFIT_ABSTRACT_MENU_ENTRY", the method at the top level will be called. They all return NULL.

 

That's why it wasn't a problem of memory allocated size. For this mechanism to work, some extra memory must be allocated. "new" do it, AllocatePool does not. The result is an uninitialised vtable. vtable is a table of pointer to function. Uninitialised means crash as soon as you call a virtual method.

 

 

Link to comment
Share on other sites

49 minutes ago, Jief_Machak said:

Anything in your config.plist that trigger the bug ? Could you send it to me ?

Nothing interesting

There is FreeDOS image that I can boot by legacy Clover.

There is my config.plist.

there is my command line to start QEMU

qemu -L ~/Desktop/QEMU-Clover/QEMU -m 2048 -cpu core2duo -bios bios.bin  -machine q35 -device ahci,id=ahi -drive format=raw,id=hda,file=/Users/sergey/Desktop/QEMU-Clover/QEMU-test2.img -drive format=raw,id=hdc,file=/Users/sergey/Desktop/QEMU-Clover/freedos.img -usb -device usb-mouse,bus=usb-bus.0,port=2 -device usb-kbd,bus=usb-bus.0,port=1 -serial stdio

But main volume is too large to attach here.

 

config.plist.zip

freedos.img.7z

The bug reproduced on three computers since yesterday evening up to now.

Link to comment
Share on other sites

Line 77, there was "PointerImage = NULL;". In fact, that call the XImage ctor "XImage(EG_IMAGE* egImage)" with NULL as parameter. 

That was a crash.

 

The funny thing is, when I exec in my VM, I can't trace the execution and the exception is not raised. I could see in my debugger that "Width = egImage->Width" with egImage==NULL return 0 !!!

 

THat's why it looks like it worked.

There was a typo. Please pull from git.

Link to comment
Share on other sites

The crash happen between 8 and 81

    DBG("DMME 8\n");
    BadgeImageL = Entry->getBadgeImage();
    DBG("DMME 81\n");

It will be good to switch to XImage and then find next bugs.

Link to comment
Share on other sites

30 minutes ago, Jief_Machak said:

Ok, qemu is running, can't see the debug log.

Where is that line "BadgeImageL = Entry->getBadgeImage();" ? I don't have it ??

I wrote it for debug purpose. Now there is 

  if (Entry->Row == 0) {
    BadgeImage = Entry->getBadgeImage();
  } //else null

in VOID DrawMainMenuEntry(...)

I committed some changes

Link to comment
Share on other sites

I don't understand this check :

  if (Entry->Row == 0) {
    BadgeImage = Entry->getBadgeImage();
  } //else null

I'd say at this time the logic is : if there is a badge image, draw it.

It's when the menu is created that we decide if an entry would have a badge image or not...

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...