Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INDEX_OFFSET_POSITION := 5
- INDEX_OFFSET_LENGTH := 8
- INDEX_LENGTH_POSITION := 14
- INDEX_LENGTH_LENGTH := 4
- GAMESTRING_LENGTH := 359
- PROC getSelection(position:PTR TO INT, linecount:PTR TO INT)
- DEF start = 0:PTR TO INT
- DEF end = 0:PTR TO INT
- DEF totallines = 0:PTR TO INT
- DEF indexlength = NIL:PTR TO CHAR
- DEF indexoffset = NIL:PTR TO CHAR
- DEF allindexstring = NIL:PTR TO CHAR
- DEF allgamestring = NIL:PTR TO CHAR
- DEF gamestring = NIL:PTR TO CHAR
- DEF paddedgamestring = NIL:PTR TO CHAR
- IF (position < 0)
- start := 0
- ELSE
- start := position
- ENDIF
- totallines := self.indexfile.length() / self.indexlinewidth
- IF ((position + linecount) >= totallines)
- end := totallines - position - 1
- ELSE
- end := linecount - 1
- ENDIF
- indexoffset := String(INDEX_OFFSET_LENGTH)
- indexlength := String(INDEX_LENGTH_LENGTH)
- allgamestring := String(GAMESTRING_LENGTH * end)
- self.indexfile.moveFromBeginning(start * self.indexlinewidth)
- allindexstring := self.indexfile.read(end * self.indexlinewidth)
- FOR i := 0 TO end
- IF (gamestring) THEN DisposeLink(gamestring)
- MidStr(indexoffset, allindexstring, INDEX_OFFSET_POSITION + (i * self.indexlinewidth), INDEX_OFFSET_LENGTH)
- MidStr(indexlength, allindexstring, INDEX_LENGTH_POSITION + (i * self.indexlinewidth), INDEX_LENGTH_LENGTH)
- self.masterfile.moveFromBeginning(Val(indexoffset))
- gamestring := self.masterfile.read(Val(indexlength))
- paddedgamestring := strToPaddedGameStr(gamestring)
- StrAdd(allgamestring, paddedgamestring)
- ENDFOR
- ENDPROC gamestring
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement