Hacking .hack//Infection (How to make Skeith spawn anywhere)

Discuss the original .hack video games: Vol. 1 and 2

Moderator: Moderators

NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

awesome. i'm in the middle of working out the model format. Aside from a few annoyances with the way the format is designed, its going well. Im also trying to figure out how the game positions the pieces of the root towns, fields and dungeons, but I suspect that and the actual animations for the cutscenes are housed in either the games code of other files. Perhaps one day i'll get around to finishing the dungeon and field generation code.
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

It seems like your work and mine would mesh well together! What you have figured out has always been beyond me. Great work! I have some "information" about dungeons earlier in the thread. The way story dungeons are set-up are in EditDungeon but they're only the story dungeons as far as I could tell. Also fields appear to be put into many different parts... do you have PS2DIS? That should help you in finding those parts.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

I have ps2dis, it's been instrumental in decoding these files. sadly though, without seeing the code actually running and inspecting the data as it comes through, certain parts require some guess work. the only version of pcsx2 that I found with a functioning debugger runs so slow I get bored waiting for the emulator to hit my break point. I can do a bit of assembly hacking and just dump the registers to memory and retrieve the values from a save state, but ps2dis doesn't have an option to load the values from a file to use in emulation, and it gets annoying typing them in. I'm looking into ways around this though.
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

Hmm, what are the tools you're currently using? You might have some things that I'm unaware of.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

ps2dis, pcsx2, a hex editor, and am scripting my tools in python. ps2dis has an experimental ee emulation feature, but I haven't used it much.
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

Hmm, sounds like much the same as me except for the scripting my own tools, eh heh. I could only imagine how difficult that would be. What is that ee emulation feature supposed to do, out of curiosity? I've noticed it as well.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

for emulating the processor in the ps2. helps when trying to debug/ reverse engine certain sections of code. as far as scripting my own tools, it's not that hard. I've actually taken a break from working on the models to look and see what can be done about the green kite > red kite issue. if you look in hackstract, the image in kites model is green, but there's actually two palattes stored in the file. there's probably some flag that gets set somewhere when the kite change fires, but what makes me wonder is that it would make more sense for the colors to work right on swapped pc models before the event, not after. so far I haven't had much luck. the only other option that I can think of to fix this issue is rebuilding the files so that they too have 2 palettes and that gets messy fast, because then you have to rebuild the data. bin tables, and me being the perfectionist that I am, I would end up writing a whole new elf parser. I would soon like to write a program that would make swapping out character models an automated process, though im not sure if any of the other volumes besides infection have the debug symbols intact
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

Ah, well I've done a bit of looking into that myself and found the answer a couple weeks back. It's revolved around an event command, to be exact it is "7E 00 - How the game lifts the "green" from Kite and gives him Data Drain." The only other present issue is that it gives him Data Drain. I once tried to follow that flow of data but couldn't find the answer. You might have better luck in that regard,

The other characters don't have that second palette so instead their "palette" becomes whatever the palette of their party is Or the palette of the surrounding areas.

Oh right, also it seems that you don't have a reliable in-game memory viewer/editor. I suggest getting Cheat Engine, it connects right into any program and displays its processes in plain hex, unfortunately it is viewed in... I want to say Big Endian so all of the byte sequences are reversed but I've done a great amount of work with it. In fact all of my Event Command notes should be the reverse of what they look like, but when viewing it in-game it's easier to keep track of changes.

Though you are unfortunately correct, no other game in the series except //Infection has the debug symbols left intact. And because of this I see things that appear to reference a debug mode throughout the files. Do you think there might be a way to reactivate that? It could help us both quite a bit.

Ah. by the way all of the games are in //Infection Except for the cutscenes, which makes syncing up the story a fair amount difficult without proper cutscenes past //Infection.
User avatar
VIZGIX
Posts: 37
Joined: Sat Feb 16, 2013 4:03 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by VIZGIX »

hmmm.. this is very instresting. I would like to understand this in more detail. Seems fairly complicated though...

do you have a recommendation of where I can go to read up on this enough to be able to understand it on your level?

I know my experience with projects like this is minimal, but this is the kind of thing I really want to learn how to do.

I have some experience programming (mostly C++ and Java) and am well versed in basic A+ level software skills, but I am afraid I'm not really versed in python, using Hex editors, etc.

I've always wanted to try to embark on the kind of project you are doing, but I'm afraid I have had trouble knowing where to start. At this point, its hard to tell where you are even coming from.

If you have any advice on where a novice like me can go as a starting point to being able to eventually tackle projects like this, any advice would be greatly appreciated

Thanks
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

VIZGIX wrote:hmmm.. this is very instresting. I would like to understand this in more detail. Seems fairly complicated though...

