# CacheParser CacheParser as the name implies is a record made to parse information from certain files that are part of the game cache. - preferences.dat is where most client settings are stored. - preferences2.dat I have no idea? some values in address 00000020 seem to change after some times has passed randomly. (related to 6h log maybe!?!?) - random.dat in the user home directory seems to be a random identifier generated the first time you open a client if it doesn't exist. while it exists, it seems to never change unless the user deletes it. ```{note} For more information check this file: https://github.com/open-osrs/runelite/blob/dd4478eff7d90fcb3e85584171d5836809eb150a/runescape-client/src/main/java/ClientPreferences.java ``` - - - ## type TCacheParser ```pascal type TCacheParser = record(TSRLBaseRecord) Disabled: Boolean; Directory: String; Preferences: String; Preferences2: String; end; ``` Type responsible for handling cache parsing. - - - ## CacheParser.Setup ```pascal procedure TCacheParser.Setup(); ``` Internal method called automatically simply by including WaspLib. - - - ## CacheParser.GetPreference ```pascal function TCacheParser.GetPreference(prefNumber: Int32 = 1): String; ``` Read the preference file specified. - - - ## CacheParser.Update ```pascal function TCacheParser.Update(): Boolean; ``` Method to check if the cache files were updated. - - - ## CacheParser.GetHexString ```pascal function TCacheParser.GetHexString(prefNumber: Int32 = 1): String; ``` Print the cache files as a hex string. Example: ```pascal WriteLn CacheParser.GetHexString(1); ``` - - - ## CacheParser.Print ```pascal procedure TCacheParser.Print(prefNumber: Int32 = 0); ``` Print the cache files as strings. This is only useful for debugging purposes. Example: ```pascal CacheParser.Print(); ``` - - - ## CacheParser.GetOptionsAmount ```pascal function TCacheParser.GetOptionsAmount(): Int32; ``` Returns the number of options saved in the cache. This is not very useful, AFAIK there's only 2 possible values for this: 0 and 10. 0 is only if you haven't accepted the EULA in the client. Example: ```pascal WriteLn CacheParser.GetOptionsAmount(); ``` - - - ## CacheParser.RoofsHidden ```pascal function TCacheParser.RoofsHidden(): Boolean; ``` Checks if the roofs are hidden. Example: ```pascal WriteLn CacheParser.RoofsHidden(); ``` - - - ## CacheParser.TitleMusicDisabled ```pascal function TCacheParser.TitleMusicDisabled(): Boolean; ``` Checks if the music is enabled in the login screen. Example: ```pascal WriteLn CacheParser.TitleMusicDisabled(); ``` - - - ## CacheParser.WindowMode ```pascal function TCacheParser.WindowMode(): Int32; ``` Returns 1 for fixed mode and 2 for resizable mode. Resizable modern and resizable classic make no difference here. Example: ```pascal WriteLn CacheParser.WindowMode(); ``` - - - ## CacheParser.GetAuthenticatorAmount ```pascal function TCacheParser.GetAuthenticatorAmount(): Int32; ``` Returns the number of authenticators saved for the next 30 days. If this is more than 0, you will have 8 bytes for each of the saved authenticators. This is important to know so we know where the saved username starts if we have saved authenticators. Example: ```pascal WriteLn CacheParser.GetAuthenticatorAmount(); ``` - - - ## CacheParser.GetAuthenticators ```pascal function TCacheParser.GetAuthenticators(): TStringArray; ``` Returns each authenticator saved in a TStringArray. Each string is 8 bytes like mentioned in CacheParser.GetAuthenticatorAmount() documentation. Example: ```pascal WriteLn CacheParser.GetAuthenticators(); ``` - - - ## CacheParser.GetUsernameIndex ```pascal function TCacheParser.GetUsernameIndex(): Int32; ``` Internal function that returns byte index where the username starts. This is required because depending on wether we have authenticators saved or not, the bytes shift. - - - ## CacheParser.GetUsername ```pascal function TCacheParser.GetUsername(): String; ``` Returns the saved username in the game cache. This is the username you clicked to save on the client when logging in. Example: ```pascal WriteLn CacheParser.GetUsername(); ``` - - - ## CacheParser.UsernameEndIndex ```pascal function TCacheParser.UsernameEndIndex(): Int32; ``` Internal function used to get the index of the byte of where the username ends. - - - ## CacheParser.HideUsername ```pascal function TCacheParser.HideUsername(): Boolean; ``` Returns true or false if we have the username hidden. Example: ```pascal WriteLn CacheParser.HideUsername(); ``` - - - ## CacheParser.Brightness ```pascal function TCacheParser.Brightness(): Int32; ``` Returns the brightness value converted to a 0-100 value. Example: ```pascal WriteLn CacheParser.Brightness(); ``` - - - ## CacheParser.MusicVolume ```pascal function TCacheParser.MusicVolume(): Int32; ``` Returns the music volume value converted to a 0-100 value. Example: ```pascal WriteLn CacheParser.MusicVolume(); ``` - - - ## CacheParser.SoundEffectsVolume ```pascal function TCacheParser.SoundEffectsVolume(): Int32; ``` Returns the sound effects volume value converted to a 0-100 value. Example: ```pascal WriteLn CacheParser.SoundEffectsVolume(); ``` - - - ## CacheParser.AreaSoundVolume ```pascal function TCacheParser.AreaSoundVolume(): Int32; ``` Returns the area sound volume value converted to a 0-100 value. Example: ```pascal WriteLn CacheParser.AreaSoundVolume(); ``` - - - ## CacheParser.Field1247 ```pascal function TCacheParser.Field1247(): Int32; ``` I have absolutely no idea what this is. It's supposedly something, but AFAIK it's always 0. Example: ```pascal WriteLn CacheParser.Field1247(); ``` - - - ## CacheParser.DisplayFPS ```pascal function TCacheParser.DisplayFPS(): Boolean; ``` Returns true/false if we have Display FPS enabled. Display FPS can be enabled by typing ::displayfps in game. Example: ```pascal WriteLn CacheParser.DisplayFPS(); ``` - - - ## CacheParser.Field1238 ```pascal function TCacheParser.Field1238(): Int32; ``` I have absolutely no idea what this is. It's supposedly something, but AFAIK it's always 0. Example: ```pascal WriteLn CacheParser.Field1238(); ```