Mk, I'll look into that. And definitely. That's one of the things i'll be working on next...Glad to hear!
Private Sub SaveFile() Handles SaveToolStripButton.Click, SaveToolStripMenuItem.Click
If Not String.IsNullOrEmpty(CurrentFilePath) Then
SaveFileRoutine(CurrentFilePath)
Else
If SaveTIFile.ShowDialog = DialogResult.OK Then
SaveFileRoutine(SaveTIFile.FileName)
UpdateInfo(1) = SaveTIFile.FileName
UpdateInfo(2) = "1"
End If
End If
End Sub
Private Sub SaveAsToolStripMenuItem_Click() Handles SaveAsToolStripMenuItem.Click
If SaveTIFile.ShowDialog = DialogResult.OK Then
SaveFileRoutine(SaveTIFile.FileName)
UpdateInfo(1) = SaveTIFile.FileName
UpdateInfo(2) = "1"
End If
End Sub
Private Function SaveFileRoutine(ByVal FilePath As String)
Dim FileBytes(1048576) As Byte
Dim FileBytesCounter1 As Integer = 0
Dim y As Integer
Dim CurrentByte As String
Dim CurrentString As String = ""
Dim SecondByte As String
Dim TempContents As String = ProgramContents(CurrentFileNumber)
While True
If InStr(TempContents, vbCrLf) Then
TempContents = Mid(TempContents, 1, InStr(TempContents, vbCrLf) - 1) + "{vbCrLf}" + Mid(TempContents, InStr(TempContents, vbCrLf) + 2, TempContents.Length - InStr(TempContents, vbCrLf))
Else
Exit While
End If
End While
For x As Integer = 1 To TempContents.Length
y = 15
SecondByte = ""
CurrentHex = Mid(TempContents, x, y)
CurrentByte = myTITools.TokenToHex(CurrentHex, SecondByte)
While CurrentByte = ""
SecondByte = ""
CurrentHex = Mid(TempContents, x, y)
CurrentByte = myTITools.TokenToHex(CurrentHex, SecondByte)
If y < 1 Then
MsgBox("Invalid Character Detected!" & vbCrLf & """" & CurrentHex & """" & vbCrLf & "is not recognized as a usable token for the TI 83+/84+ Series of calculators.")
FileBytesCounter1 -= 1
GoTo Skip
End If
y -= 1
End While
If SecondByte = "" Then
FileBytes(74 + FileBytesCounter1) = cInteger(CurrentByte)
Else
FileBytes(74 + FileBytesCounter1) = cInteger(CurrentByte)
FileBytes(75 + FileBytesCounter1) = cInteger(SecondByte)
FileBytesCounter1 += 1
End If
Skip:
FileBytesCounter1 += 1
x += y
Next
'**TI83F*
FileBytes(0) = 42
FileBytes(1) = 42
FileBytes(2) = 84
FileBytes(3) = 73
FileBytes(4) = 56
FileBytes(5) = 51
FileBytes(6) = 70
FileBytes(7) = 42
'1A,0A,00
FileBytes(8) = 26
FileBytes(9) = 10
FileBytes(10) = 0
'Comment
FileComment(CurrentFileNumber).PadRight(42)
For x As Integer = 0 To 41
FileBytes(x + 11) = AscW(FileComment(CurrentFileNumber).Chars(x))
Next
'Data Size
If FileBytesCounter1 + 19 > 255 Then
Dim TempHex = cHex(FileBytesCounter1 + 19, 4)
FileBytes(54) = cInteger(Mid(TempHex, 1, 2))
FileBytes(53) = cInteger(Mid(TempHex, 3, 2))
Else
FileBytes(54) = 0
FileBytes(53) = FileBytesCounter1 + 19
End If
'Random Flag (either B or D)
FileBytes(55) = 13
FileBytes(56) = 0
'Variable Size
If FileBytesCounter1 + 2 > 255 Then
Dim TempHex = cHex(FileBytesCounter1 + 2, 4)
FileBytes(58) = cInteger(Mid(TempHex, 1, 2))
FileBytes(57) = cInteger(Mid(TempHex, 3, 2))
Else
FileBytes(58) = 0
FileBytes(57) = FileBytesCounter1 + 2
End If
'Type ID
FileBytes(59) = 5
'Name
FileName(CurrentFileNumber).PadRight(8)
For x As Integer = 0 To 7
FileBytes(60 + x) = AscW(FileName(CurrentFileNumber).Chars(x))
Next
'Version
FileBytes(68) = 0
'Archived
FileBytes(69) = 0
'Variable Size Again
If FileBytesCounter1 + 2 > 255 Then
Dim TempHex = cHex(FileBytesCounter1 + 2, 4)
FileBytes(71) = cInteger(Mid(TempHex, 1, 2))
FileBytes(70) = cInteger(Mid(TempHex, 3, 2))
Else
FileBytes(71) = 0
FileBytes(70) = FileBytesCounter1 + 2
End If
'Total Token Count
If FileBytesCounter1 > 255 Then
Dim TempHex = cHex(FileBytesCounter1, 4)
FileBytes(73) = cInteger(Mid(TempHex, 1, 2))
FileBytes(72) = cInteger(Mid(TempHex, 3, 2))
Else
FileBytes(73) = 0
FileBytes(72) = FileBytesCounter1
End If
'Totals data
Dim Counter = 0
For x As Integer = 0 To FileBytesCounter1 + 19
Counter += FileBytes(x + 55)
Next
'Lower 16 bits of data totalled together
If Hex(Counter).Length > 4 Then Counter = cInteger(Mid(cHex(Counter, 4), cHex(Counter, 4).Length - 4, 4))
If Counter > 255 Then
FileBytes(FileBytesCounter1 + 75) = cInteger(Mid(cHex(Counter, 4), 1, 2))
FileBytes(FileBytesCounter1 + 74) = cInteger(Mid(cHex(Counter, 4), 3, 2))
Else
FileBytes(FileBytesCounter1 + 75) = 0
FileBytes(FileBytesCounter1 + 74) = Counter
End If
Dim FinalBytes(FileBytesCounter1 + 75) As Byte
For x As Integer = 0 To FileBytesCounter1 + 75
FinalBytes(x) = FileBytes(x)
Next
File.WriteAllBytes(FilePath, FinalBytes)
CurrentBytes = FileBytes
End Function
Unhandled exception has occurred in your application. If you click
Continue, the application will ignore this error and attempt to continue. If
you click Quit, the application will close immediatley.
Object reference not set to an instance of an object.
@DJ Omnimaga: CRTL-C/V is implemented...Strange, on my Windows 7 (64 bit) computer it does nothing at all...
While True
If InStr(TempContents, vbCrLf) Then
TempContents = Mid(TempContents, 1, InStr(TempContents, vbCrLf) - 1)
+ "{vbCrLf}" + Mid(TempContents, InStr(TempContents, vbCrLf)
+ 2, TempContents.Length - InStr(TempContents, vbCrLf))
Else
Exit While
End If
End While
The above section, couldn't that be:While InStr(TempContents, vbCrLf)
TempContents = Mid(TempContents, 1, InStr(TempContents, vbCrLf) - 1) + "{vbCrLf}"
+ Mid(TempContents, InStr(TempContents, vbCrLf)
+ 2, TempContents.Length - InStr(TempContents, vbCrLf))
End While
Maybe I have drawn it out of context but i think it is a fair ,albeit small, optimization.99% of tokens are added, only a couple of the "BBxx" tokens and the bold N, since it's not in their font set and I'll need to fix that... Anyways, what I'm saying is they are added...
Hmm, ok it seems that that "o" is one the couple BBxx tokens I didn't add... sorry I misspoke. the "a" is definitely added there as an "a" tho, I don't know why it would be showing "n" (the letters in quotes are the special symbols im to lazy to find to copypasta :P)well, if it's not too much trouble, I really would appreciate it!
@LordConiupiter Sure, but that code might not really work too well (be easy to work with), If you want, I could wrap it into an easy function that you can just copy in if you want...
...Yes, I still need to fix the single if highlighting in regular programs...Yes, I know that's an issue =P
Oh ok I wasn't too sure since a Repeat was involved in the code. But yeah check in the code where it says "If The Game". I never actually wrote that code. It appears in your editor for some reasons. Invalid/unrecognized token?Mission objective completed: easter egg found.
thank you very very very much!It takes an array of bytes which consists of the data you want put into the program, a string which is the eight or less on calc program name, and a string which is a... (either 40 or 42 i can't remember) or less file comment, which is mostly pointless, but can be set anyways... :PSpoiler For Not too much trouble ;D: