Replace a chunk in a file with another file without losing file size

Started by Jandazekon, March 16, 2012, 10:47:58 AM

Previous topic - Next topic

Jandazekon

I look for a program that works with any file in hex format this way:

1. You choose the source file.
2. Then you write where a chunk starts and ends.
3. The chunk starts with for example 69 58 47 36.
4. And the chunk ends with 99 00 00 00 00 00 00 00 00.
5. You choose a file to replace the chunk with.
6. The chunk is now replaced and (00) zero spaces must now be added or deleted after (99 00 00 00 00 00 00 00 00) for the file to take exactly the same size as the source file.
7. A new file is then created with the same file extension as the first file.

Nightcrawler

If I had to do something like that one-off, I would just do it in a standard hex editor. Most hex editors can create new files, copy and paste, and fill x number of 00s. I use HxD for that kind of thing.

If you had to do this kind of operation many times, you'd probably have to write a quick program to do it. It would be easy to do in any programming language and even be a task a beginner could accomplish with a little reading on file access operations. I'm not sure of any ready-made program off-hand that does exactly what you describe.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Jandazekon

I have to do this operation many times on different files.
And i can't programming!, copy/paste programming?

snarfblam



KingMike

"My watch says 30 chickens" Google, 2018


KingMike

Sorry, I don't know why, but I first thing I thought when I saw "I feel bored." was a certain famous Metal Gear line.
"My watch says 30 chickens" Google, 2018

Jandazekon

I didn't know:
Quote"I feel bored." was a certain famous Metal Gear line.

Mauron

"I feel bored" isn't a famous line, but "I feel asleep" is.

If you're bored by the concept of taking up programming, you may end up doing this by hand. I don't see many other people being motivated to make one for you in this case.
Mauron wuz here.

Jandazekon

Quote from: Mauron on March 17, 2012, 04:29:13 PMI don't see many other people being motivated to make one for you in this case.
Can't someone make it for me?
How long should i wait?

Jandazekon


snarfblam

Are you asking other people to spend time making a program for you simply because you don't feel like doing it yourself? Yeah, I'm right on that!

Jandazekon

It's not a requirement. If they don't want to make it. They decide themselves. I can't do it myself. I only have imagination without knowledge.
And with only imagination. I can only use mspaint to draw and paint my imagination ideas. And i have no knowledge to make them reality.

Jorpho

Quote from: Jandazekon on April 03, 2012, 09:54:58 AMI can't do it myself. I only have imagination without knowledge.
You can learn and thus acquire the knowledge.

If you need a starting point, I suggest taking a whack at it with Python.  This module looks particularly well-suited.  Or maybe mmap would be most straightforward.
This signature is an illusion and is a trap devisut by Satan. Go ahead dauntlessly! Make rapid progres!