Free Jaguar Project

Atari Jaguar Discussions => Jaguar ROMs => Topic started by: doctorclu on August 07, 2009, 11:41:16 pm



Title: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 07, 2009, 11:41:16 pm
(I've posted this on Atariage and JS2... would love to get your input on this...)


I've been searching for a few years to find the Bubsy source code with no luck. But I have had some good suggestions on how to decompile the rom, and yesterday, to look at it with a hex editor. Don't know why the hex editor escaped my mind, I used to use one all the time back in on the Atari 800.

When I did, it went from basic non sense, to an interesting patch of ascii, and then back to non sense again. But what was found was interesting, and by changing a few ascii characters I was able to do some interesting things, like swap voice tracks around, and even change some level information.

Some have said after playing Bubsy that the game would have been better off if it started on the much easier level seven. (Ali Baba). I was almost able to do that with some nonserious tinkering.

These are the bad guy files I figure. The files that say what the bad guys are, where they will be, etc. Interestingly, when I had the level 7 maps in the place of level one but didn't change the bad guy characteristics, the redlight/greenlight "keys" to open doors were placed where enemies (snakes/Vultures) would have been.

--Initially I couldn't change this one because "ali" and "alice" were not the same amount of characters for me to switch around. So far what changes I've made were one character for one character replacements, and when you stray from that in the hex editor, things get wonky. But if you have an idea on how I could add two characters in hex edit, I'm all ears.
ALI.BAD
ALICE.BAD
HANSEL.BAD
JACK.BAD
WATER.BAD

----No idea what these are.
CIRC.BIN
SINE.BIN

---The boss files!!
ALICE.BOS
GENIE.BOS
HANSEL.BOS
JACK.BOS
WATER.BOS

--Not exactly sure what these are, but as you can see, the character character size, I could change a 1 out for a 5, and swapped fine. Come to find out world 5 was the Ali Baba world of level 7. Well, that is is true if Alice is truly world 1. icon_smile.gif
BSET1.BTR
BSET2.BTR
BSET3.BTR
BSET4.BTR
BSET5.BTR.

--CPL? Not really sure what these are.
INTRO.CPL
TITLE.CPL

-This one .cry stands alone. Interesting to note later on in the "BSETx.RGB" number 4 is missing. Makes me think this is a part of that set, but given a different extension.
BSET4.CRY

-More world information. Not exactly sure what these are.
WORLD1A.CTL
WORLD1B.CTL
WORLD1C.CTL
WORLD2A.CTL
WORLD2B.CTL
WORLD2C.CTL
WORLD3A.CTL
WORLD3B.CTL
WORLD3C.CTL
WORLD4A.CTL
WORLD4B.CTL
WORLD4C.CTL
WORLD5A.CTL
WORLD5B.CTL
WORLD5C.CTL

-And this one. But glad to see worlds 1 through 5 all present.
BSET1.DAT
BSET2.DAT
BSET3.DAT
BSET4.DAT
BSET5.DAT

-Sound Effects data?
SFX.DAT

-Implies game data?
GAME.DTA

-Strikes me as intro information.
FONT1.JHD
INTRO.JHD
LOGOS.JHD

-JPL.. any idea on this?
ATARI.JPL
BUBSY.JPL
IDI.JPL
STAR.JPL
WATERFON.JPL

-I find it intereting how "font1", "Intro" and "logos" keep popping up.
FONT1.JSP
INTRO.JSP
LOGOS.JSP

-The map layout. Strangely, if you simply swap 1 for 5 in this case, tricking it to think that world5a is world1a, you get level 9, which is the Genie level. Once again, need to tinker with this a bit more to figure out what world is what level. Very nice is how all 15 level are represented. Also need to figure out what file provides the placement on the map for Bubsy.
WORLD1A.MAP
WORLD1B.MAP
WORLD1C.MAP
WORLD2A.MAP
WORLD2B.MAP
WORLD2C.MAP
WORLD3A.MAP
WORLD3B.MAP
WORLD3C.MAP
WORLD4A.MAP
WORLD4B.MAP
WORLD4C.MAP
WORLD5A.MAP
WORLD5B.MAP
WORLD5C.MAP

-Not exactly sure what this is, but there are 15 of them! Woot!
WORLD1A.MPR
WORLD1B.MPR
WORLD1C.MPR
WORLD2A.MPR
WORLD2B.MPR
WORLD2C.MPR
WORLD3A.MPR
WORLD3B.MPR
WORLD3C.MPR
WORLD4A.MPR
WORLD4B.MPR
WORLD4C.MPR
WORLD5A.MPR
WORLD5B.MPR
WORLD5C.MPR

-The ingame music. I was able to successfully switch the w5 music with the world 1 music. I know these are actually mod files since I have the extracted mod files somewhere else. Wish I knew how they did that.
GAMEOVER.MUS
HIGH.MUS
TITLE.MUS
W1MUSIC.MUS
W2MUSIC.MUS
GAME.TXT
W3MUSIC.MUS
W4MUSIC.MUS
W5MUSIC.MUS

-This is the backdrop picture. Since Ali and Alice were not the same character lengths, I tried switching WATER and ALICE and got the Water backdrop with the Ali Baba map. icon_smile.gif
ALI.PIC
ALICE.PIC
HANSEL.PIC
JACK.PIC
TITLE.PIC
WATER.PIC

-These are animations. The arrow that points you onward, the Bubble around Bubsy in the water levels. Was neat to see this.
ARROW.PP
BUBBLE.PP
BUBSY__G.PP
GAMEOVER.PP
GLOBAL_G.PP
OVERLAY.PP
PAUSED.PP
RESET.PP

-Not really sure what this is.
BSET1.RGB
BSET2.RGB
BSET3.RGB
BSET5.RGB
TITLE.RGB

-The voice files!! This was the first thing I changed for the fun of it, and I got a kick hearing Bubsy say "Nothing can stop me now!" (levels 13-15) on level 1. icon_smile.gif
KEEPITUP.W11
PILOT.W22
NOTHING.W33
FLIPPER.W44
TORTURE.W55

And I got the game to do some wonky stuff as I would play with it in hex then save and then load on the Skunkboard. icon_smile.gif

I haven't fully explored which worlds are what levels above, and if you know a way where I could swap uneven character ascii, like say "ali" and "alice" (how to add hex ascii without messing with the programming around it) I would appreciate the input. Would also enjoy input on some of the files above and what they do exactly.

And if there was a way to extract some of those subfiles from the rom image, I would like to know what it takes. As said before, the mod files have been extracted. I would love to see the map files extracted as well. Even some of the animations would be cute to get.

Again, trying to understand this game, swap the levels around as suggested by some players who have played Bubsy, and as you see above, looks like even in the crude hex editor there is a lot to work with.


[Also interesting to note, doing an ascii search, the first two level codes were findable. I did see where the title ascii was viewable for level 7 (Rushing Roulette), but didn't see others. Geez... wish the source code would surface for this!!!]


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 08, 2009, 12:05:36 am
Well, it seems you found the game's file system!

Of course they're not real files inside the ROM, but they were at some point stored in a hard drive, so they had to have proper names.

Now, typically games store their file systems in the following format: filename.ext (in ascii), any zero padding if required and an offset to the file. This means that for each filename, a fixed amount of bytes is reserved. Which is present on the bubsy rom too (from what I initially see).

So what we need to do is this: Find at least one file's starting position, and figure out how to decode the offset and we'll be able to couple the offset to the file and we'll have all the game files!

OTOH, if you just want to swap filenames around I guess you could simply change the filenames around, add any additional zero padding required and then swap the offsets around.

Anyway, I'll sleep over it :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 08, 2009, 01:05:52 am
I had someone figure this much out.  To them I say thanks for the input (name kept anonymous unless they want credit here.)

Bubsy name table
Table runs from 29FE to 33F5
Alignment of these records is not certain yet.
Each record is 22 bytes.
Offset is always padded to a word-aligned (even) address.
Filename is NUL padded to 14 characters.
All numbers are 32-bit, big endian.
(4 bytes) Offset (from where?)
(14 bytes) filename
(4 bytes) Length

Looks like this is the likely layout
  Offset       Filename   Length
00000074 ALI.BAD        000095C1
000009FA ALICE.BAD      0000A53F
00009FBC HANSEL.BAD     00007EC0
000144FC JACK.BAD       00006F1E
0001C3BC WATER.BAD      000080F8
000232DA CIRC.BIN       0000074E
0002B3D2 SINE.BIN       00000800
0002BB20 ALICE.BOS      0000416A
0002C320 GENIE.BOS      000070EC
0003048A HANSEL.BOS     000060C2
00037576 JACK.BOS       00005150
0003D638 WATER.BOS      000028F7
00042788 BSET1.BTR      00000544
00045080 BSET2.BTR      00000336
000455C4 BSET3.BTR      0000043E
000458FA BSET4.BTR      0000027F
00045D38 BSET5.BTR      00000569
00045FB8 INTRO.CPL      00000498
00046522 TITLE.CPL      00000160
000469BA BSET4.CRY      0000013F
00046B1A WORLD1A.CTL    00000413
00046C5A WORLD1B.CTL    00000604
0004706E WORLD1C.CTL    00000426
00047672 WORLD2A.CTL    0000051D
00047A98 WORLD2B.CTL    00000565
00047FB6 WORLD2C.CTL    000004BA
0004851C WORLD3A.CTL    00000626
000489D6 WORLD3B.CTL    000005AD
00048FFC WORLD3C.CTL    00000690
000495AA WORLD4A.CTL    0000068F
00049C3A WORLD4B.CTL    00000638
0004A2CA WORLD4C.CTL    0000062F
0004A902 WORLD5A.CTL    00000671
0004AF32 WORLD5B.CTL    000005B9
0004B5A4 WORLD5C.CTL    0000058C
0004BB5E BSET1.DAT      0000F9CE
0004C0EA BSET2.DAT      0000ADA5
0005BAB8 BSET3.DAT      00008A75
0006685E BSET4.DAT      000096C6
0006F2D4 BSET5.DAT      0000BF34
0007899A SFX.DAT        0002469C
000848CE GAME.DTA       000006CB
000A8F6A FONT1.JHD      0000014B
000A9636 INTRO.JHD      000000B5
000A9782 LOGOS.JHD      00000020
000A9838 ATARI.JPL      000001BE
000A9858 BUBSY.JPL      000000AB
000A9A16 IDI.JPL        00000122
000A9AC2 STAR.JPL       00000044
000A9BE4 WATERFON.JPL   00000044
000A9C28 FONT1.JSP      00000D86
000A9C6C INTRO.JSP      0000B60C
000AA9F2 LOGOS.JSP      00003290
000B5FFE WORLD1A.MAP    00002A25
000B928E WORLD1B.MAP    000037AE
000BBCB4 WORLD1C.MAP    000024B0
000BF462 WORLD2A.MAP    00002B39
000C1912 WORLD2B.MAP    0000414E
000C444C WORLD2C.MAP    0000182A
000C859A WORLD3A.MAP    00002F91
000C9DC4 WORLD3B.MAP    000027DB
000CCD56 WORLD3C.MAP    00002CA9
000CF532 WORLD4A.MAP    00004DC1
000D21DC WORLD4B.MAP    0000482B
000D6F9E WORLD4C.MAP    0000499E
000DB7CA WORLD5A.MAP    00002C86
000E0168 WORLD5B.MAP    000028BF
000E2DEE WORLD5C.MAP    00002C96
000E56AE WORLD1A.MPR    00000CE8
000E8344 WORLD1B.MPR    00000FA7
000E902C WORLD1C.MPR    000008ED
000E9FD4 WORLD2A.MPR    00000C03
000EA8C2 WORLD2B.MPR    00000D05
000EB4C6 WORLD2C.MPR    00000351
000EC1CC WORLD3A.MPR    0000070C
000EC51E WORLD3B.MPR    0000074B
000ECC2A WORLD3C.MPR    000005AE
000ED376 WORLD4A.MPR    00000DAE
000ED924 WORLD4B.MPR    00000C42
000EE6D2 WORLD4C.MPR    00000C66
000EF314 WORLD5A.MPR    000007CD
000EFF7A WORLD5B.MPR    00000841
000F0748 WORLD5C.MPR    000006AF
000F0F8A GAMEOVER.MUS   00008D71
000F163A HIGH.MUS       00019A6B
000FA3AC TITLE.MUS      0001D951
00113E18 W1MUSIC.MUS    0000FF27
0013176A W2MUSIC.MUS    00011168
00141692 GAME.TXT       0001015E
001527FA W3MUSIC.MUS    00010368
00162958 W4MUSIC.MUS    0000E100
00172CC0 W5MUSIC.MUS    00012C89
00180DC0 ALI.PIC        000068EC
00193A4A ALICE.PIC      00009233
0019A336 HANSEL.PIC     0000484D
001A356A JACK.PIC       00008299
001A7DB8 TITLE.PIC      000084E1
001B0052 WATER.PIC      000082BA
001B8534 ARROW.PP       00000B89
001C07EE BUBBLE.PP      000005CC
001C1378 BUBSY__G.PP    000100BD
001C1944 GAMEOVER.PP    00001678
001D1A02 GLOBAL_G.PP    000042AE
001D307A OVERLAY.PP     00003961
001D7328 PAUSED.PP      0000025A
001DAC8A RESET.PP       00000419
001DAEE4 BSET1.RGB      0000019D
001DB2FE BSET2.RGB      0000016F
001DB49C BSET3.RGB      00000169
001DB60C BSET5.RGB      0000019C
001DB776 TITLE.RGB      0000015B
001DB912 KEEPITUP.W11   00004366
001DBA6E PILOT.W22      00003FD3
001DFDD4 NOTHING.W33    000048D2
001E3DA8 FLIPPER.W44    00003DD3
001E867A TORTURE.W55    000064C5

Then goes on to say...
"there's an obvious error in there. I'm still not 100% certain which record the offset and length words belong to, you can tell by looking at the first couple of records it's not quite correct.

But the fields themselves seem to be identified.

It's possible that ALI.BAD is just a corrupt, unused record, and that ALICE.BAD is the first file. In that case, the layout would be LENGTH/OFFSET/FILENAME, which is a reasonable assumption."


Title: Re: Bubsy: Exploring with Hex Editor
Post by: Sauron on August 08, 2009, 09:22:00 am
I probably won't be hacking Bubsy anytime soon, but reading this thread so far makes me want to start splitting apart some other ROM files, just to see what I can learn. :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: ggn on August 08, 2009, 12:20:29 pm
First post here, no time for itnroduction, this thread needs me :)

Had a look this morning at the ROM, and right after the filesystem entries, I saw three magic letters: R N C.

Ding ding!

For those who are unfamiliar with those initials, it's "Rob Nothern Computing". Now, Rob was an old hacker turned legit, and he wrote one of the most used pieces of protection on ST and Amiga: Copylock. In addition to copylock he offered to companies his filesystem routines and custom packer.

Now, each file packed with Rob's packer has his company's initials as a header... yep, you guessed it, RNC ;)

