Difference between revisions of "NPA"

From Game Research Wiki
Jump to navigation Jump to search
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Archives]]
[[Category:Archives]]
Used in the following game(s):
Used in the following game(s):
* Demonbane
* Demonbane
* Steins;Gate
* Steins;Gate
May be more than one version and possibly using one or more methods for obstructing data.


== Structure ==
== Structure ==
{| class="wikitable"
{| class="wikitable"
!colspan="15"|WIP
!colspan="15"| Overall
|-
|-
! Size !! Content !! Description
! Size !! Content !! Description
Line 15: Line 12:
| 4 Bytes || Index Size ||  
| 4 Bytes || Index Size ||  
|-
|-
| ? Bytes || Index Data ||
| x Bytes || Index Data (protected) ||
|-
| x Bytes || File Data (protected) ||
|}
 
{| class="wikitable"
!colspan="15"| Index Header
|-
! Size !! Content !! Description
|-
| 4 Bytes || File count || Number of index entries
|-
!colspan="15"| Index Entry
|-
| 4 Bytes || Filename Length ||
|-
| ? Bytes || Filename || Each character is 2 bytes
|-
| 4 Bytes || File Size ||
|-
| 4 Bytes || Offset ||
|-
| 4 Bytes || Unknown || Always 0x00000000
|}
 
== Addition Notes ==
This format obscures the data it stores. Both the index and data are protected in the same way. The first data read is 4 bytes at the start of the file. This is the size of the index and it's value is not obscured. Next the full index is read into memory and decoded by XOR'ing it by the key. Once the index is processed, data can be loaded but the data is protected the same way the index is, XOR'ed by a key. The game makes use of the XMM registers (SSE) and the assembly code ends up being a small, tight loop with just a few assembly instructions such as MOVDQA and PXOR. Unsure what the C++ equivalent would be. Probably uses some libraries I'm not used to but if I can find those, compile a sample program and disassemble it, might be able to make a more optimized program. Although for a extractor/packing program, speed or efficiency is more or less irrelevant baring extreme cases.
 
{| class="wikitable"
|-
! Key !! Game(s)
|-
| BD AA BC B4 AB B6 BC B4 || Steins;Gate (JAST USA)
 
|}
|}


== Research ==
*Only one game has been tested so it is an assumption that there can be different keys thus a list of specific games and the key they used will be recorded here.
The index data is protected. The way the program reads and processes this space is by first loading 4 bytes at the start of the file that is the size of the protected index. It then loads the whole index into memory. It then puts some data into the XMM0 register, which looks like the key. So far, it looks like it's static but I'll have to check if that's true for other files. It then enters the main decoding loop and loads 16 bytes into the next register, XMM1. It then XOR XMM1 by XMM0. It then puts the decoded part back into memory.


Some notes about structure. File names appear to be 2 byte char strings (wstrings?).
== Tools ==
Coming soon...

Latest revision as of 16:58, 12 September 2019

Used in the following game(s):

  • Demonbane
  • Steins;Gate

Structure

Overall
Size Content Description
4 Bytes Index Size
x Bytes Index Data (protected)
x Bytes File Data (protected)
Index Header
Size Content Description
4 Bytes File count Number of index entries
Index Entry
4 Bytes Filename Length
? Bytes Filename Each character is 2 bytes
4 Bytes File Size
4 Bytes Offset
4 Bytes Unknown Always 0x00000000

Addition Notes

This format obscures the data it stores. Both the index and data are protected in the same way. The first data read is 4 bytes at the start of the file. This is the size of the index and it's value is not obscured. Next the full index is read into memory and decoded by XOR'ing it by the key. Once the index is processed, data can be loaded but the data is protected the same way the index is, XOR'ed by a key. The game makes use of the XMM registers (SSE) and the assembly code ends up being a small, tight loop with just a few assembly instructions such as MOVDQA and PXOR. Unsure what the C++ equivalent would be. Probably uses some libraries I'm not used to but if I can find those, compile a sample program and disassemble it, might be able to make a more optimized program. Although for a extractor/packing program, speed or efficiency is more or less irrelevant baring extreme cases.

Key Game(s)
BD AA BC B4 AB B6 BC B4 Steins;Gate (JAST USA)
  • Only one game has been tested so it is an assumption that there can be different keys thus a list of specific games and the key they used will be recorded here.

Tools

Coming soon...