Jief_Machak Posted March 3, 2020 Author Share Posted March 3, 2020 You were already trying the enum way :-)... Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710834 Share on other sites More sharing options...
Slice Posted March 3, 2020 Share Posted March 3, 2020 now I will commit conflicting sources Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710835 Share on other sites More sharing options...
Jief_Machak Posted March 3, 2020 Author Share Posted March 3, 2020 That's ok, I can resolve them. But don't commit in the meantime. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710836 Share on other sites More sharing options...
Jief_Machak Posted March 3, 2020 Author Share Posted March 3, 2020 Done. It's compiling, but there is unresolved external. Can have a look later, if you'd like. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710843 Share on other sites More sharing options...
Jief_Machak Posted March 3, 2020 Author Share Posted March 3, 2020 I fixed the unresolved. Mainly, it was because when you move a function in a class (becoming a method), you forgot to remove the old prototype in .h Well, I don't have unresolved external when I compile with Eclipse. But I have some when I compile with ebuild. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710907 Share on other sites More sharing options...
Jief_Machak Posted March 3, 2020 Author Share Posted March 3, 2020 Ok, I understood. You excluded pointer.cpp, which is not used anymore. I was still compiling with it. I had to pull out of XPointer the function TimeDiff because it's used by screen.cpp outside a XPointer. Anyway, it doesn't really make sense to define a method that doesn't use any member of the class it's define in. TimeDiff is more a basic tool (or platform tool?) that could be defined in a file (Platform.cpp, or ?) and included in Platform.h. Like StrCmp, StrCpy etc. Because Platform may already be too big, we can start a .cpp/.h files named something like BasicTools, PlatformTools, LowlevelTools, CUtils... Platform.h would include that new header. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710910 Share on other sites More sharing options...
Slice Posted March 3, 2020 Share Posted March 3, 2020 I was working parallel to you and resolved most of this issues. I committed them. I got full compilation and linking with GCC53. Tomorrow will check with VS. Now I think we can switch from char16 and EG_IMAGE to XStringW and XImage. I will revise theme support. It looks like to be a separate class. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710912 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 You removed const on " CHAR16 *Title; //Title is not const. It can be dynamically changed" in REFIT_MENU_SCREEN. const CHAR16* Title doesn't mean you can't change the title. const only apply to the pointee, not the pointer. So you can still change where Title point. In fact, I put "const" back and it's compiling fine, without warning. I agree, changing to XStringW will end the discussion :-) Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710938 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 The crash is at if (MainEntry.getLEGACY_ENTRY()) { Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710939 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 I changed " Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));" by "// Entry = new LOADER_ENTRY();" and now it's back to AllocateZeroPool. It's not possible to use AllocateZeroPool with objects that has a vtable (some virtual function). Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710942 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 git push? Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710943 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 Yes, in a minute. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710944 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 Sorry, forgot to say it's done. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710966 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 I see. Now I am testing VS compilation. It's a pity there are memset generation at new LOADER_ENTRY(); new LEGACY_ENTRY(); new REFIT_MENU_ENTRY_LOADER_TOOL(); new REFIT_MENU_ENTRY_CLOVER(); Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710969 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 What do you mean by memset generation ? I forgot the () ? Should work the same because it's an object with ctor. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710971 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 27 minutes ago, Jief_Machak said: What do you mean by memset generation ? I forgot the () ? Should work the same because it's an object with ctor. I see linker warnings and disassembler ; 153 : DuplicateEntry = new LOADER_ENTRY(); 00020 b9 e8 00 00 00 mov ecx, 232 ; 000000e8H 00025 e8 00 00 00 00 call ??2@YAPEAX_K@Z ; operator new 0002a 48 8b d8 mov rbx, rax 0002d 48 85 c0 test rax, rax 00030 74 45 je SHORT $LN5@DuplicateL 00032 33 d2 xor edx, edx 00034 41 b8 e8 00 00 00 mov r8d, 232 ; 000000e8H 0003a 48 8b c8 mov rcx, rax 0003d e8 00 00 00 00 call memset 00042 0f 57 c0 xorps xmm0, xmm0 Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710975 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 4 hours ago, Slice said: The crash is at if (MainEntry.getLEGACY_ENTRY()) { Windows QEMU with VS compilation crashes exactly at the same place. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710978 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 3 minutes ago, Slice said: Windows QEMU with VS compilation crashes exactly at the same place. You remember that C++ globals still don't work with VS. Some menu and menuitem are globals. Indeed, I'm currently preparing to have a look now. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710980 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 I'm wondering : you should have "A test failed". Did you have it ? Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710983 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 1 minute ago, Jief_Machak said: I'm wondering : you should have "A test failed". Did you have it ? Yes, with VS "a test failed". Anyway the crash Quote The crash is at if (MainEntry.getLEGACY_ENTRY()) { happen in macOS with GCC53 compilation. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710985 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 The problem is REFIT_ABSTRACT_MENU_ENTRY is not REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER required for virtualization. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2710992 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 If I make this // Ignore this loader if it's device path is already present in another loader // if (MainMenu.Entries) { DBG("Entries=%d\n", MainMenu.Entries.size()); for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) { REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i]; DBG("entry %lld %a\n", i, (MainEntry.SubScreen == nullptr)?"empty":"full"); // Only want legacy // if (MainEntry && (MainEntry->getLEGACY_ENTRY())) { if (MainEntry.isLegacy) { DBG("a1\n"); REFIT_MENU_ENTRY& M1 = reinterpret_cast<REFIT_MENU_ENTRY&>(MainEntry); DBG("a10\n"); REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER& M2 = reinterpret_cast<REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER&>(M1); DBG("a11\n"); LEGACY_ENTRY& M3 = reinterpret_cast<LEGACY_ENTRY&>(M2); DBG("a12\n"); if (StriCmp(M3.DevicePathString, Volume->DevicePathString) == 0) { DBG("a13\n"); return true; } } } // } Then it somehow works And then I got a stop at Anime which is an another story. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2711003 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 MainEntry->getLEGACY_ENTRY() is perfectly valid for all menu item. Please wait instead modifying too much. I'm on it and I use GDB, which is easier to find these problem. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2711004 Share on other sites More sharing options...
Jief_Machak Posted March 4, 2020 Author Share Posted March 4, 2020 You just put back again the "AllocateZeroPool" for allocating objects !!! Please don't : it CAN'T work for objects with virtual method. Of course it crashed. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2711006 Share on other sites More sharing options...
Slice Posted March 4, 2020 Share Posted March 4, 2020 I will stash my codes. I think there is something like wrong virtual table. Link to comment https://www.insanelymac.com/forum/topic/341986-c-proposition/page/11/#findComment-2711007 Share on other sites More sharing options...
Recommended Posts