Soooo, after this was established it was time to get busy :)

I set about to find a depacker for RNC files for PC, and because my desktop PC (which I think has it) was not available, I googled around, and struck gold!

I found a program called "Multi Ripper", which you give it a file and it starts searching for lots of known files. You name it, mod formats, jpegs, some more obsucre ones, aaaaand... RNC files :)

So as it is, all the RNC files are sitting in a directory on my laptop, ready to be unpacked (still haven't found the propack unpacker!). Anyone wants em, they're available on request, or you can google around for mrip260.zip and do it yourselves :)



So it's down to you now doc: what do you want to do with bubsy?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 08, 2009, 01:49:21 pm
That was in interesting read.  Yeh I would love to see what the files have to say.  :)

GGN PM sent.  :)

I think this is the kind of fun and input I was hoping for here.  :)  So Sauron, what classic rom images have you curious?  (Start a thread!)

Meanwhile can't wait to see what GGN found (and try to introduce yourself at some point.)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 08, 2009, 04:27:20 pm
Alright I have the files over here, and true to form, they are RNC files.  I'll need to take the directory that the other anonymous person gave above, and try to figure out what is what.  Fairly exciting.  And naturally my head is filled with "This is sooo cool!"  and "what the heck am I looking at"  :)  But this really is cool.

117 RNC files and 116 files in the hexedited directory from the Bubsy Image.  So the initial theory is all the backup files and one main file?  :)

Anyway, I made a spreadsheet of the two directories.  The RNC files are sizes in K, and the Bubsy image directory is in hex still.  The person who made that hex directory said the Offset and Length might actually be reversed.

Anyway, if anyone is curious and want to make those hex to decimal conversions to make theories of what file is what, Have at it!  :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 08, 2009, 04:35:33 pm
Great stuff doc!

We're counting on your (and your little helpers ;)) to give us the most comprehensive analysis of your beloved cart!


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 08, 2009, 05:03:28 pm
Great stuff doc!

We're counting on your (and your little helpers ;)) to give us the most comprehensive analysis of your beloved cart!

Thanks!  

Little helpers.  Ha!  Nothing little about them.  Big help.

Anyone know good ways to convert these Hex sizes to decimal sizes?   Give suggestions, I'll try them out later tonight.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 08, 2009, 10:41:11 pm
Anyone know good ways to convert these Hex sizes to decimal sizes?   Give suggestions, I'll try them out later tonight.

If you're under windows, you can use the built-in calculator. Just change it to "scientific" mode, then change it to hex, type the offset and it'll get converted when you press dec.

Also, I just looked that excel has a hex->dec function built in, called hex2dec(), so since you're already in excel you could find it useful :)

