News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Replace a chunk in a file with another file without losing file size  (Read 4802 times)

Jandazekon

  • Full Member
  • ***
  • Posts: 130
    • View Profile
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

  • Hero Member
  • *****
  • Posts: 5768
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Replace a chunk in a file with another file without losing file size
« Reply #1 on: March 16, 2012, 12:31:01 pm »
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

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #2 on: March 16, 2012, 01:31:19 pm »
I have to do this operation many times on different files.
And i can't programming!, copy/paste programming?

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Replace a chunk in a file with another file without losing file size
« Reply #3 on: March 16, 2012, 05:29:34 pm »
And i can't programming!
What better time to learn than now?

Jandazekon

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #4 on: March 17, 2012, 01:01:34 pm »
What better time to learn than now?
I feel bored.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6932
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #5 on: March 17, 2012, 01:41:59 pm »
Better while you feel bored than asleep. :P
"My watch says 30 chickens" Google, 2018

Jandazekon

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #6 on: March 17, 2012, 02:07:23 pm »
Better while you feel bored than asleep. :P
I don't know what you mean.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6932
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #7 on: March 17, 2012, 02:46:40 pm »
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

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #8 on: March 17, 2012, 02:59:01 pm »
I didn't know:
Quote
"I feel bored." was a certain famous Metal Gear line.

Mauron

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 543
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #9 on: March 17, 2012, 04:29:13 pm »
"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

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #10 on: March 17, 2012, 04:46:20 pm »
I 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?
« Last Edit: March 22, 2012, 01:25:51 pm by Jandazekon »

Jandazekon

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #11 on: April 02, 2012, 05:21:40 pm »
And still no one cares what i say.

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Replace a chunk in a file with another file without losing file size
« Reply #12 on: April 02, 2012, 06:26:26 pm »
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

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #13 on: April 03, 2012, 09:54:58 am »
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

  • Hero Member
  • *****
  • Posts: 4210
  • The cat screams with the voice of a man.
    • View Profile
Re: Replace a chunk in a file with another file without losing file size
« Reply #14 on: April 03, 2012, 11:22:08 pm »
I 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 devised by Satan. Go ahead dauntlessly! Make rapid progres!