English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 10 May 2022, 16:55   #1
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
Identify cruncher

Hi there!

Can someone identify the cruncher used for this exe?

scl_superball.lha

It's from 1999, so tools like xfd should recognize it, but they don't. This particular exe only runs on 68030+, so it will unpack, but then check for the CPU and just quit if the check fails.

The cruncher is a relocating one, the last data hunk contains the packed data and that is unpacked and written to the second hunk (BSS) of the file.

The init code looks quite unique, I think. Maybe someone has seen it before?

Thanks,
mnemo

Code:
start:
  bra.s main
  dc.b "some message"

main:
  movem.l a7-d0/d7-d0,-(a7)
  lea start-4(pc),a5 ; pointer to this hunk
  lea GetHunk(pc),a6
  moveq #0,d0
  jsr (a6) ;get the second hunk address
  move.l a4,60(a7) ;put return address on stack
  moveq #1,d0
  jsr (a6) ;get the third hunk address (decruncher)
  jsr (a4) ;run decruncher
  jsr -210(a6)
  jsr -636(a6)
  movem.l (a7)+,a6-a0/d7-d0
  rts ;run program

GetHunk:
  move.l a5,a4
.loop:
  move.l (a4),a4
  add.l a4,a4
  add.l a4,a4
  dbf d0,.loop
  addq.w #4,a4
  rts
mnemo is offline  
Old 10 May 2022, 18:38   #2
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
I dont have access to Amiga to check this, but this code looks for me like modified exe for any data packer. xfd dont recognizes modified exe. If you want to know which packer was used for this file, get part (f.e. 4-6 bytes hex) of depacker and try to find in xfdmaster.library or xfd external decrunchers.
Don_Adan is offline  
Old 10 May 2022, 23:01   #3
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
I tried finding a few bytes in xfdmaster.library, but to no avail. I don't have a tool handy to search hex bytes in all the XFD libs.

The code looks very compact and optimized and it's tightly integrated with the handling of the loaded hunks.

This code fragment seems to detect some settings for the decoder and should be specific enough to be found, but I haven't yet.

Code:
7000 moveq #0,d0
7200 moveq #0,d1
7400 moveq #0,d2
4e93 jsr (a3) ;getbit
6432 bcc.s .found
7200 moveq #0,d1
7402 moveq #2,d2
4e93 jsr (a3)
642a bcc.s .found
7201 moveq #1,d1
7404 moveq #4,d2
4e93 jsr (a3)
6422 bcc.s .found
7201 moveq #1,d1
7408 moveq #8,d2
4e93 jsr (a3)
641a bcc.s .found
a3 points to:
Code:
de07 add.b d7,d7
6604 bne.s .exit
1e20 move.b -(a0),d7
df07 addx.b d7,d7
.exit:
4e75 rts
mnemo is offline  
Old 11 May 2022, 00:24   #4
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
This game was made by former group mates of mine.

I have asked my very own tool which performs some heuristics on the input file and result is this:
Attached Thumbnails
Click image for larger version

Name:	057.png
Views:	221
Size:	10.8 KB
ID:	75561  
StingRay is offline  
Old 11 May 2022, 08:49   #5
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
WOW! Thanks! That's it!

The init routine is the same as in my first post, except for the bra, changed references and message at the beginning. Now I just need to find out how to make Crunch unpack the exe - or do it myself, I think I understand the unpacking now. ;-)
mnemo is offline  
Old 11 May 2022, 10:34   #6
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
Crunch is supported by xfdmaster.library (as external depacker).

http://aminet.net/package/util/pack/xfdmaster
Don_Adan is offline  
Old 11 May 2022, 11:18   #7
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
xfddecrunch says "Not crunched", also Crunch itself says the exe is not crunched.

The crunched data normally seems to have the magic bytes "CRUa" before it, that was changed in the game to "0000 4e75". Changing it to 5352 5561 (CRUa) again makes no difference.

How exactly does xpk detect the packer?
mnemo is offline  
Old 11 May 2022, 11:28   #8
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
Quote:
Originally Posted by mnemo View Post
xfddecrunch says "Not crunched", also Crunch itself says the exe is not crunched.

The crunched data normally seems to have the magic bytes "CRUa" before it, that was changed in the game to "0000 4e75". Changing it to 5352 5561 (CRUa) again makes no difference.

How exactly does xpk detect the packer?
Then You must edit requested bytes to CRUa ID and cut necessary data. I used for similar job FileMaster 2.2.
Every (except some my) xfd depacker has recognition code. You can learn/check some xfd depacker sources code here:

http://wt.exotica.org.uk/others.html
Don_Adan is offline  
Old 11 May 2022, 13:16   #9
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
Thanks. I added the magic bytes, saved the data as a single file and Crunch recognizes and decrunches it, but that's just the code with the relo data as delta values tagged on at the end.
The beginning of the decrunched data is messed up, maybe I need to strip one or two bytes at the end.
mnemo is offline  
Old 11 May 2022, 13:32   #10
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
Just took a look at the XFD Crunch external and it's obvious why it doesn't recognize the exe because there are some very hard coded CMPs at absolute offsets in there.
mnemo is offline  
Old 12 May 2022, 09:17   #11
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
OK, I did everything manually.
1. Load exe in monitor tool (I always use C-Monitor)
2. Create breakpoint before relocation in WinUAE
3. Run exe (unpacks to memory), triggers breakpoint
4. Save code segment and delta relocation table from WinUAE
5. Write small function in asm to convert delta relocation to absolute relocation table
6. Create skeleton exe in Devpac to integrate data into
7. Use monitor tool to load skeleton exe, code segment and relocation table at correct offsets into memory
8. Modify hunk structure to correctly represent the new exe
9. Save it all.
Unpacked exe works on 68030.

Phew!
mnemo is offline  
Old 12 May 2022, 09:20   #12
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
Quote:
Originally Posted by StingRay View Post
I have asked my very own tool which performs some heuristics on the input file and result is this:
Now where can we get that "findcruncher" tool? :-D
mnemo is offline  
Old 12 May 2022, 13:13   #13
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Currently it can be found in the SOURCES: partition of my HD. I will release it to the public once I have implemented all features I have in mind and also written a documentation. Especially the last point will probably delay the release for quite some time.
StingRay is offline  
Old 13 May 2022, 16:26   #14
mnemo
MTN/SPT
 
mnemo's Avatar
 
Join Date: Sep 2019
Location: Germany
Age: 53
Posts: 61
Quote:
Originally Posted by StingRay View Post
I will release it to the public once I have implemented all features I have in mind...
Just release it and add more features in the next sprint.
mnemo is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bone cruncher wanted mike4466 request.Old Rare Games 32 14 January 2020 19:03
The Nibbler cruncher Photon Coders. Releases 22 27 December 2013 15:31
Cruncher ...... what ? Another World New to Emulation or Amiga scene 27 16 December 2008 19:48
Cruncher Factory plasmatron support.Games 2 20 February 2008 17:40
DEFJAM-Cruncher andreas request.Apps 5 14 September 2001 19:39

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:34.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.81907 seconds with 14 queries