Finally, I personally use a calculator called "total calculator v2" (not available anywhere anymore), in which I just type $ and the number in hex and it gets converted to the other bases (dec, binary, octal, exponential) in realtime!

Hope any of this helps :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: TheGrandPubaa on August 08, 2009, 11:24:50 pm
I was following this over at JSII with mild interest. To be honest, I never liked the Jaguar Bubsy much at all, but I was a huge fan of the SNES/Genesis Bubsy game(the first one, the good one in my opinion). If there were some way to recreate that one on Jaguar, that'd be a cool hack indeed.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 09, 2009, 12:02:16 am
I was following this over at JSII with mild interest. To be honest, I never liked the Jaguar Bubsy much at all, but I was a huge fan of the SNES/Genesis Bubsy game(the first one, the good one in my opinion). If there were some way to recreate that one on Jaguar, that'd be a cool hack indeed.

Short of having the source code for both versions, the only viable route for that imho is a snes (or genesis) emulator :(


Title: Re: Bubsy: Exploring with Hex Editor
Post by: TheGrandPubaa on August 09, 2009, 12:04:44 am
That's true, but it would still be cool.

And I doubt an SNES emulator would work out particularly well. The SPC alone would be a nightmare to emulate. Even the GP2x has trouble with SNES emulation, and it's quite a fair bit beefier than the Jaguar.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 09, 2009, 08:42:24 am
Trust me, I would like to see Bubsy and Bubsy 2 on the Jaguar some day.  Strangely, I think the original intent was to publish the original for the Jaguar.  But you know we might know more about that VERY soon.

Just found the producer of Bubsy, Faran Thomason:
http://freejag.atari.org/forum/index.php?topic=50.msg402#msg402



Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 10, 2009, 07:52:40 am
Well, this has been interesting.  I was able to get PP (Pro Pack) to unpack the 104 of the 116 files.  It all unpacked to like a 7.8 meg folder from 2 meg.

There are RNC files 83, 84, 90, and 91 that I was able to play on my modplayer.  I think I see how Facing Twilight was able to extract the mods years ago.

The errors in unpacking were...
0,2,35,82,85,86,87,88,89,97,111,112

The rest is still fairly unknown, and part of the challenge is figuring out applications that can load the files.

Here's how you can help me in unlocking Bubsy:

1) SpiderJerusalem you mentioned a Hex2Dec function in Excel.   Wasn't able to find it on my home Mac version, can't guarentee work Pc will have it.  Can you run that function on the Offset and Length columns and post the updated spreadsheet here?

2) If you would like to look at what is unpacked so far and want to help identify what's what, drop me a PM.  Would appreciate all the help I can get.

3) There are many different types of extensions, I'm sure many are specific to the game environment, and others are actual extensions of a application.

.pic seems to be the backdrop pics. 
.w11 voice track for Ali baba   (not sure what would play these voice tracks or format)
.w22 Voice track for Jack and the Bean Stolk
.w33 Voice track for Hansel and gretel
.w44 Voice track for 20,000 leagues
.w55 Voice track for Alice in wonderland
.pp seem to be animated additions (the arrow that points where to go, etc)
.mus files are established straight up .mod files.
.bad I believe the files containing the bad guy information for the levels.
.bos the boss animations.  I know this from switching the bosses around.
.bin  would appear to be a binary, not confirmed.
.txt  There is one "Game.txt" file.
.dta another file with the name "Game" in it.  In this case "Game.dta"

The next part I'll present extensions how they interact with each other.
There are files BSET1.XXX through BSET5.XXX  There are basically five worlds.
The extensions that go with these labled files are
.BTR
.CRY  (only one of these and for world 4)
.DAT (also has a "SFX.DAT" file)
.RGB (in these 4 is missing.. I believe .RGB and .CRY are graphics formats?)

There are files that say World1A.XXX-World5C.XXX  There are a total of five worlds, with three levels in each for 15 levels.  The associated extentions are...
.MAP
.MPR
.CTL

"Font1", "Intro", "Logos" has these assoctiated:
.JHD
.JSP

"Atari", "Bubsy" "IDI", "Star", "Waterfon" all use
.JPL
And I'm thinking these are the opening screens that cycle at the beginning of the game.


And that covers all of the extentions.  Now we need to somehow figure out which ones of the above are what in the RNC files that were unpacked, and then figure out what applications can work with and view the files above.

The modplayer files worked straight up, so that is an encouragement.

For those that want to try your hand at uncompressing the last 12 stragglers I have the zipped file below with the 12 RNC files that errored out.  I included 90, and 91 which not only worked but are established mods to practice with.

With 90 and 91 I was able to run Pro Pack (included) on the them with the command:
pp u m *.rnc

That is ProPack.. with the "U"npack "M"otorola 68K and "*.rnc" all files in the directory ending with ".rnc"

Once you do that, just change the extension to .mod at the end 90 and 91 and they will play in your modplayer.

And that command and file structure seemed good to the program for 104 of the 116 files.  Of the remaining 12, I tried the PC, ST, Amiga, Data, and Motorola types with no luck.

Again,
- help with the hex conversion
-Help with identifying the file in the directory in the excel spreadheet attached to RNC file
-Help finding applications to open these files

Any or all would be appreciated.

Question I have to wonder, what type of computer was this developed on?  (A ST, PC, Amiga... probably not Amiga).  They had to work the graphics, and I believe that there is a program to convert graphics to work on the Jaguar?  What app would that be?

Good luck in whatever you try on this, and if you don't yield results, have fun trying.

My hope, worse caase scenario... extract the maps.  Many have asked for those.  :D


Title: Re: Bubsy: Exploring with Hex Editor
Post by: Mr Morden on August 10, 2009, 09:41:01 am
Windows Calculator does hex<->dec<->octal<->binary conversion

Just type in the number in one base, and hit the button to convert it to the other.

Under "view" you need to be in "scientific mode"


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 10, 2009, 01:05:25 pm
- help with the hex conversion

Done! (attached)

-Help with identifying the file in the directory in the excel spreadheet attached to RNC file

I'll take a look...

-Help finding applications to open these files

Ditto...

Question I have to wonder, what type of computer was this developed on?  (A ST, PC, Amiga... probably not Amiga).  They had to work the graphics, and I believe that there is a program to convert graphics to work on the Jaguar?  What app would that be?

Well, whatever system they used, if they exported the gfx into a jaguar native format, you won't find an app to open them easily (unless there is one already :))

Good luck in whatever you try on this, and if you don't yield results, have fun trying.

My hope, worse caase scenario... extract the maps.  Many have asked for those.  :D



Title: Re: Bubsy: Exploring with Hex Editor
Post by: ggn on August 11, 2009, 05:59:50 pm
I had an idea yesterday.... why not use the game's RNC unpacker to process each file separately and then dump it to disk? So I sent the code to the ST and had a go, only to discover that the depacker is ported to the GPU!

Looking through the code I have another idea, I'll see if it's feasible then write here about it..


Title: Re: Bubsy: Exploring with Hex Editor
Post by: ggn on August 11, 2009, 06:43:45 pm
Yep, I just had a quick play with it and I think it's going to work ;)

Time to get busy then :)



Open up the bubsy rom file with a hex editor, and go to offset $205e. You should see the following string there: 41 FA 00 22 61 30 and so on.

Now, change that to: 41 F9 00 80 2A 02 3E B9 00 80 20 94 4A FC (don't worry yourself about the values in bold, I'll get to that!) and save the file. Now, load the rom and run it in Virtual Jaguar, the screen will stay black. Give it a few seconds, then press esc and exit the emulator. Finally, go open the file called "memdump.bin" in VJ's directory and go to offset $4000. If you see values <> zero then you most probably succeeded in unpacking ali.bad :)

So, what happened there, and what's the value in bold about?

Simply, I changed the startup code to unpack a file and then crash immediately (the opcode $4afc is ILLEGAL in 68000 and issues a stop :)). When Virtual Jaguar exits, it saves a dump of the physical memory, which is of course almost empty except our file in $4000.

So, how can we use this to our advantage? Well, see the values in bold? These actually form of a memory address. This is the address that the file parser uses as start. I simply pointed it to the first file which is at address $802A02 (which is $2a02 in the rom file and is the first filename!). So, finding the offset in the rom file of the file one wants to depack and add $800000 to it and changing the rom to that value, makes VJ depack the file.


Well, this should happen in theory, I can't say I tested it too much (not much free time!). So if some kind soul would help this, I'd be obliged (nudge nudge wink wink say no more say no more!)


P.S. Oh! Before I forget, please make sure that bubsy runs on VJ before you try this out! I'm using the jag bios, as well as having the DSP enabled!


Hope this helps!


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 11, 2009, 10:37:42 pm
Not a bad trick GGN.. Might have to make use of that here in a bit.

Well, thanks to a lot of your input, I was able to figure out the hex to dec (thank you Spider Jerusalem) and was able to compare the size of the directory our anonymous person contributed to what the RNC files were.   I now know without much doubt what like 90% of those files are based on the byte sizes.

Some of the files that I expanded using the RNC unpacker were mod files.  That was easy.  Now trying to find a graphics program that will read these images.

I'm talking to the producer of the Bubsy game, Faran, who will get back to me in a few days to see what can be found out.  Cool hearing from Faran.  :D

So knowing what the name of the files were and the byte size, I'll try to get the files back to their original file name.

And yeh, after that, just figure out what programs can work with them in their native states.

I'm thinking these graphical files were what the pictures were after being converted into the Jaguar picture format.

Makes me wonder if I can take these graphical files and just load them on the Jaguar like GGN was saying.  Hmmm.  Or if there is a way to unconvert Jaguar graphics images?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 11, 2009, 10:52:49 pm
Makes me wonder if I can take these graphical files and just load them on the Jaguar like GGN was saying.  Hmmm.  Or if there is a way to unconvert Jaguar graphics images?