do you have a recommendation of where I can go to read up on this enough to be able to understand it on your level?

I know my experience with projects like this is minimal, but this is the kind of thing I really want to learn how to do.

I have some experience programming (mostly C++ and Java) and am well versed in basic A+ level software skills, but I am afraid I'm not really versed in python, using Hex editors, etc.

I've always wanted to try to embark on the kind of project you are doing, but I'm afraid I have had trouble knowing where to start. At this point, its hard to tell where you are even coming from.

If you have any advice on where a novice like me can go as a starting point to being able to eventually tackle projects like this, any advice would be greatly appreciated

Thanks
Ah there's not too much that you would need to read, everything that you need to know is in the thread, my notes have been put up here for everyone to see.

But I can understand where the confusion may lie, but believe me it is a lot simpler than it may look at first glance. First in order to get much done you will need a PS2 Emulator, preferably PCSX2 1.0 or above, earlier versions were made for very powerful computers but the newer versions have specs more in line with a normal desktop or laptop.

Secondly you will need to get a copy of //Infection in an ISO form, I will have to leave that to Google (as discussing that sort of stuff is illegal). Once you have those and they're up and running you'll then want to pick up Cheat Engine, which can be found at romhacking.net (I think.) With that you will need to become acquainted with Hex. As for actual programming experience... I have none, but that hasn't stopped me from recording what I've seen in memory with the use of PS2DIS (which you can also pick up at romhacking.net) and Cheat Engine,

Hex is described in detail earlier in the thread and it's not as complicated as it may look, but it is a little jarring to get used to at first.

With all of that under your belt you will need a special kind of Hex Editor, normal ones will just open the file and be done with it, and with a file the size of //Infection that could take a while. You should pick up HxD, Hex Editor which opens up the data as needed and not all at once.

Once you have all of that you should be good to go, I've listed earlier in the threads the methods for changing PC's, changing the controlled model (still no luck with getting it to recognize non SPC models though, bah) equipment changing, where monster data begins, and rudimentary event editing. So if you need any further help don't hesitate to ask.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

In keeping with the spirit lately of procrastinating, I've started getting stuff together so that I can make a program to do the modding automagically, since I really don't feel like rewriting the code to handle model animations inside the game files for the thousandth time. Where are you trying to load the non-Spc models from? An event? As a party member? As the player?
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

Oh, I'm trying to load them directly, as in switching the tags of the characters to the NPC models, for example switching ctu1body (Kite) for csig_bu2 (Silver Knight) appears to bring up the "File=None" screen when you go to load an area. Party members and player seem to be the exact same requirements it would appear for allowed animations.

And it seems you're close (or already there) with animations? Can you shed any light on that? The only thing I've noticed is that if the animation set doesn't align with the model tag then the game erases the model when it goes to do the "invalid" animation and it would have been that hurdle on how to make the //SIGN crew playable, even if I ever did figure out why I couldn't load them into SPC data.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

Well, I feel stupid. I found out how to fix the colors on the model screwing up. Right below where you change the animation names, you'll see the ascii text "PLAYER" below that is what we need to fix.

Code: Select all

CMP_trall //game internal thing, deals with the models internals, dont change. 
OBJ_t0 l hand //attachment point for weapon? havent tested
OBJ_t0 r hand //same as above
CLT_ctu1body //pre-data drain pallatte.
CLT_ctu1bodyc1 //post-data drain pallatte

//change to the following values for your character
//since kite is the only one with two pallattes, you just use the same pallate on both

Kite ctu1body / ctu1bodyc1
Mia CLT_cmiybody
Orca CLT_chb4body
Marlo CLT_chb2bod1
Sanjuro CLT_chb2bod1
Nuke CLT_cla1bod1
Balmung CLT_cbu1body
Moonstone CLT_ctu3bod1
Piros CLT_cha1bod1
Wiseman CLT_cwm3bod1
Elk CLT_wm1body
Natsume CLT_ctu2body
Rachel CLT_cbu5body
Gardenia CLT_cla2body
Terajima CLT_cha2bod2
BlackRose CLT_chb1body
Mistral CLT_cwm4body
Helba CLT_wm2body
I haven't had a chance to test all these, but if it doesn't work, just check the image name in hackstract. I.e. blackrose has chb1body.bmp just take the ".bmp" off and add "CLT_" to the beginning to get "CLT_chb1body"

As for the display picture in the registration event, just find the second occurence of "TEX_xwin_f18" in the iso and change it like you would the first one.

