Slice Posted February 21, 2020 Share Posted February 21, 2020 If your script will work for me then I will no more change it. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 21, 2020 Author Share Posted February 21, 2020 3 hours ago, apianti said: Because the script was changed edksetup wasn't changed much. And only some default are hard coded. This round bracket problem is there since the beginning... Strange... Link to comment Share on other sites More sharing options...
apianti Posted February 21, 2020 Share Posted February 21, 2020 (edited) No... The cbuild.bat script worked perfectly fine before, I wrote it and used it since like 2012. At some point though, someone else changed it to hard code paths that just needed to be defined in the environment like edk2 requires, but also does a bunch of stupid non-sense and it has been broken since then. I have several times tried to fix it back and then after a while it will be changed back to incorrect. So I gave up. I still have to edit the script because of the hard codes, I don't have my stuff there, and I already have those defined, so why overwrite them? Should not even set them because you get an error about each one not being set, the error it gives otherwise is a lot harder to figure out it is wrong path. I did not include any paths with a space, also definitely know that you need to write ^( and ^) if you want parentheses to work in a command.... EDIT: Also, I think that the call keywords were removed, which actually is what causes that problem. Batch scripts should call other batch scripts. Edited February 21, 2020 by apianti Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 23, 2020 Author Share Posted February 23, 2020 I've committed a XArray and a XObjArray. Basically a vector-like object for native type and another for Objects. I also create a basic "unit test" system to be sure all these new C++ classes work as expected. There is not a lot of tests in there yet. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 23, 2020 Author Share Posted February 23, 2020 Ok, I've added a XStringWArray. It's based an XObjArray. It's an array of XStringW with some methods added. I remember to have used this specialisation a lot. Will see if it can be of some use in CLover. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 24, 2020 Author Share Posted February 24, 2020 XStringW is improved : it can be construct from const char*. SPrintf now works. SPrintf now takes const char* as format parameter. Having format as wide string was useless and takes more space. 1 Link to comment Share on other sites More sharing options...
Slice Posted February 24, 2020 Share Posted February 24, 2020 Sorry, you forgot to commit pritf_lite.* commiting softlink instead. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 24, 2020 Author Share Posted February 24, 2020 I would have sworn that git follows symlinks. I was obviously wrong ! Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 24, 2020 Author Share Posted February 24, 2020 By the way. The "printf" version embedded in XString use %s for ascii (utf8) and %ls for wide string. Currently, we have %a and %s. The good point of switching to the usual, is that the compiler checks the argument when you give a litteral as format, which is really nice. Each time we use XStringW.SPrintf(), we have to remember to use %s instead of %a and %ls instead of %s. But again, if we forgot, the compiler will tell us ! :-) Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 25, 2020 Author Share Posted February 25, 2020 I see you're working on an Image object ! Good. May I advise to avoid non-const reference parameter ? For example "void XImage::Compose(XImage& LowImage, XImage& TopImage, int PosX, int PosY, bool Lowest)" should probably be "void XImage::Compose(const XImage& LowImage, const XImage& TopImage, int PosX, int PosY, bool Lowest)". In case you need to modify an object you got from a parameter, use a pointer. So why is that ? Reason is simple, when you'll write code that call this method, for example "img.Compose(low, top, x, y)", you won't expect Compose to be able to change the content of low and top. But if you had to write this "img.Compose(&low, &top, x, y)" you know straight away that low and top are out parameter (or in/out). As a rule of thumb : never ever use non-const reference as parameter. It's confusing when you write code that calls it. Link to comment Share on other sites More sharing options...
Slice Posted February 25, 2020 Share Posted February 25, 2020 Yes, I will use const for IN parameters. Next step will be create class XRefitEntry; class XLoaderEntry: XRefitEntry; We also should avoid global variable. All variables and structures must be defined in main procedure and be transmitted to other functions through arguments. A proposition for Code Style: use TWo capital letter in the name of class. I know this is huge work... For those who want to compile fresh Clover I want to say there is nothing new in functionality up to some time. Use release. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 25, 2020 Author Share Posted February 25, 2020 I agree with globals. They are quickly a mess. Also, what we can do is : A "setting/setup/conf" object. This "settings" object might the only global. Then every one will ask that object when a setting is needed. This setting will take care of reading config.plist as well as discovering the OEM path, list all plist present in the kext folder, etc. Link to comment Share on other sites More sharing options...
Slice Posted February 25, 2020 Share Posted February 25, 2020 But I don't know what is mean error: passing 'const XImage' as 'this' argument discards qualifiers [-fpermissive] Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 25, 2020 Author Share Posted February 25, 2020 You have to pass a "const XImage&", not a "const XImage" For class name, I realise that the X in front come from a time where there was name conflict. I just added an X for eXtended, although it wasn't really an extension but a rewriting. We can easily decide to remove the X. String, Array, Image would work too. A while ago, Microsoft used C as a class name prefix. Cocoa use NS. Maybe we should use C (CString, CArray, CImage) which means Class but also CLover :-). Or use just X as it is... Link to comment Share on other sites More sharing options...
Slice Posted February 25, 2020 Share Posted February 25, 2020 Sure, there is const XImage& Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 25, 2020 Author Share Posted February 25, 2020 (edited) "error: passing 'const XImage' as 'this' argument discards qualifiers" so it should be that you're trying to call a method that is not declare const. To declare a const method, just add const after. Ex : void XIMage::toto() const { bla bla }; When you are in a const method, compiler will prevent you to modify yourself, which enforce the const mechanism. I love the const mechanism because it forces us to use a better design. Could be seems as annoying at first, but so good to be guaranteed that an object you send to a method won't be modified. Edited February 25, 2020 by Jief_Machak Link to comment Share on other sites More sharing options...
Slice Posted February 25, 2020 Share Posted February 25, 2020 I committed my current sources for you to revise. It can be compiled without "const". Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 25, 2020 Author Share Posted February 25, 2020 I've added const. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 25, 2020 Author Share Posted February 25, 2020 Have a look at my proposition for XImage. I use an XArray instead of manual allocation. I create a getPixel method and used it in Compose. 1 Link to comment Share on other sites More sharing options...
Slice Posted February 26, 2020 Share Posted February 26, 2020 So XArray<T> will be replacement for std::vector<T>? Thanks for XImage revision. I will continue the work this way. Old Clover sources came from refit long needed to be clean. Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 26, 2020 Author Share Posted February 26, 2020 Yes, XArray is my version of vector. I was working with a C++ that had no STL (that was some time ago :-). I just felt the need to replace C std array by something that checks index and free me for handle allocation and reallocation, to catch the 2 biggest problems : accessing unallocated memory and memory leaks ! Link to comment Share on other sites More sharing options...
Slice Posted February 26, 2020 Share Posted February 26, 2020 11 hours ago, Jief_Machak said: I agree with globals. They are quickly a mess. Also, what we can do is : A "setting/setup/conf" object. This "settings" object might the only global. Then every one will ask that object when a setting is needed. This setting will take care of reading config.plist as well as discovering the OEM path, list all plist present in the kext folder, etc. In theory there must be class CApplication; containing all settings/config etc. Then main program CApplication CloverGUI; CloverGUI.Run(); Function GetUserSettings() will be a member of the class and so on. Some more investigation required. I don't know yet how to call default destructors before calling boot.efi. Something like CloverGUI.Finish(); after OnExitBootServices. Do we have emit(signal)? Link to comment Share on other sites More sharing options...
Slice Posted February 26, 2020 Share Posted February 26, 2020 Hang between DBG ("stringlength = %d\n", device_inject_stringlength); and MsgLog ("CurrentMode: Width=%d Height=%d\n", UGAWidth, UGAHeight); There are many FreePool(ptr) which may hang if ptr is not valid pointer. It was working before C++. Where is the influence? Link to comment Share on other sites More sharing options...
Sherlocks Posted February 26, 2020 Share Posted February 26, 2020 (edited) i'm finished latest clover build. but i'm always getting black screen after enter mac disk. i'm using buildme with xcode8 option and xcode 11 beta. is it right? in last official release(https://github.com/CloverHackyColor/CloverBootloader/releases), there is no problem. Edited February 26, 2020 by Sherlocks 1 1 Link to comment Share on other sites More sharing options...
Jief_Machak Posted February 26, 2020 Author Share Posted February 26, 2020 I'm updating compiling and run and I'll tell you. Link to comment Share on other sites More sharing options...
Recommended Posts