Of course there is. It's like converting paletted formats from the ST (like Degas or Neochrome) to chunky modes (i.e. 24-bit). A paletted bitmap always has the palette used and then each pixel is in fact an index to the palette. So, if we figure out where's the palette and the indices, we can use a small look up routine to convert the indices to 24-bit col (or any depth for that matter).


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 12, 2009, 01:42:00 am
Wanna see something cool?

First off, here is the update of my spreadsheet of file directory to RNC unpacked files.

Next, someone suggested that the images could be in a raw format.  So I gave the "Alice.pic" and so forth files the extension of .raw and low and behold I got at least a greyscale image.  It's a start.  Here are the background images for Ali Baba, Alice, and Hansel. 

The Water level pic has not unpacked yet, and the Jack pic did not turn out.  But tells me something at least.

Again, if anyone wants to tinker with these unpacked files, PM me and let me know.  About 7.8 meg unpacked.  Amazing that all that fit into a 2 mb image.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: remowilliams on August 12, 2009, 02:15:37 am
I gotta hand it to you doc - you've got some mad love for Bubsy   :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 12, 2009, 02:17:25 am
Here is another picture.  So far I've been fairly lucky since this is raw, and I'll admit I use the "Guess" option to get the dimensions of the picture.

Wish I knew a sure fire way to know what the resolution would be somehow, or figure out how to pull out the color of the pictures.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 12, 2009, 02:29:01 am
I gotta hand it to you doc - you've got some mad love for Bubsy   :)

I've had some GREAT pointers and suggestions by people that have got us this far.  And the RNC fact is a very interesting one that makes me wonder how many other Jaguar games use it?

Oh lookee here, Raiden...
... NuBOOTLOGO.JHD.BOOTLOGO.JSP.BOOTLOGO.CPL.RAIDEN.TXT.RAIDEN.DTA..H...M.....4..JK. .|....<..f.J.$HJ.f.J.g.f...g.XFJ.f.`. v`...p...RNC.f./(..a.

And there might be a few other games out there that use this.  As we have seen with Bubsy so far, get that program to recognize programs within the image, unpack the RNC files, there are you.  I know I am amazed by all this.

As for Bubsy, I've played it so long I wanted to learn more about it by taking it apart.  The background shots alone were worth it.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 13, 2009, 04:01:59 am
Looks like the Removers have a Jaguar Image Converter that handles the .RGB and .CRY formats.

http://removers.free.fr/softs/en/download.php

I found out more about the CRY format, which one of the files has in the Bubsy file directory...

Cyan Red intensitY.
A colour system set up by Atari for the Jaguar.

256 Colours at 256 intensities, smooth gouraud shading, not so smooth colour graduations.

Starcat has the Jaguar Dev Docs for download here:
http://www.atari-jaguar64.de/english/start.html
in the coding corner download section


Title: Re: Bubsy: Exploring with Hex Editor
Post by: Mr Morden on August 13, 2009, 05:42:09 am
... NuBOOTLOGO.JHD.BOOTLOGO.JSP.BOOTLOGO.CPL.RAIDEN.TXT.RAIDEN.DTA..H...M.....4..JK. .|....<..f.J.$HJ.f.J.g.f...g.XFJ.f.`. v`...p...RNC.f./(..a.


Ahh Nu - how we love you.

(Nu = $4e75 = RTS)   (Nq = $4e71 = NOP)

hehe :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 13, 2009, 05:52:55 am
What is "NU" all about?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: remowilliams on August 13, 2009, 06:24:38 am
What is "NU" all about?

That's the ASCII equivalent of hex $4e75. 

$4e = 78 dec = ASCII 'N'
$75 = 117 dec = ASCII 'u'

http://www.asciitable.com/ (http://www.asciitable.com/)

 ;)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 14, 2009, 02:07:43 am
Well, we are making progress!!!   Thanks to Zerosquare on the Jagware site, there is the JagViewer program that made viewing it MOSTLY right much easier.

Here is where that is discussed...
http://www.jagware.org/index.php?showtopic=259&view=findpost&p=11473

And here are some pictures of what we had.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 14, 2009, 07:34:09 am
I can't tell, are those the proper palettes there?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 14, 2009, 10:36:26 am
Hardly.  The graphics converter is not looking at some of the files completely right for some reason, not really sure why.  Oh well, good for the moment.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 14, 2009, 12:26:36 pm
Then it's time to put the good ol' calculator down and make a few assumptions :).

The first is to determine the image resolution. I guess you have figured that out since the images seem ok.
Second is to determine the image bit depth. Again, I guess that this is already figured out.

Then you should multiply widthxheightxcol depth (in bits). Divide that by 8 and it will give you the total amount of bytes needed by the pic itself.

Take the number of palette indices (2? 4? 16? 256?) and multiply that by 2. This will give you the number of bytes needed for the palette.

Add these 2 numbers and you'll have the number of bytes needed for the picture.

Now, compare this number with the file's size in bytes. Is it the same? Then the palette is there but the program is reading it wrong (maybe scrabled RGB values).

Is it not the same? Then maybe the image or the palette is at a different offset than the pic displayer perceives.



Anyway, some gereral thoughts here, hope they help!


