Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork630
Description
I hope we will be able to start using ImGui so we can focus on our features rather than how we draw console outputs after we separate the loader and console domain stuff into separate dlls, but using C++/CLI with C# files is preventing us from doing this.
Hopefully, I managed to find a way to find line split points for long strings so we can properly draw long outputs as multiple lines. We should cache results ofEND_TEXT_COMMAND_GET_NUMBER_OF_LINES_FOR_STRING though, because it executes a lot of assembly instructions and is considerably expensive. In my PC, that native took 150 us for a string with about 700 ASCII characters, whileEncoding.GetBytes took only 1 to 1.5 us onEncoding.UTF8 for the same string. You might ask when to invaridate cache of line count results, and I would say when the screen resolution gets changed.
We should do this before releasing v3.7.0, since I'd like to properly show that deprecated API warning properly.
A method for line count...
privateuintGetLineCount(stringstr,floatx,floaty){Function.Call(Hash.BEGIN_TEXT_COMMAND_GET_NUMBER_OF_LINES_FOR_STRING,"CELL_EMAIL_BCON");PushLongString(str);returnFunction.Call<uint>(Hash.END_TEXT_COMMAND_GET_NUMBER_OF_LINES_FOR_STRING,x,y);}
A method for finding the split point/index for a specific line...
boolFindLineSplitPoint(stringstr,uinttargetLineNum,floatx,floaty,outintfoundPos){if(targetLineNum==0||string.IsNullOrEmpty(str)){foundPos=-1;returnfalse;}intstrLength=str.Length;intlow=-1;inthigh=strLength;while((high-low)>1){intmid=low+(high-low)/2;if(GetLineCount(str.Substring(0,(int)mid),x,y)>=targetLineNum+1){high=mid;}else{low=mid;}}foundPos=high;return(foundPos>=0&&foundPos<strLength);}