| 187 | | text = retrieve_object("/#WINDOWS") |
| 188 | | num_entries, entry_size = text.unpack("VV") |
| 189 | | |
| 190 | | return if num_entries < 1 |
| 191 | | |
| 192 | | text = retrieve_object("/#WINDOWS", 8, entry_size) |
| 193 | | return if text.length < entry_size |
| 194 | | |
| 195 | | toc_index, idx_index, dft_index = text.unpack("V3") |
| 196 | | |
| 197 | | text = retrieve_object("/#STRINGS") |
| 198 | | |
| 199 | | unless @topics |
| 200 | | @topics = text[toc_index..-1].unpack("Z*") |
| 201 | | @topics = "/#{@topics}" unless @topics[0] == ?/ |
| 202 | | end |
| 203 | | |
| 204 | | unless @index |
| 205 | | @index = text[tdx_index..-1].unpack("Z*") |
| 206 | | @index = "/#{@index}" unless @index[0] == ?/ |
| 207 | | end |
| 208 | | |
| 209 | | unless dft_index == 0 |
| 210 | | @home = text[dft_index..-1].unpack("Z*") |
| 211 | | @home = "/#{@home}" unless @home[0] == ?/ |
| 212 | | end |
| | 187 | # logic from Chmox |
| | 188 | windowsData = retrieve_object("/#WINDOWS") |
| | 189 | stringsData = retrieve_object("/#STRINGS") |
| | 190 | |
| | 191 | if !windowsData.empty? && !stringsData.empty? |
| | 192 | entryCount, entrySize = windowsData.unpack("VV") |
| | 193 | #p "Entries: %d x %d bytes" % [entryCount, entrySize] |
| | 194 | |
| | 195 | entryIndex = 0 |
| | 196 | while entryIndex < entryCount |
| | 197 | entryOffset = 8 + ( entryIndex * entrySize ); |
| | 198 | |
| | 199 | #_title = readTrimmedString( stringsData, readLong( windowsData, entryOffset + 0x14 ) ); |
| | 200 | toc_index, idx_index, dft_index = windowsData[entryOffset+0x60,12].unpack("V3") |
| | 201 | @topics = stringsData[toc_index..-1].unpack("Z*")[0] if @topics.nil? || @topics.empty? |
| | 202 | @index = stringsData[idx_index..-1].unpack("Z*")[0] if @index.nil? || @index.empty? |
| | 203 | @home = stringsData[dft_index..-1].unpack("Z*")[0] if @home.nil? || @home.empty? |
| | 204 | entryIndex += 1 |
| | 205 | end |
| | 206 | end |
| | 207 | @topics = "/#{@topics}" unless @topics[0] == ?/ |
| | 208 | @index = "/#{@index}" unless @index[0] == ?/ |
| | 209 | @home = "/#{@home}" unless @home[0] == ?/ |