Title: Re: Bubsy: Exploring with Hex Editor
Post by: Zerosquare on August 20, 2009, 09:59:41 pm
I wrote a quick converter for Bubsy pictures, taking the palette into account.
See this post (http://www.jagware.org/index.php?s=&showtopic=259&view=findpost&p=11488).


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on August 20, 2009, 10:12:02 pm
I wrote a quick converter for Bubsy pictures, taking the palette into account.
See this post (http://www.jagware.org/index.php?s=&showtopic=259&view=findpost&p=11488).

Cool stuff!


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 20, 2009, 11:46:54 pm
I cannot tell you how cool this is!  :)  Thank you!

So why does this need a pallette file?   Not sure what is accomplished by having an image file at one location, and a seperate file for denoting what color goes where.  I mean why did they do it this way?

(posting this on here and FreeJag)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: Zerosquare on August 21, 2009, 12:04:47 am
You're welcome ;)

If your question was : "why did they use a palette instead of a straight RGB or CRY bitmap", the answer is simple : limited space in the cartridge. Palettized 8-bit pictures use one byte per pixel instead of two.

If you meant : "why did they use two separate files for the picture and the palette", I would guess that's because several pictures share the same palette.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on August 21, 2009, 01:08:15 am
That is my new backdrop picture.  :)

I guess I want to know how to duplicate the process.  If I wanted to make a backdrop picture for a game, would I have to use this method, or if I didn't mind the size, and want to work with 4 mb verses 2 mb like they did here, could I just use a more conventional jpg to cry or rgb image conversion and just use it straight up?



Title: Re: Bubsy: Exploring with Hex Editor
Post by: Zerosquare on August 21, 2009, 04:07:26 pm
Depends on the game. You have to :

- locate the graphics data
- extract it from the ROM file
- decompress it if it's been compressed
- figure out if it's 8-bit palettized, CRY, 16-bit RGB or 24-bit RGB
- guess the dimensions of the picture

The program I wrote will only work with 8-bit palettized pictures, and with files that have already been extracted and decompressed.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 01, 2009, 08:32:41 am
Zerosquare and all, so far so good.  First off, I'm posting a few more of the pictures on the Bubsy fan blog I have...

http://www.atariage.com/forums/index.php?app=blog&module=display&section=blog&blogid=234

But here we have some background files made possible by Zerosquare's program from the Ali level, and the title picture which I believe you can see if you hit options at the very start.

Shown here is a picture from the global.pp file which had a bunch of game icons in it.  This one is read by the image converter, also picked up off JagWare.  This one shows two unique shirts in the icon store that I have not seen used in the game.  A black shirt (which was used in the first Bubsy game on the SNES and Genesis) and a 9 lives shirt !!  Never seen that used in any Bubsy game.

I've attached the updated spreadsheet of what file I have found to be what.  There are still some files (like the water level background) I have not been able to uncompress.  If anyone would like to take a look at these or try to help figure out the mystery of some of these other files, any help will naturally be appreciated.

And as for the voice files, or the compiler that would be used to open the source file when we find it, will also be appreciated.

In the meantime, enjoy!!


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 02, 2009, 04:47:59 am
--THIS IS AN OFFICIAL REQUEST FOR HELP--

Update so far, all this started by me messing with a hex editor, and I found what looked like a directory of files in the Bubsy rom image.  I got a tip from an anonymous person on the sector beginnings and endings of files.  GGN had a lot to add using mrip260.zip to break down Bubsy rom into 116 RNC (Pro Pack archive) files. 

After running Pro Pack on the RNC files, 104 out of 116 unpacked successfully.

We are 12 files from uncompressed source here.    :)

At this point, I need some help or pointers / suggestions on what can be done to help these last 12 files trigger to uncompress with Pro Pack.  Right now it is seeing them as an unreadable file, which to me would suggest the header on these RNC files is somehow not right.

I have studied the good files prior to uncompression, and I noticed in about half the cases a space was missing after the initial "RNC".   Trying to add that however didn't work in those cases.

I've added RNC00045.rnc, which was a file that DID uncompress successfully for you to practice with.  I used the command "pp u s rnc00045.rnc" and that worked.  The files were either ST (S) or data (D) formats.  Up till RNC00085.RNC the files were basically ST compressed files.  After that, mostly data files.

I believe 00082 and 00089 should be mod files.  We have the mod files so we're good there.

00086-000088 might actually be the game code!!

What would be a good start would be 00097, which should be the backdrop picture for the water levels on Bubsy.  That would be a file, is we could get to unpack, would be a neat "oooww ahhh" moment.   The original name of this would be "Water.pic" and since it is the last background picture to be found in Bubsy, BSET3.RGB should be the pallet file to use with Zerosquare's 8bit to bmp converter when you get that uncompressed.

But yeh, TWELVE FILES, so close!!   Any help to get these files to unpack would be appreciated as I am stuck.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on September 02, 2009, 07:08:10 am
Doc, did you ever try ggn's suggestion to hex edit the rom into unpacking the jag files you want from Virtual Jaguar?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 02, 2009, 07:32:29 am
GGN gave a great suggestion that I will admit, has my mind doing flipflops reading through it all.

Yes I can see how that would work in theory.  Very solid theory.  I could probably get there in about half a year to a year of steady trying, or I could ask people that have a bit more experience at this to take a look at this if they could be so kind.

The Pro Pack idea has worked wonders, and really I think it is just a matter of a header being corrupt.  Just wonder what is keeping Pro Pack from unpacking those 12 files.


To better understand this, I have taken a few minutes to see how other games would unpack.  Raiden was one I got an idea might have used the same compression after talking to Trev here on how he worked on the mod player.  So I ran the mRIP and it found 98 files.  4 didn't unpack this time.   Currently trying to work out THAT directory to find out what those files were, but apparently 00000 and 00001 have a tendancy to fail.  In this case 00079 and 00080 also didn't unpack.  So have to find out more on this.