As far as why you can't get the sign characters to load, that's because the game doesn't treat the data.bin like one file, but like a container with several smaller files. I actually have some notes sonewhere on how this works from when i was doing a weapon model hack, but it's a little much to type out on a cellphone touchscreen (my thumbs are already killing me from all this). Gimme a little bit to find and organize them, and ill post them.
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

Very good catch! I can't believe I ignored those and paid them little to no mind.

Interesting notes on why I couldn't load the //SIGN characters. I did not think that there would be restrictions on a file basis but that does explain a few things actually. I am looking forward to reading those notes.

Also I can't help but think those tags you have up there are a little... off.

I've never seen the tag cmiybody before but have always seen Mia's tag as cbu2body

This is what I have for tags...

cbu1body - Balmung
cbu2body - Marlo
cbu3body - Mia
cbu4body - Orca
cbu4body - Rachel
ctu1body - Kite
ctu2body - Natsume
ctu3body - Moonstone
cla1body - Nuke Usagimaru
cla2body - Gardenia
cha1body - Piros
cha2body - Terajima Ryoko
chb1body - BlackRose - 1B01000
chb2body - Sanjuro - 1B42800
cwm1body - Elk
cwm2body - Helba
cwm3body - Wiseman
cwm4body - Mistral

Is there a different tag used for this sort of thing in different places in the data for the same characters?
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

The tags I posted were just the names of the CLUTs (color look up tables, aka pallattes), which are diffrrent from the model tags.

the data.bin is divided up into several small categories, or you could say files, as far as the game is concerned
CCSTBLs:

Code: Select all

(elf Symbol Name)  (First File)
cmnCCSTBL			framebuff.ccs
gcmnCCSTBL			xnoize1.ccs
demoCCSTBL			xwindow10.ccs
desktopCCSTBL		stfroll1.ccs
toppageCCSTBL		xdttopen0.ccs
effectCCSTBL		drain.ccs
equipCCSTBL			cw1hst00.ccs
skillCCSTBL			cbu0ski2.ccs
spcCCSTBL			cbu1body.ccs
pcCCSTBL			rtpc1.ccs
npcCCSTL			cnw1.ccs
gimmickCCSTBL		chgate.ccs
enemyCCSTBL			e1f1.ccs
bossCCSTBL			x01.ccs
townCCSTBL			town_z.ccs
fieldCCSTBL			t1.ccs
dungeonCCSTBL		sd1.ccs
eventCCSTBL			se1_1.ccs
categoryFDTbl in the elf just lists the positions of the CCSTBLs in the elf(when viewed in ps2dis), and I guess, consequently, memory. In theory, it should be possible to add extra entries into the table, if you can find a place to move it without overwriting anything important...

categoryFDTbl:

Code: Select all

0x002fb840	//cmnCCSTBL
0x0002fb980	//gcmnCCSTBL
0x002fbb10	//demoCCSTBL
0x002fbc20	//desktopCCSTBL
0x002fd3b0	//toppageCCSTBL
0x002fd410	//effectCCSTBL
0x002fd4f0	//effectCCSTBL
0x002fd730	//equipCCSTBL
0x00301390	//skillCCSTBL
0x00301650	//spcCCSTBL
0x003019a0	//pcCCSTBL
0x00302030	//npcCCSTBL
0x003023a0	//gimmickCCSTBL
0x00302a30	//enemyCCSTBL
0x00304140	//bossCCSTBL
0x003043b0	//townCCSTBL
0x00304650	//fieldCCSTBL
0x00305fc0	//dungeonCCSTBL
0x00306310	//eventCCSTBL
0x00383ec0	//directCCSTBL*
*directCCSTBL I have not, as of yet, figured out what the directCCSTBL does, in ps2dis, when you don't have a memory dump loaded, there's no data, and when you load one from standing in a town, it's just a bunch of "NULL"


cateCDOfsTbl lists the position each CCSTBL starts within the data.bin, note however, each entry appears to be a 64bit integer(8Bytes)

cateCDOfsTbl:

Code: Select all

//Offset in Data.bin	//Which Table
0x0000000000000000		//cmnCCSTBL
0x000000000000f800		//gcmnCCSTBL
0x00000000000ac800		//demoCCSTBL
0x00000000000f3000		//desktopCCSTBL
0x00000000011eb800		//toppageCCSTBL
0x000000000126b800		//effectCCSTBL
0x00000000012a2000		//effectCCSTBL
0x0000000001350800		//equipCCSTBL
0x0000000001822000		//skillCCSTBL
0x0000000001829800		//spcCCSTBL
0x0000000001c35000		//pcCCSTBL
0x0000000002025000		//npcCCSTBL
0x0000000002142000		//gimmickCCSTBL
0x000000000222d000		//enemyCCSTBL
0x0000000003035800		//bossCCSTBL
0x000000000350c000		//townCCSTBL
0x0000000004084800		//fieldCCSTBL
0x0000000005e97000		//dungeonCCSTBL
0x0000000007268000		//eventCCSTBL
0x0000000000000000		//directCCSTBL
each entry in one of CCSTBLs has the following structure:

