Important information: this site is currently scheduled to go offline indefinitely by December 1st 2023.
If you wish to donate to attempt the preservation of tools and software somewhere else before it goes down, check the GoFundMe

Touhou Koumajou Densetsu

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Post Reply
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 864 times

Touhou Koumajou Densetsu

Post by finale00 »

The contents of this post was deleted because of possible forum rules violation.
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 312 times

Re: Touhou Koumajou Densetsu

Post by WRS »

bit of searching would have taken you to : http://asmodean.reverse.net/

i ported the method to bms for you though:

Code: Select all

idstring "DPMX"
get dataOffset long
get files long
get dummy long

for i = 0 < files

  getdstring name 16
  get dummy long		# -1

  get seed_0 byte
  get seed_1 byte
  get seed_2 byte
  get seed_3 byte

  get offset long
  math offset += dataOffset	#offset relative to the start of data section
  get size long

  log MEMORY_FILE offset size
  callfunction unobfuscate
  log name 0 size MEMORY_FILE

next i

cleanexit

# ported to bms by WRS

# source: http://asmodean.reverse.net/misc/_/exdpmx.zip
# exdpmx.cpp
# coded by asmodean

startfunction unobfuscate

  set SEED2 byte 0xAA
  set SEED3 byte 0x55

  set SEED1 byte seed_0
  math SEED1 += SEED3	# 55
  math SEED1 ^= seed_2

  set SEED4 byte seed_1
  math SEED4 += SEED2	# AA
  math SEED4 ^= seed_3

  set MUT1 byte SEED1
  math MUT1 += SEED2

  set MUT2 byte SEED3
  math MUT2 += SEED4

  set KEY byte 0
  
  for i = 0 < size

    getvarchr BUFF MEMORY_FILE i

    math BUFF -= MUT2
    math BUFF ^= MUT1
    math KEY += BUFF

    putvarchr MEMORY_FILE i KEY

  next i

endfunction
Useful tool links:
Post Reply