In short, I am amazed in what Pro Pack will unpack as it is from a rom image, just scratching my head on why a handful don't.  I figure in the ripping process maybe something didn't get split at the right place, or some header was left out.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 03, 2009, 08:18:01 am
The producer of the Jaguar Bubsy game just showed up on Atariage!!

http://www.atariage.com/forums/topic/85838-bubsy-your-opinions/page__view__findpost__p__1829209

Come check it out and ask questions!


Title: Re: Bubsy: Exploring with Hex Editor
Post by: ggn on September 04, 2009, 03:00:04 pm
Hi all (end especially Doc ;))

I had a run through the files in New Depack on ST, and most depacked! I'm not sure that all of them are ok, but most seem fine. 0086 contains the code as you assumed, and I even ran it through Easyrider (again on ST), and it produced a source file! Also, I included the boot code which is located at $802000 and contains the RNC code as well as the file system.

One final note is that if we are to recreate a Bubsy rom, we have to extract all the files present on the file system. The RNC files are not a necessity for me, as they might as well be flukes (I.E. the rip program did some false positives while detecting).

Anyway, that's for another time - enjoy :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 04, 2009, 03:30:25 pm
Wow simply amazing.  I have not had a chance to look at this but thank you!

Is there a non-ST solution that would be good for viewing the source code?

I do eventually want to make some changes to Bubsy and recompile this into a new rom for people to play.

I think Accolade did a good job on this game.  We've had 15 years to playtest it and make revisions.  ;)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: SpiderJerusalem on September 04, 2009, 03:32:45 pm
Is there a non-ST solution that would be good for viewing the source code?

Source code files are plain text :)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 04, 2009, 04:56:07 pm
Sweet. 

So what can be used to recompile all this?

I take it all this will have to back through Pro Pack and then how is it made back into a rom?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 04, 2009, 09:21:49 pm
Ok, not 100% this is right, but thanks to the files GGN unpacked, one was the picture from the water levels.  Here is what it looks like.  I never figured out till not that the ship in the background is probably Captain Nemo's sub.   Just thought it was some Viking ship.

Neat picture and good to see it all at once finally.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: jmetal88 on September 04, 2009, 11:33:42 pm
Ok, not 100% this is right, but thanks to the files GGN unpacked, one was the picture from the water levels.  Here is what it looks like.  I never figured out till not that the ship in the background is probably Captain Nemo's sub.   Just thought it was some Viking ship.

Neat picture and good to see it all at once finally.

Hmm...  Nah, looks like it has sails to me.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 05, 2009, 12:17:15 am
Well, Captain Nemo's ship in that era before subs existed in mainstream did have a mast I believe.

(After looking at google image search... ok.. maybe not. )


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 20, 2009, 07:35:03 pm
Ok here's another challenge, for a voice file, like the one attached (I believe it is a voice file) what kind of program would be used to create it, and play it?

It's not a wav file, so what did they use for voice files and recordings?


Title: Re: Bubsy: Exploring with Hex Editor
Post by: ggn on September 20, 2009, 09:15:26 pm
That was an easy one ;)

Quite simply, they are raw samples, i.e. just the data and no header. Most editors have an "import" function, where you specify some parameters about the sample yourself, so you have to guess some settings.

I used wavosaur's import function and specified 16 bits, signed sample of 11025hz. Now it's obviously wrong since the voices are too high pitched, but I don't have enough courage atm to try different values, this is just a proof of concept here!



Title: Re: Bubsy: Exploring with Hex Editor
Post by: Zerosquare on September 20, 2009, 09:59:21 pm
They're 8 bit signed, mono, 16 kHz (or so) raw sound files.

Besides using a sound editor like ggn said, you can also use a command-line utility such as SoX (http://sox.sourceforge.net/) to do batch-conversion.

The command line for SoX in this case is :
sox --bits 8 --channels 1 --encoding signed-integer --rate 16000 --type raw input_file output_file.wav


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 21, 2009, 12:46:31 am
I used wavosaur's import function and specified 16 bits, signed sample of 11025hz. Now it's obviously wrong since the voices are too high pitched, but I don't have enough courage atm to try different values, this is just a proof of concept here!

You know I think this improved Bubsy's voice.  :)

Hey Zerosquare, good job, I think I will give this a try and see if I can do this also.  Have two other voice samples to convert.   Be interesting to make Bubsy say other things like "What the hell man?!?"  but honestly nothing is more funny than level 15 of the original Bubsy and him saying "Are you still there?"  :)

Figure if we wanted to, we could make Bubsy say 15 sayings instead of 5, and maybe use some Yakko sayings (since it was the same voice actor)


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 21, 2009, 01:15:25 am
So far the SoX executable on the Mac side is not working.  Apparently I need to load some library support for it.  Will look more into this.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 23, 2009, 01:25:04 pm
Ok, to catch everyone up, here is the source that we have so far for Bubsy, and enclosed is a excel spreadsheet saying what is what as best we have figured out so far.


Title: Re: Bubsy: Exploring with Hex Editor
Post by: doctorclu on September 29, 2009, 07:15:19 pm
My friend KevinCal on Atariage let me know this was up on Ebay at the moment...

http://cgi.ebay.com/Atari-Jaguar-BUBSY-FRACTURED-FAIRY-TALES-LEVEL-Artwork_W0QQitemZ190338333335QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item2c510c7a97&_trksid=p3286.c0.m14

Interesting.  A xerox copy of the level maps for the bubsy water levels.  (My least favorite of the Bubsy game BTW).  Currently asking the guy holding the auction if he has other artwork.