Page 1 of 1
Extracting game data (images, textures and models)
Posted: Sun Sep 19, 2010 8:01 am
by Maikon
Hi sethioz!
I have this game I want to mod but the data I need to do this is stored in pkg files. It can't be extracted by conventional methods and I was browsing and searching them with hex-editor but nothing makes sense.
For now I just want to find some simple in-game pictures like portraits. I tried searching the usual formats in hex like jpg, gif etc but found nothing. So I think the data is encrypted.
Now as I understand (I'm not a programmer) if data is encrypted it must be decrypted when game is running. So I used tsearch to open the process and it's hex code.. if something is currently running on my game screen i.e. the pic I want to extract then it must be somewhere in the hex-code, right?
If I find manage to extract a piece of data this way I should be able to have some reference to decrypt the rest of the files I need for modding..
So my questions is can it be done? I don't want to lose time in vain... what I tend to do lot taking on tasks which are virtually impossible. I know this gaming company is very strict and paranoid when it comes to stuff like this. They didn't release the SDK or simple map editor even there were some promises in the beginning.
Thanks in advance...
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 19, 2010 8:19 am
by KEN
Maikon wrote:
I have this game
but which game?
y not mod it with img editor instead of hex?
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 19, 2010 8:42 am
by Maikon
KEN wrote:but which game?
rts order of war by [] enix
KEN wrote:y not mod it with img editor instead of hex?
I presumed there isn't one out for this game..and I usually changes textures with photoshop and models with 3dsmax...
i want to start small like by changing flag textures but can't access any of game data files...
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 19, 2010 1:40 pm
by Sethioz
first of, wrong place, this isnt hacking, its modding, so MOVED
secondly, name the game and more information about the game at start, that is most important.
i dont think that there is actual .jpg in the memory, it loads the file, but it never shows the filename. only some rare and old games might show it. that only happens, if game is pointed to a file and it loads it externally. like on websites, you can include off-site avatar. you point to a avatar path, this is why some games have like blah.jpg in the memory, otherwise it is just FJ((#()@$)@#R. exactly what you would see if you open picture with a hex or text editor.
so its useless to do what you tried to do.
however you were on the right track with Tsearch, but still not the way.
what you want, is the decryption key. that can be found using debugger. that is in case files really are encrypted, they might be just packed, instead of encryption.
in either case, im not a modder, but ive heard and seen things, so this is a job for Luigi's QuickBMS.
1. Here's the QuickBMS script for Order of War (next time post the fucking game title first, cuz pkg is used in other programs too and it says nothing. its the application that matters, not the .format).
http://aluigi.org/papers/bms/order_of_war.bms
2. QuickBMS >
http://aluigi.org/papers.htm#quickbms
that should be all you need.
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 19, 2010 7:20 pm
by Maikon
Thank you very much! This works fine, now I have the files I needed and can start modding.
Re: Extracting game data (images, textures and models)
Posted: Tue Sep 21, 2010 5:28 pm
by Maikon
Actually the extractor doesn't work as it should, today I got some time to look at them and all extracted files are unusable... first I thought it may be that dds files are protected but even the simple font ttf files are unusable... any other ideas? If not thanks anyway for the effort...
Re: Extracting game data (images, textures and models)
Posted: Tue Sep 21, 2010 7:44 pm
by Sethioz
you must ask Luigi about this problem, it might be that it does not extract them properly or maybe they really are encrypted too. i have never touched this game, so i cant tell. post the exact issue on his forum and see what he says.
Re: Extracting game data (images, textures and models)
Posted: Wed Sep 22, 2010 9:57 am
by Maikon
I was too hasty the extractor works just not on all pkg files... While data.pkg files extracted are unusable, models.pkg and units.pkg are extracted well. Probably data.pkg uses different script for unpacking then models and units.pkg. This is visible from .lua files of these files while in models they are clean and make sense in data.pkg they are all scrambled saying $#"&#&"% when extracted. I will contact Luigi on how to extract these data.pkg files and other stuff. Thanks again you helped me a lot!
Re: Extracting game data (images, textures and models)
Posted: Wed Sep 22, 2010 11:40 am
by Sethioz
there is one possibility you are not considering, some games do not have readable data at all. some games do use such data, that it only makes sense to game itself, that there's no data that any person can use or even read.
but see what Luigi says, might be different script as you said or encryption. would be nice if you post final solution here, after you contact Luigi. so thread would be complete, in case somebody else looking for this.
Re: Extracting game data (images, textures and models)
Posted: Thu Sep 23, 2010 12:09 pm
by Maikon
Hi, I have found out a few things since last visit. The most important that files quickbms extracted are neither compressed nor encrypted just packed some way conventional extractors don't recognize.. Only 2 files that are encrypted are data and game.pkgs, yet they aren't extracted properly and thus aluigi's xor key in bms script is useless (I informed his of this already). How do I know this: I used hex editor on extracted files and pkg and found extracted files hex-code to be the same as in pkg files. Then I copied same parts from pkgs to blank files and got functional files after renaming to right extension. Yet in data.pkg there is nothing similar to this in hex code.
Now to what I was trying to do... I made a custom flag for the game I want to insert into the game (DXT1 format, same size as original file). So I thought I can simply paste hex code of this modified file over the original hex code in pkg. Yet I couldn't paste directly files so big (pkg models has over 700mb) since program is reporting not enough memory to allocate. But there is a way around this. There is also a models_p1.pkg which is probably from a later update and contains newer version of some files from models and is very small. Then I tried to paste it to this smaller file in a way done in the larger one, yet when I do this nothing happens and pkg becomes unusable with quickbms extractor, it says "can't allocate negative bytes -124933495" or something like this. So I reckon that this models_p1 is now unusable by game too and it simply uses files from models... I tried to insert original flag.dds to same position and the same thing happens so I know problem is not with the new file but in a way I was trying to insert it. I am attaching you original flag dds and models_pkg in rar archive to this post, so please if u have the time try to look at them in hex and try to get it working in quickbms... then I bet it will work with the game engine too.
Re: Extracting game data (images, textures and models)
Posted: Thu Sep 23, 2010 1:13 pm
by Sethioz
yes i saw your thread on Luigi's forum.
as i said before, im not a modder, however if you do not have enought RAM to edit 700mb files, theres' a way around this. you can use filesplitter >
split the file into pieces, find the piece that holds the information you want to edit and edit it, then use filesplitter to put it back together again (it generates a .exe file that will do that for you).
if you are using HEX editor, then it should not corrupt the file. try using something lite, like XVI32
it can insert a string or replace it. its not 123 easy to use, but you'll find it out how to INSERT a string by increasing the file size, not overwriting existing bytes if its too small for your custom string or if your string is smaller than original, then it will reduce the file size.
hex workshop also works, but its massive.
i have 3gb ram, so i rarely have any problems with memory, that means i always edit files directly, but try this method.
Re: Extracting game data (images, textures and models)
Posted: Thu Sep 23, 2010 2:33 pm
by Maikon
Ha, ha! I don't know why I didn't thought of that, I have a splitter installed already, it so elegantly simple. Yes I'm using xvi32 btw. Thanks m8!
Here's somthng for ya:
Re: Extracting game data (images, textures and models)
Posted: Thu Sep 23, 2010 2:53 pm
by Sethioz
i see it worked fine with splitting. nice work on the flag :)
Re: Extracting game data (images, textures and models)
Posted: Fri Sep 24, 2010 6:14 pm
by Maikon
Sethioz can u take a look at these files: first is encoded txt files which I believe contains game dialogs for 1st mission (90% sure), and second contains actual text I rewrote from the game. Is it possible to find a way it is encrypted using these files?
Re: Extracting game data (images, textures and models)
Posted: Fri Sep 24, 2010 7:19 pm
by Sethioz
umm not like this, you need to find encyption key, which again is Luigi's field.
you should be able to find the key using olly, but i dont know details on how.
also it would require me to download the game, but im not interested in that game at all, ask Luigi and see if he knows anything about it.
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 7:04 pm
by Maikon
Sethioz, aluigi corrected his script and now works fine. I see that your'e online so a quick question, I have the file opened in hex and I know a key with which I need to xor encrypt it, how do to this? Is there an option inside xvi32 to do encryption?
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 7:15 pm
by Sethioz
uhm don't think that XVI32 can encrypt/decrypt files. there must be some special tool for this.
> his name is Luigi not aluigi (it comes from his name Luigi Auriemma)
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 7:36 pm
by Maikon
Sethioz wrote:uhm don't think that XVI32 can encrypt/decrypt files. there must be some special tool for this.
> his name is Luigi not aluigi (it comes from his name Luigi Auriemma)
yes it can, i got it but only partially, under xvi script go to editor --> insert command -> bitwise op -> bitxor....
now it works but only for key with lenght of one, it encodes all the places with this key, however it can't get it to works with longer stuff...
this is the scheme: BITOR <hex byte> [byte count]
if I only write first char of the code it encodes all the places in file with this char i.e. with 83. but how to get it to work with longer codes i don't understand... I have 50 char long code so this is a problem... it says something about syntax error, so I'll have to figure it out... i tried a few already but they didn't work, any ideas?
p.s. I know his name is Luigi, just this is his nick on his forum
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 7:43 pm
by Sethioz
i dont know much about encrypted and decrypting. google sounds like a good idea tho. try and see if there's any other hex editors that can do that, maybe it is limitation of XVI32 or just error in XVI32. after all its a small and fast tool, not meant to carry out big tasks.
as usual, you should update this thread once you get all working. and maybe if you feel like it, you could write article for my wiki. you have to PM me about this if you are interested.
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 7:50 pm
by Maikon
phuck! argh! i've tried every possible combination... hex after bit, the hexes first then bits later, separated them by , . / and other stuff I can think of but it simply doesn't work. perhaps you are right and xvi32 really can do encryption with multiple number codes... i will surf the web and report when this is solved. no problem i'll write you a complete detailed guide on how to mod this game once i finish but I have a lot of stuff to do and figure out before that. c you later, thanks for trying
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 7:59 pm
by Sethioz
maybe Luigi knows something. i saw your post, if im correct you did post it there, but he havent replied yet. he is more into decrypting and encrypting, im sure he will point out something.
check your PM
Re: Extracting game data (images, textures and models)
Posted: Sun Sep 26, 2010 9:14 pm
by Maikon
Luigi saved the day again, although I was onto something with xvi32 script... see here if anyone's interested:
http://aluigi.freeforums.org/post10944.html#p10944
Re: Extracting game data (images, textures and models)
Posted: Mon Oct 11, 2010 1:58 pm
by Maikon
Hi again, I've found out that this game contains hidden development tools for modding it inside. I've tried to activate it but with no luck. Here are the line that I suppose regulate it inside system.cfg file:
##############################################
#this param should be hardcoded later !!!!!
##############################################
minimap_draw_playable_zone 0
set dev_gui 0
set disable_video 0
use_unit_precaching 1
game fps hide
#game stats 0
So I basically change the set dev_gui from 0 to 1 but game won't run. So if these file were indeed hardcoded this change should make no difference, am I correct? So I found later GUI interface command for ths dev_tool and translated it from byelorus to english roughly because I thought the cyrrilic letters may be responsible for problem but with the same result. Any ideas?
Re: Extracting game data (images, textures and models)
Posted: Mon Oct 11, 2010 5:38 pm
by Sethioz
no ideas about this, just old good google i guess. dont have the game, so cant test
Re: Extracting game data (images, textures and models)
Posted: Mon Oct 11, 2010 6:50 pm
by Maikon
Ok, but unfortunately you can't talk with google and it's always good to have a discussion to get new ideas.
I have found a workaround. It seems that these .xml files require to have the same char count as originals. So since my files are smaller I just add a bunch of zeros in hex before encrypting. But this won't solve the thing for ones that are larger than original .
There could be 2 reasons for this I think. But first something about extracted files - they all start from same part of xor encryption what means they are encrypted separately. In same .pkg file I can replace original files with smaller or larger ones when it comes to textures and other graphic files with no problems. So problem is only text-file related. First reason is that there is a line which is encrypted with these files after the file hex-code so larger or smaller files lead to shift of xor code and misreading of that part. Second is that there is some kind of protection which forbids these files from being altered by checking it's size, and I really hope this isn't the case. I going to dig some more with hex-editor and find that hidden line if first case is true.
edit: right after this file there a new encrypted part which start for xor code beginning, so isn't the first case definitely, I'll contact Luigi for more info on how his extractor works and which parts are rejected as trash, answer must lie in there somewhere
Enabling eveloper tool
Posted: Mon Oct 11, 2010 10:40 pm
by Maikon
Breaktrough! I managed to enable developer tools to certain extent... And they work! For now nothing worthwile, just switching sides in game for now, but will figure out the rest I am certain... what's important is that it works! I'll keep you updated and hope will be able to release enabled and fully functional developer kit soon... There's still a lot of work ahead but this gives me hope.
ps also if anyone around here is a native russian speaker I would appreciate his help very much with translations, my native language is similar but only in some parts so it's pretty hard and translation I made are very clumsy
Re: Extracting game data (images, textures and models)
Posted: Mon Oct 11, 2010 10:48 pm
by Sethioz
not my field, but some games do have a file size check, like GTA 4, TDU ...etc, but there's always a file check disabler out there. so if thats the case, im sure there is a file check disabler out there, if not, you should ask Luigi about it.
ofc on smaller files, as you already stated, filling the file with zeros should work or that empty character (cant remember the HEX value for it)
Re: Extracting game data (images, textures and models)
Posted: Wed Oct 13, 2010 8:27 pm
by Maikon
hex value for empty char is 20. but anyways I have done all the necessary changes and yet can't find way to activate developer tools, at least the answer isn't in the external files since I have checked them all. so it must be somewhere in the .exe or was removed before game was released. but they left all necessary gui files for editor so I doubt that. i have extrated files from exe but can't find anything useful, please take a look you probably have more experience with this kind of files if u can find something that would lead to editor activation.
Re: Extracting game data (images, textures and models)
Posted: Thu Oct 14, 2010 6:21 am
by Sethioz
20 is space, not empty char.
3D or 3A is empty, something like that.
i tought you said that you enabled it ? took a quick look, but this isnt my field really (editing and modding). send the file link to Luigi, he should be able to tell you more about it.
Re: Extracting game data (images, textures and models)
Posted: Sun Oct 17, 2010 8:09 pm
by Maikon
yes i thought that I did, but it seems that dev_gui is actually a device gui not developer. I will leave this to rest for now, and p.s. it seems that exe files use zlib compression, can this help in decompressing these files. alsothere are refrences to non-existant files in some of lua scripts so these are probably compressed in exe
Re: Extracting game data (images, textures and models)
Posted: Sun Oct 17, 2010 11:18 pm
by Sethioz
isnt there tools for zlib ? i googled and found loads, no point to put links here.
thats all i can suggest for now, try decompressing using some zlib decompressor.
Re: Extracting game data (images, textures and models)
Posted: Tue Oct 26, 2010 5:11 am
by Maikon
oy, how is it going? well i need your advice again. i'm trying to enable 3rd campaign but only way to do it is by altering exe strings... but problem is that I don't understand them, here's an example so tell me whaddaya think:
4-0031fe19-0031fe38-0031fe49___009d9d9c/00dd9d9c ..... lbCampingName
eh, da i instructions:
"type"-"offsets where is pointed the string"_"offsets/rva of the string"
p.s. I used exestringz from aluigi's page to extract them, below is whole .txt with all the strings if u want to take a closer look
Re: Extracting game data (images, textures and models)
Posted: Tue Oct 26, 2010 6:37 am
by Sethioz
i dont get the point how it should work, cant help you with this. it would need deeper look, but i dont have game.
again go with the copy > paste method to make it load existing campaign, then try to figure out how to load yours.
Re: Extracting game data (images, textures and models)
Posted: Tue Oct 26, 2010 9:48 am
by Maikon
well that's the problem, i can't load even already existing campaigns to newly made slot. if i rename it to existing usa or ger it doesn't show also. so i think this function embedded somewhere inside exe, and i don't know how to rewrite it to make it work.
Re: Extracting game data (images, textures and models)
Posted: Tue Oct 26, 2010 5:53 pm
by Sethioz
well only thing i can think of is using a hex editor.
ive never done such mods, so cant help there.
a long shot, is to try
reshacker, but i doubt it can edit such things. its mostly for images, info and such.
think you need to turn to Luigi with with this matter.
Re: Extracting game data (images, textures and models)
Posted: Sun Nov 07, 2010 12:48 am
by Maikon
Hi,
Here is the stuff I learned about OoW modding. It will explain how to extract and put files back into game. I won't mod this game anymore since I found another game that better fits my theme (more infantry oriented) and is much more moddable and has a great modding community btw what's really important. Anyway for all of you who want to mod this game and since I promised to Sethioz here's is a guide how to mod this game. See you around and thanks again for the help!
p.s. if there is something unclear just ask, guide was rewritten in short time so I may have missed something...
Re: Extracting game data (images, textures and models)
Posted: Sun Nov 07, 2010 10:47 am
by Sethioz
alright cool, i might just rewrite it and put on knowledge database.
as about that other game you found, if you want, you can also write article that would fit on knowledge database. or post a full guide into new thread and i can take info from there and link to original thread from wiki.