Romhacking => Newcomer's Board => Topic started by: Blank_User on April 20, 2014, 11:13:41 am

Title: reinserting files
Post by: Blank_User on April 20, 2014, 11:13:41 am
hello everyone,

sorry for bothering all of you but could someone teach me how to reinsert edited files in the original psx rom. thanks for the help in advanced :)
Title: Re: reinserting files
Post by: FAST6191 on April 20, 2014, 11:30:23 am
Assuming it is not one of the rare games that uses raw/LBA reads then
Open iso editor
Find replace file dialog (typically right click on the file in choice and press insert)
Find file on your hard drive and press OK
Many will do it there and then, others might want to save it to another file.

It is slightly easier for the PS1 I believe (it does not use some of the newer concepts for the iso format seen on the PS2 and beyond) so you might find something in the freeware world but most will find themselves using commercial software for insertion purposes. Most of the big iso handling tools in the ultraiso/poweriso/magiciso world will do this.

Inserting files to things with a filesystem is usually quite easy. About the only times it gets tricky are in cases where the game goes outside the filesystem (the playstation line has a habit, with Square (Enix) games being noted for it and such a thing typically being called raw/LBA reads), if the files have to stay in order (some stuff on the DS has this) though this is typically only a problem when doing a full rebuild of the iso, there is an archive format within the normal game (common everywhere), or a file has to be at a certain location.
Title: Re: reinserting files
Post by: Blank_User on April 20, 2014, 11:06:25 pm
I guess inserting files is not that hard but could you teach me how to fix the bugs. The files I edited is the script of the game and menu. Thanks for the reply ;D
Title: Re: reinserting files
Post by: BlackDog61 on April 21, 2014, 02:41:51 am
This is going to be a half-worked answer, because I have not tried, but can you not use the CD Gen tools from that package? (

(actually you might want to just delete this post...)
Title: Re: reinserting files
Post by: FAST6191 on April 21, 2014, 04:09:17 am
Fix bugs..... assuming you did not mean fix issues caused by my inserting a file then two schools of thought really

1) You play to the bugs.
I once saw a presentation on I think it was the unreal engine. There was a bug where object 57 or something was invisible, it turned out to be because of bad coding (a dev of the original game wanted to make an object invisible and forced it for object 57).
Solution. Make object 57 something small and use what you want in the object 58 slot instead.

If you prefer
"It hurts when I do this."
"Then don't do that."
It has the same pitfalls as that really.

2) You fix the bugs.
This might involve actual coding, it might involve something a bit higher level (pointers are not code but they are also something you can fix easily enough) or it might involve getting a bit creative -- say the devs left out a & symbol and you really need one for your hack, bonus is there is a left over character like ¬ which you really do not need.... guess what you get to draw over.
Otherwise yeah this is hacking and teaching you everything there is to know there is a bit outside the scope of a forum post.
Title: Re: reinserting files
Post by: Blank_User on April 23, 2014, 01:07:15 am
hello blackdog61,

can you give some of the tutorials on how to use the tools in there. it's my first time to psx scene that is why i have no idea how to use them.
Title: Re: reinserting files
Post by: Scio on April 23, 2014, 12:07:59 pm
Reinserting files is usually something you have to tweak on a game-by-game basis. So there isn't much of a tutorial on that, because every game is different. If what you're asking for is a tool that magically fixes all your bugs and issues with pointers, there isn't one. This may sound a little patronizing, but no one told you this would be easy.

If the game doesn't work at all after reinserting the files: you did something wrong
If the game works, but there are bugs everywhere: guess what, you have to fix them.
Title: Re: reinserting files
Post by: Blank_User on April 26, 2014, 03:38:05 am
hello scio,

i think you are right i thought also it would be easy but can you tell me how can i tell what kind of compression is use on the game.
Title: Re: reinserting files
Post by: henke37 on April 26, 2014, 08:11:25 am
Look for obvious signs. The first thing to look for is headers with markers that unambiguously state the exact compression used. The second thing to look for is typical data for common algorithms. Plaintext interrupted with control data that slowly starts becoming nonsense? Probably a runtime dictionary compression like lz77 or lz78. Tree followed by a bitstream? Huffman. Phrases followed by plaintext? Fixed dictionary. Small integers that rarely change sign? Delta coded.
Title: Re: reinserting files
Post by: Blank_User on April 26, 2014, 10:40:37 pm
ah ok. this is a great help for a beginner like me in the psx scene. thank you for the help.
Title: Re: reinserting files
Post by: MarkGrass on April 27, 2014, 03:26:21 pm
For extracting and replacing files, I highly suggest using CDmage B5.

If you're going for a huge hack, where many files are altered, then I would suggest simply rebuilding the ISO. This can very easily be done with 'cd-tool' or Sony's 'buildcd' - I don't think buildcd works on Win7+, however.

You'll want to be on the lookout for the following issues:

1 - Games that use check sum integrity (many CAPCOM games use this). In such case, you'll need to write your own check sum calculator and insert the table into the executable before every modification, no matter how big or small. If you replace a file that undergoes check sum integrity without updating the sum value, the game will simply black-out (crash). An alternative to this is to disable the check sum integrity via r3000a dis/assembly. When/if such functionality is located, you can use KC's armips for making the necessary changes.

2 - As mentioned, games that use hard-coded LBA tables (Squaresoft, CAPCOM, etc. use this). It is generally safer, faster and easier for the original developers to use this method, compared to generic PSY-Q SDK functionality. Again, a special tool will be required for such matters. To determine if a game uses an internal LBA table, insert a file via CDmage B5 and play the game to the point where you know when the file is going to be used. If the game doesn't crash, you probably don't need to worry about this. If the game won't even boot, or if the game crashes where the file is used, chances are extremely likely that the executable utilizes an internal LBA table in addition to performing file integrity check sum.

3 - Compression isn't a linear process for PSone games - just about every game developer for every game in existence use their own compression schematics. Yet again, this will require a special tool, only you'll have to reverse-engineer the specifications via r3000a dis/assembly. In any case where you get lucky (if the game/series is popular enough), chances are likely that someone else has already written tools for the cause.

4 - Most, but not all games for the PSone use Mode2/XA formatted disc types. In any other case, modification becomes a true painstaking process where rebuilding the ISO is almost always necessary.

All said, I would suggest starting small - replace a texture or two, see how it goes and eventually work your way up from there.
Title: Re: reinserting files
Post by: krat0s on June 17, 2014, 07:34:29 pm
hello blackdog61,

can you give some of the tutorials on how to use the tools in there. it's my first time to psx scene that is why i have no idea how to use them.

I am actually the uploader of those files. I suggest you to rread abit, google about PS1, and some you can actually start to understand whatyou are doing rather than just follow something.
Despite the fact that I am an uploader there is not too much info on them, i barerey use thwm. I have no interest on the PSX but I love the PS2.  Btw LBa prote4ction is quite common in PS2 games, but not too much on the PSX games,they are more famous for the LIBCRYPT protection.