Code: Select all

char ccsName[32] 		//32 bytes for the name
u32 offset				//position, starting from the CCSTBLs starting offset
u32 compressedSize 		//size of the compressed(gzip) CCS file in the DATA.bin
u32	uncompressedSize	//size of the CCS after it's been decompressed, this also happens to be the last 4 bytes of the compressed CCS file.
I'm pretty sure that the game is only looking in the spcCCSTBL category for the player and party member models, but the game has the sign characters in the pcCCSTBL(which I believe is the characters that roam the towns) for the models, which is why it's coming up with FILE NONE error.

As a quick test I swapped out the entry for cwm1body.ccs(elk) with csig_wm1.ccs (tsukasa) and updated the files offset to start from the start of the spcCCSTBL category, changed every reference in the iso of "cwm1body" to "csig_wm1" but i stil get a FILE NONE error. Will do more testing. An interesting thing to note, however is that all of the sign characters' files only contain 3 animations, nut4 (idle), wal0 (walk), and run0 (run)

The game must have some special code for using the ones we get as party members :-/
Xu Yuan
Posts: 1205
Joined: Tue Feb 28, 2006 1:32 am
Location: Harald in the R:2!

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by Xu Yuan »

This is some fantastic information, a lot of new things gleaned from those file names and where they are located.

I'd love to look deeper into the EquipCCSTbl in order to change the amounts of specific weapon types, if that's what is actually in there. Those skill files look interesting as well. I wonder if changing their labels will allow other characters to use those skill animations without causing their model to disappear.

And indeed... I have done the aforementioned test many times and always came up with the same error. I tried to also take Tsukasa's model and place it over Elk's in ROM, but my understanding of that is slim and each time it ended up in a crash.

The //SIGN characters as of this point may not have been intended to be playable characters yet, or they had not gotten around to programming them in properly. There is no reference to Tsukasa/Subaru/ or Sora (as far as memory serves) in the game's SPC files. But there are three "dummy" SPC spots that the game recognizes and these are likely eventually filled in to give us those characters as party members.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

The equipCCSTBL just lists all the files used for weapons. Not really useful unless you're modifying the data.bin. the skill files don't appear to contain object animation, and in fact I'm not even sure what they do contain. I haven't gotten far enough into decoding the animations to be able to guess what they do.
NCDyson
Posts: 28
Joined: Mon Jul 01, 2013 2:17 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by NCDyson »

So, I got my hands on a copy of fragment, and I'm actually not sure if I should be surprised or not that the PC models from fragment are compatible with infection. With a little bit of hex editing, I was able to get the Shugo model from fragment to load, seemingly without errors.

Image
The models from fragment even include the grunty riding animations, as well as the animation "hac4b", so in theory swapping out the models from there would work a lot better, though it does involve editing the data.bin and updating the associated tables. Unfortunately, I don't believe anything would allow you to use Animations from one class on another. The models are mostly all rigged to different skeletons, so you'd have to re-do the animations completely for each model, which isn't possible at this point. Even I don't have a good enough grasp on the CCS/CMP file format to do that.

I've been trying work on a program that would make editing everything we know about the game so far easier, but the GUI stuff gets tedious after a while. I do think I'll whip up a quick program for replacing files in the data.bin and automatically updating the associated tables. nothing fancy, just a simple command line utility.
elvss
Posts: 1
Joined: Fri Dec 17, 2010 11:33 pm

Re: Hacking .hack//Infection (How to make Skeith spawn anywh

Post by elvss »

thanks for the info nc dyson
User avatar
Slip
Posts: 28
Joined: Thu Jul 23, 2015 11:09 am

Re: Hacking .hack//Infection (How to make Skeith spawn anywhere)

Post by Slip »

Model editing sounds tough. :/ but the information you gave makes sense because when certain weapons are equipped on characters (that aren't of their original class), the models don't display. Though, some weapons from the Heavy Blade class will display the highlight when equipped on Kite. Haven't tested that on the other characters though.

I've been spending several hours just reading through the RAM in the game with CE and experimenting with it so I can completely map out the game's structure (and hopefully highlight a few bits of programming in the process). Making a huge document filled with addresses and information too, rather tasking but I love finding out things like this.

How would you go about hex editing in Shugo's model into the Data.bin? Find the filename associated with a model then copy-paste shugo's data into that place and hope it fits? Inb4 I break my data.bin, so I won't try until I have more information.
Post Reply