Scramble vs unscramble bin

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
dospro
Insane DCEmu
Insane DCEmu
Posts: 147
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Dec 30, 2004 7:12 pm
Has thanked: 0
Been thanked: 0
Contact:

Scramble vs unscramble bin

Post by dospro »

Whats the difference between them?
Which one tuns on DC?
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

An unscrambled binary is a plain memory dump of a program. It can be loaded quite simply, by copying it into the appropriate place in memory, and jumping to it.

The Dreamcast's bootloader doesn't load the 1ST_READ.BIN file normally. For some reason, it rearranges parts of it. So, when the file is loaded into memory, it doesn't really resemble the file on the disc. If you try loading a normal binary in this way, it won't work.

So, scrambling rearranges the parts of the binary so that, when loaded by the Dreamcast's bootloader, it becomes de-scrambled.

Basically, if you're self-booting something, a scrambled binary is required.
dospro
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Dec 30, 2004 7:12 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by dospro »

To boot it from DC i use Demomenu. What do you think is the working one?
unscramble too? or scramble?
User avatar
mankrip
DCEmu Ex-Mod
DCEmu Ex-Mod
Posts: 3712
Joined: Sun Nov 04, 2001 5:12 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by mankrip »

So it's the IP.BIN the reason for the scrambled binaries? Would it be possible to make an IP.BIN which works with unscrambled binaries then?
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Image
LyingWake
DCEmu Super Poster
DCEmu Super Poster
Posts: 1342
Joined: Thu Aug 26, 2004 4:05 am
Has thanked: 0
Been thanked: 0
Contact:

Post by LyingWake »

http://www.consolevision.com/members/fa ... info.shtml
So it's the IP.BIN the reason for the scrambled binaries? Would it be possible to make an IP.BIN which works with unscrambled binaries then?
Ip.bin just directs the Dreamcast to the main binary.

The Dreamcast loads them in a specific way, which is the reasoning for the needs of scrambling and unscrambling. That's what I've always known.

EDIT: I didn't read you post BlackAura when I posted that, but you explanation gives me a perfect understanding of how it works. :)
dospro
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Dec 30, 2004 7:12 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by dospro »

ok. thanks very usefull.
The only bad part is that my application is still not working on the DC.
It works on windows, onlinux but not on DC...tooo bad.
LyingWake
DCEmu Super Poster
DCEmu Super Poster
Posts: 1342
Joined: Thu Aug 26, 2004 4:05 am
Has thanked: 0
Been thanked: 0
Contact:

Post by LyingWake »

*bump* :)

I was curious because I came across DreamSpec which is a Katana program. How does the Dreamcast load these things? Is it any different than the KOS programs? What exactly does the BINHACK tool ECHELON created do?
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

How does the Dreamcast load these things?
Same way, basically.

From a GD-ROM, it seems to load the binary without scrambling it. When loading from a CD, it does the scrambling thing.
What exactly does the BINHACK tool ECHELON created do?
Katana's disc reading code is a little simpler than KOS's. It makes the assumption that it's running from a GD-ROM, and that all the data is on the second session. Reasonable assumptions, since Katana apps were only ever meant to run off a GD-ROM. So, it has the LBA address of the high density session hard-coded into it (from memory, I think it's 45000). It also checks to see if it is running off a GD-ROM by checking the media type.

Binhack replaces that LBA address with a different one, so it'll run off a CD. It also changes the media checking code. I think it might also remove some copy protection bits that might be present in commercial apps.

For DreamSpec, it would only be changing the LBA and media type.
User avatar
Masen
DCEmu Freak
DCEmu Freak
Posts: 68
Joined: Mon Mar 28, 2005 1:35 pm
Has thanked: 0
Been thanked: 0

Post by Masen »

Is there anyway to boot an unscrambled bin file created with kos ??
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

Masen wrote:Is there anyway to boot an unscrambled bin file created with kos ??
They won't selfboot unless you scramble them, but you can load them with DemoMenu or DCHakker, which you should be able to find at http://dchomebrew.org . Load one of those programs, press "Y" on your control pad, and it will allow you to load an unscrambled binary.

You should be able to find tools to scramble your bins at:
http://www.dcemulation.org/neededtools.htm
http://www.consolevision.com/dreamcast/needed/
http://dcevolution.net/DCHelp/index.php?id=apps

I suggest fackue's file checker, which you can find on the third page I linked to above.
Post Reply