0 Members and 1 Guest are viewing this topic.
Hey Omnimaga Community,is it possible to change a type 5 program into a type 6 to lock the program code, just with a Getcalc("prgmLOCKME")→P pointer?External levels in my actual project will be stored and loaded as program data and it isnt looking nice if you can view the code in the TI Basic IDE of the TI OS.Regards,Aichi
:.ASHELL:"000000000"→Str1:"prgmASHELL"→Str2:"UnrealShell"→Str3:[F88C8EB2AAB2A2FEF88C8E92AABAAAFE]→Pic1:[3844447C6C446C7C]→Pic2:[44AACEAA0050A88844AAECAA60808060]→Pic3:DiagnosticOff:Fix 5:{E9830}r→θ:{E982E}r→Z:{GetCalc(Str2)-2}r→R:sub(LP) // Sub that loads the locations of all programs in the memory into a list:0→P→X→Y::::While 1 // This is the main loop i used for selecting programs, no need for you to worry much about this =P:sub(DP) //Just draws the program names and icons. You might want to look at this one to find where program info is relative to the start =P:3→W:sub(IC):P→Q:While P=Q:X→W:Y→Z:If getKey(15):Goto FN:End::If getKey(51) // Archive/unarchive toggle:{Y*2+X+(P*8)+1*2+L2}r→A:If {A}∙E001F=21:21→{Str1}:Else:5→{Str1}:End:A-7→A:For(B,0,{A+1}-1:{A-B}→{B+1+Str1}:End:0→{B+2+Str1}:If {A+2}:UnarchiveStr1:Else:ArchiveStr1:End:3→W:sub(DP):End::If getKey(52) // Lock/unlock toggle:{Y*2+X+(P*8)+1*2+L2}r→A:If {A}∙E001F=6:5→{A}:Else:6→{A}:End:3→W:sub(DP):End::If getKey(53) // Appvar/program switch:{Y*2+X+(P*8)+1*2+L2}r→A:If {A}∙E001F=21:5→{A}:Else:21→{A}:End:3→W:sub(DP):End::P-getKey(11)+getKey(10)→P:P=65535-(G=P)+P→P:X-getKey(2)+getKey(3)→X:Y-getKey(4)+getKey(1)→Y:X=65535*2-(X=2*2)+X→X:Y=65535*4-(Y=4*4)+Y→Y:!If X=W*(Y=Z):sub(IC):End:End:End::::Lbl LP:2→B:Repeat θ≤Z:If getKey(15):Goto FN:End:{θ}∙E001F→A:If A=5+(A=6)+(A=21):θ→{L2+B}r:B+2→B:End:θ-6→θ:θ-{θ}-1→θ:End:B-2→{L2}r:B/2/8+1→G:Return::::Lbl DP:0→B→A→C:ClrDraw:Repeat B=4+(P*16+C≥{L2}r):{P*16+C+L2+2}r→θ:{θ}∙E001F→H:Pt-Off(A*40+2,B*16,Pic1):Pt-Off(A*40+20,B*16,Pic3):If H=21:Pt-Off(A*40+2,B*16,Pic1+8):End:If {θ-5}:Pt-Off(A*40+20,B*16,Pic3+8):End:If H=6:Pt-Off(A*40+11,B*16,Pic2):End:θ-6→θ:{θ}→H:0→J:For(D,0,H-1):θ-1→θ:Text(J+(A*40)+2,B*16+9,{θ}►Frac):J+4→J:If {θ}=105:J-2→J:End:If {θ}=108+({θ}=115)+({θ}=116):J-1→J:End:If {θ}=122:J+1→J:End:End:A+1→A:If A=2:0→A:B+1→B:End:C+2→C:End:{E9828}r-{E9824}r+R→E:89→A:0→B:For(J,1,5):0→F:Repeat E/10*10=(E-F):F+1→F:End:Text(A,B,F►Dec:sub(ST):E/10→E:B+4→B:End:80→A:0→B:Fix 1:For(J,0,10):Text(A,B,{10-J+Str3}►Frac:sub(LT):B+6→B:End:Fix 0:DispGraph:Return::::Lbl IC:For(A,0,15):Pxl-Change(X*40,Y*16+A):Pxl-Change(W*40,Z*16+A):End:For(A,1,39):For(B,0,1):Pxl-Change(X*40+A,Y*16+8+B):Pxl-Change(W*40+A,Z*16+8+B):End:End:DispGraph:Return::::Lbl ST:For(C,0,3):For(D,0,5):pxl-Test(C+A,D+B)→{D*4+C+L1}:Pxl-Off(C+A,D+B):End:End:For(C,0,3):For(D,0,5):If {D*4+C+L1}:Pxl-On(D+A,3-C+B):End:End:End:Return:::Lbl LT:For(C,0,5):For(D,0,7):pxl-Test(C+A,D+B)→{D*6+C+L1}:Pxl-Off(C+A,D+B):End:End:For(C,0,5):For(D,0,7):If {D*6+C+L1}:Pxl-On(D+A,3-C+B):End:End:End:Return::::Lbl FN:Fix 4:ClrDraw:ClrHome
"MONLEVEL"→Str1 // The name of our program, in reverse order (Remember? The vat is backwards.){E9830}r→θ // The location where the vat starts stored as a variable for easy manipulation. (This is actually the end, but remember?...){E982E}r→Z // The end of the vat. (This is actually... Meh, you get the point :P)0→C // C Will be our condition of whether or not the program was foundRepeat θ≤Z+C // Loops until the end of the vat is found or your program is found.If getKey(15):Return:End // Umm, if I screwed up or something... Normally I include this in loops like this so I can just quit by pressing Enter if something happens.{θ}∙E001F→A // Puts the value of the lower 4 bits of the object type into A for testing.If A=5+(A=6) //If its a locked or unlocked program... Yay! See if it's the one we want!θ→T // Temporary storage FTW!{T-6}→U // Go to where the name length is (6 bytes back from the type, where T currently is) and store the value there to UWhile U>0 // Check each byte of the name{Str1-U}={T-U-6}+C→C //If byte X of the name is equal to byte X of the vat entry...U-1→U //Go to the next character!EndC=U→C // If every character matched, then good! C now reflects that a program was found!Endθ-6→θ // Go to where the name length is (6 bytes back from the type, where θ currently is)θ-{θ}-1→θ // Skip past the name now that we know the length, and one additional byte to start the next entry.End(I'm just assuming your program was found, not that the end of the vat was reached. You can add more code to check for that if y{T}-5{T}-5=0+5→{T} // Umm... Inverts the lock/unlockness of your program?6→{T} // Or youc ocould just lock it, if no toggling is neccessary ;P
.VAT2STR"appv"->Str9. P is the pointer to the entry start (or rather the end of the entry :) ). Now I have to redefine the lenght of Str9{P-6}+1->lenght(Str9) . How is this feasible? <.<For(X,1,{P-6}){P-7-X}->{Str9+X} . Not sure wether it works by using this wayEndGetcalc(Str9)->AFix 5Text(1,1,Str9)Fix4Return
For(X,1,{P-6}+1)Text(X*4 , 0 , {P-7-X}<CharEnd