Forum: IDE HDD Discussion - Discussion about the use of the IDE HDD Interface and hdloader related discussion.


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Thread: Super Simple ELF patching (for HDLoader etc)
  

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1 Super Simple ELF patching (for HDLoader etc) 
    dlanor is offline Member
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    10,107
    Downloads
    5
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)
    Likes Given
    0
    Likes Received
    126
    Hi guys.

    Final Edit notes:
    -- I've produced a final release version of my package, now called
    -- "ELF_repack_BATs.zip" and decided to attach it to this, the first post
    -- of the thread, since that is what each newcomer will see on arrival.
    -- So get that final release from the attachment at the bottom of this
    -- post. (As yet it's not available anywhere else.)

    Old Edit notes (modified):
    -- I've removed the two batch listings from this text, as final
    -- versions of the files have been released since then.
    -- Most of the other text in this first post remains valid, so please
    -- read on if you like. (But the docs in the released zip are better.)

    I've noticed that several of you have problems with ELF patching,
    mainly because you're not familiar with the format and its needs.
    Well, neither am I, but experience has taught me ways to get
    around such limitations and learn the basics of new stuff quickly,
    and now I've come up with a solution that may be useful for many
    of you as well.

    NB: Those of you who are perfectly familiar with ELF formats,
    obviously don't NEED my help to handle them. But please hear
    me out anyway, as my solution may still be convenient for
    you as well, even though you don't really need it.

    I've simply made two bat files onto which you can drag-drop ELF
    files to unpack or pack, respectively. The real work is done by
    two readily available programs (more below) which are, however,
    much more complex in their abilities than most of us want to
    deal with normally, when we don't really need those features.
    (Which is why I created those bats for my own usage.)

    First of all, you need the two packer programs 'sjuncrunch' and
    'ps2-packer'. The first one is just a stand-alone exe file which
    you'll find at "http://www.oopo.net/consoledev/", and the other
    one is a zip archive found at "http://ps2dev.org/kb.x?T=1061".

    Unzip "ps2-packer-0.4-win32.zip" into a folder of your choice,
    though the rest of my text below will call it "ELF_repack\".
    Next copy "sjuncrunch.exe" into that same "ELF_repack\" folder
    (where ps2-packer.exe already resides).

    Then use Notepad or similar editor (NO wordprocessor) to make 2
    text files containing the texts specified below. I suggest you
    just cut and paste from the web page to be sure of getting it
    right. Save these files as well in the "ELF_repack\" folder,
    using the names "unpk_ELF.bat" and "pack_ELF.bat".
    (The names don't really matter, but make them descriptive.)

    Edit: ----- redundant bat listings removed from here -----

    When you drop an ELF file onto either of these bats, or onto any
    shortcut pointing to one of them (eg: useful on desktop), it
    will start by renaming the file to the same name, followed by the
    string ".tmp". That file will then be used as input to the real
    programs, with the original name used for the output file. Once
    the work is done, the .tmp file is erased, leaving you with the
    processed output file using the name of the original file.

    Effectively this means that you just pick up the original and drop
    it on a batch, which then magically changes the file as needed...

    Btw: When patching files, remember to always keep backup(s) of the
    untouched originals, no matter how good the patches may seem.
    Future (even more improved) patches may require virgin copies
    and if you forgot to keep some, you're up the creek with no
    paddle.

    Well, that's all for now. Happy patching everyone !

    Best Regards: dlanor

    PS: If unpacking results in an impossibly small file, such as a 1K file from
    a 600K original, then it means either that your original was unpacked
    already, or that it is damaged somehow. My bats can't know whether
    the ELF is packed or not, and sjuncrunch gives no indicatation except
    for showing zero-sized blocks and making a small file. You just have
    to be aware of this possibility yourself.
    DS.
    Attached Files
    Last edited by dlanor; 09-12-2004 at 06:14 PM.
    Reply With Quote  

  2. #2  
    dlanor is offline Member
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    10,107
    Downloads
    5
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)
    Likes Given
    0
    Likes Received
    126
    Hi again!

    Final edit notes:
    -- This post is no longer relevant, get the final release from the first post.
    -- The docs in it clarify the problems mentioned here.

    I found one problem with the ps2-packer, as used by my pack_ELF.bat.
    By default ps2-packer uses a new compression algorithm, which seems
    unsupported (naturally) by the older sjuncrunch. This means that ELFs
    packed by the current pack_ELF.bat can't be unpacked by unpk_ELF.bat.

    This will be easy to fix once I read up on the commandline arguments of
    ps2-packer, which I am now starting to do. I'll get back here later to
    edit that part of my original post, so as to ensure mutual compatibility
    between the two batch files.

    Best regards: dlanor

    PS: If anyone involved with the ps2-packer project sees this, please take
    --- note of this opinion:
    ----- In adding new modes to an existing format, one of the old modes
    ----- should be kept as the default mode, to maximize compatibility.
    ----- Power users who need the new modes will know how to get other
    ----- modes than the default anyway, unlike those who don't even know
    ----- that incompatible modes exist.
    --- No offense intended! So I hope none is taken...
    DS.
    Last edited by dlanor; 09-11-2004 at 03:12 PM.
    Reply With Quote  

  3. #3  
    espy is offline Member
    Join Date
    Aug 2004
    Posts
    122
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Pixel changed the default mode to the one that gives the best compression (which is the whole point of compressing). The old modes are there you just have to give the arguments. Not sure if pixel reads this particular forum but I am pretty sure the PS2-packer project is just him.
    Reply With Quote  

  4. #4  
    dlanor is offline Member
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    10,107
    Downloads
    5
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)
    Likes Given
    0
    Likes Received
    126
    Hi again!

    Final edit notes:
    -- The stuff in this post remains valid but is better explained in the docs of
    -- the final release package, now attached to the first post, at the top of
    -- this thread. Go get it ("ELF_repack_BATs.zip") from that post instead.
    -- Due to that release, I'm also removing the attachment that I placed in
    -- this post earlier.

    I've now investigated the compatibility problems with ps2-packer
    and sjuncrunch, as well as with ps2-unpacker. (alpha release!)

    The results are as follows: (As I [hopefully] understand them...)

    ps2-packer has NO packing method compatible with sjuncrunch.
    --- so ---
    sjuncrunch can NOT unpack any ELF packed with ps2-packer.

    Those are just two ways of saying the same thing,
    and it means that another unpacker is needed.

    ps2-unpacker can unpack ELFs packed with ps2-packer.
    (except for zlib compression, so avoid using that)
    --- but ---
    ps2-unpacker can NOT unpack ELFs that sjuncrunch can unpack.

    This means that ps2-unpacker can NOT replace sjuncrunch,
    and we will continue to need both of them in parallel.

    Thus the correct fix to my bat files is not just to change
    one of the two I made earlier, but also to add a third one
    that will use ps2-unpacker in a similar way. I chose to
    rename the one using sjuncrunch to "uncrunch_ELF.bat",
    and use the name "unpack_ELF.bat" for the new one.

    Proper usage for unpacking is now to start by dropping a
    copy (never work on unique originals) of your ELF onto
    "uncrunch_ELF.bat". If that produces a bigger file, then
    fine, you're done. But if it gives a smaller file, then
    you need to make another copy and drop that one onto
    "unpack_ELF.bat". If that too gives a smaller file, then
    that ELF was either unpacked already, damaged, or somehow
    incompatible with both unpackers. Normally that should
    never happen, unless someone insists on using the zlib
    compression with ps2-packer...

    All three bats are included in the attached ELF_repack.zip,
    and they should be stored in the "ELF_repack\" folder as
    described in my original post, together with sjuncrunch
    and ps2-packer as also mentioned in that post.

    You also need to download "ps2-unpacker-0.1.1-win32.zip" from
    the same site as ps2-packer, but another page. You'll find
    it at "http://ps2dev.org/kb.x?T=601". Unzip it and copy the
    "ps2-unpacker.exe" file to the same "ELF_repack\" folder I
    mentioned above, and you're all set to use the stuff.

    Best regards: dlanor
    Last edited by dlanor; 09-11-2004 at 03:18 PM.
    Reply With Quote  

  5. #5 Wink  
    Kormann's Avatar
    Kormann is offline Pizza Power!
    Join Date
    Apr 2003
    Location
    Brazil
    Posts
    179
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    A suggestion.. why not put a readme inside the .zip with what you said in this thread?

    Good work indeed

    []'s
    Kormann
    Reply With Quote  

  6. #6  
    dlanor is offline Member
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    10,107
    Downloads
    5
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)
    Likes Given
    0
    Likes Received
    126
    I do intend to add some documentation to the zip, but I don't feel like
    doing it right now. (Too many other things I want to spend time on.)
    As long as the zip stays here, all who get it can read what they need
    from the posts anyway, so a doc isn't ugently needed. Right ?

    Best regards: dlanor
    Reply With Quote  

  7. #7 Final release of ELF_repack_BATs.zip (with docs) 
    dlanor is offline Member
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    10,107
    Downloads
    5
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)
    Likes Given
    0
    Likes Received
    126
    Hi Guys!

    As promised earlier I have now made the effort to write some proper docs for my BATs, thus making it more of a real release package. I'll leave the other posts mostly intact though, except for adding some edit notes to ensure people get the real package from the first post.
    (That is the only attachment left in this thread now, anyway.)

    Best regards: dlanor
    Reply With Quote  

  8. #8  
    lostinnil is offline Member
    Join Date
    Sep 2002
    Posts
    83
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    I am new to ELF. May I know what is the difference between your 'unpack_ELF.bat' and 'uncrunch_ELF.bat'? How to decide which to be used when we have a unknown ELF file in hand? Thanks

    edit: Play around with it for a while I may already found out the answer I suspected. Does 'unpack_ELF.bat' utilise 'ps2-unpacker.exe' and 'uncrunch' utilise 'sjcrunch.exe' respectively? I had 2 ELFs and one only worked with 'unpack_ELF.bat' and the other only worked with 'uncrunch_ELF.bat'.
    Last edited by lostinnil; 09-12-2004 at 01:59 AM.
    Reply With Quote  

  9. #9  
    dlanor is offline Member
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    10,107
    Downloads
    5
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    2 Thread(s)
    Likes Given
    0
    Likes Received
    126
    Quote Originally Posted by lostinnil
    Does 'unpack_ELF.bat' utilise 'ps2-unpacker.exe' and 'uncrunch' utilise 'sjcrunch.exe' respectively?.
    Yes. This is clearly described in the new README. If you have somehow missed that info you must also have missed the new (final) release package, so go get it from the attachment I've added to the first post.

    Btw: If you ever wonder what a BAT does, why not have a look directly ?
    ---- BATs are just normal text files after all, though they are used to
    ---- send commands to an interpreter. But if you just right-click a BAT
    ---- and choose 'edit' in the context menu that appears, you get to see
    ---- the contents in notepad (or possibly some other editor you use).

    Quote Originally Posted by lostinnil
    I had 2 ELFs and one only worked with 'unpack_ELF.bat' and the other only worked with 'uncrunch_ELF.bat'.
    That is quite normal, and is explained in detail in the new README.

    Best regards: dlanor
    Reply With Quote  

  10. #10  
    HypERSoniC's Avatar
    HypERSoniC is offline Un Oceano en mis suenos...
    Join Date
    Jan 2003
    Location
    sydney ·:· :: · :.
    Posts
    1,724
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    1
    my bat file is better and much simpler
    by the way, you forgot to echo off
    HypERSoniC
    Reply With Quote  

Page 1 of 2 1 2 LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •