Banner
Views: 762,540,836
Time:
12 users online:  1UPdudes, codfish1002, ECS.98,  FPzero, Imnever, JoeyJonJon,  Khastvrokg, Maxodex,  Nameless, slakkmichael, Teows,  Teyla - Guests: 42 - Bots: 344Users: 40,086 (1,940 active)
Latest: ehpatrol
SMWC3 Content Spotlight
Sixcorby's "slurdgery" Hack!
Not logged in.
Header Magic
Forum Index - SMW Hacking - SMW Hacking Discussion - Header Magic
Pages: « 1 2 »
http://byuusan.kuro-hitsuji.net/header-magic/

http://byuusan.kuro-hitsuji.net/header-magic/hm104.zip

Header Magic is a tool that extends ROM hacking tool that currently only work on headered ROMs, to also work on headerless ROMs as well.

This is not a simple "add header, run application, remove header" script. It truly extends applications to fully support and edit headerless ROMs in-place, while the tool is running.

It does this by hooking the Windows kernel32 file write functions to detect SMC and SFC files, and upon doing so, overrides file size, read and write functions to fake the presence of a header being there.

It will also detect when a ROM file *does* have a header, and treat the file normally. So in a sense, Header Magic ensures that your applications work seamless either with or without a header.

Header Magic was primarily designed due to FuSoYa's unwillingness to add true headerless support to Lunar Magic. However, the tool was created with FuSoYa's permission, which I am very grateful for. It is very important to note that absolutely no support for Header Magic will be provided by FuSoYa, so please do not mention it to him.

Note that Header Magic was designed in such a way as to work with not only all past and future versions of Lunar Magic, but also to work with *any* Windows application that lacks headerless ROM support. Simply edit Header Magic.cfg and point it at any application you like.

Also note that every application is different: if another application does something out of the ordinary, Header Magic may need to be modified or extended to work with it. The underlying theory is sound, however. Absolutely no modifications are made to the programs themselves.

The primary line of discussion and support is on my own forum:
http://board.byuu.org/viewtopic.php?f=9&t=1804

But if you refuse to post there, you can post here as well. Just don't expect an expedient response please.

Changelog:
1.04 - integrated HTTP download + unzip directly into downloader
1.03 - removed Lunar Magic from archive, added downloader
1.02 - fixed launching emulator from LM, and iron-proofed stability
1.01 - fixed file open dialog issue affecting some systems
1.00 - initial release
So it sounds like I won't ever have to bother with adding a header for tools that need it, removing it to test with bsnes for that minor change, then adding it to use that tool again? That sounds great! I'll be sure to test this.

World Community Grid: Thread | Team
 
Sounds good, but what if the program tries to read/write the header?

Celarix | [email protected] | Avatar by Uhrix
Additionally, how do we set this to work with other applications? When changing applicationName = "Lunar Magic.dll" to applicationName = "C:\Users\ALD\Documents\SMW\BTSD\Blocktool Super Deluxe.exe", I get "unable to open application". Does it only work with the program files in the same folder as the application?

World Community Grid: Thread | Team
 
I'm working on a stability fix by utilizing detours, so that I only have to overwrite DLL entry points one time. That should be out shortly, along with an improved launcher.

> So it sounds like I won't ever have to bother with adding a header for tools that need it, removing it to test with bsnes for that minor change, then adding it to use that tool again?

Yes, exactly. Of course, we won't know if tools are compatible with it until we try. This is where you guys come in: help extend Header Magic to work with other tools, and it becomes more universal for all =)

> Sounds good, but what if the program tries to read/write the header?

It will read back 0x00s for the header, and whatever it writes is ignored. Obviously, you can't store data in a header that isn't there. If there's a great need, I can make it read and write a separate <filename>.hdr file, but I'd prefer not to write to the user's hard drive if possible.

> Additionally, how do we set this to work with other applications? When changing applicationName = "Lunar Magic.dll" to applicationName = "C:\Users\ALD\Documents\SMW\BTSD\Blocktool Super Deluxe.exe", I get "unable to open application". Does it only work with the program files in the same folder as the application?

Yes, currently it needs to be in the same folder. I think I botched the paths for drag-and-drop on the last release, too.

I'll try and get this fixed up for the next release. In the mean time, please let me know if you get this to work with any other tools other than Lunar Magic. That'd be totally rad.
Moving the Header Magic files into the BTSD folder causes the same error. Renaming Blocktool Super Deluxe.exe to have a .dll extension doesn't work, but renaming Lunar Magic works, so it's not a problem with file paths.

World Community Grid: Thread | Team
 
I've posted hm102.zip above.

It should be 100% stable on every system now. Drag-and-drop on the launcher was fixed, the wait cursor upon launching issue was fixed, launching an emulator from within LM was fixed, and detours are used in place of constant function-rewriting.

The last part basically means disassembling and then reassembling code at a different location. Very involved, but it ensures rock-solid stability so it was worth it!

Ultimaximus, I don't know ... it should work. If it still doesn't work with hm102, then perhaps BTSD isn't a real Windows binary? .NET applications for instance are fake executables.
Yeah, BTSD uses .net.
Yeah, not sure what can realistically be done about that.

From what I've read, they have fake PE headers, and invoke the .NET run-time on them ... or something. I don't know if it's even possible to hook their functions or not.

That said, Lunar Magic seems somewhat special in that you're meant to run games while it is in use. This makes the add header, run app, remove header loop impractical.

Does BTSD do the same? If not, a fallback to the add+run+remove header loop could work. Otherwise ... .NET is known for being rather easy to decompile, so we could always try that ;)
Erm, byuu... if you recall, I did ask that you distribute this completely separate from LM. Check the "Legal Notice" section in LM's readme.txt file for more info.
Originally posted by Ayosuf
Erm, byuu... if you recall, I did ask that you distribute this completely separate from LM. Check the "Legal Notice" section in LM's readme.txt file for more info.


Oh my, I'm terribly sorry, but I missed that.

I tried my best to respect your work and wishes. I obtained your permission to make this first. Then, through substantial trouble, I avoided ever modifying your binary, not even in memory, not even to disable the CRC self-check or header check. I further still allowed headered ROM support, included your readme+help file, and added the readme asking people not to bug you about the application.

I've corrected the mistake by removing Lunar Magic from the archive, and I've uploaded a new version. Please accept my apologies.

It now uses wget and unzip to auto-download and extract the completely unmodified Lunar Magic archive if it does not exist, which should only be on the very first run. It fulfills FuSoYa's legal requirements to the letter; it only takes one second; and as an added bonus, it makes my package download 3x smaller! :D
Alright, thanks!
So I've been busy, but I tested it with Lunar Magic, and I no longer have anymore problems. It works great, and I highly recommend it to other users. Now to just try it with other programs...

(Mind if I submit it to the tools section, byuu?)

World Community Grid: Thread | Team
 
> (Mind if I submit it to the tools section, byuu?)

By all means, please do. The license is public domain.

The hm103.zip archive is the auto-downloading one designed to work directly with Lunar Magic, whereas header-magic_v01.tar.bz2 is the source code and generic binary meant to be extensible through a configuration file and such.

I'd recommend posting the former, since it's much easier to get started with. It pulls lm182.zip from tukuyomi's server, but you can also use your own copy/version of LM by placing it in the same folder as "Lunar Magic.dll". And if you want, I can make it pull lm182.zip from smwcentral.net instead.
It's completely fine, I really don't think it makes a difference.

What about when Lunar Magic is updated though? It'll have to be repointed to the new url, yes?

World Community Grid: Thread | Team
 
As it stands, yes it would.

I could make it fetch "lm-latest.zip" from somewhere, and then one simply needs to upload the new version with that archive name. We just have to make sure we point it at a web address that will remain valid as long as possible. Not too hard to do these days.

I'm sure you can also do it yourself by hex editing the main executable and updating the URL. Search for byuusan.kuro-hitsuji.net in the binary.

And of course, you'd want to thoroughly test each new version for compatibility first. So long as FuSoYa doesn't make any major changes, it should remain compatible.
Seems to me it'd be easiest to just include a shortcut to here: http://fusoya.eludevisibility.org/lm/program.html

That'll always have the latest program as long as fusoya keeps his website up, and no worries about keeping an updated version hosted elsewhere.
My goal is to keep the software as absolutely simple to use as possible.

I don't want the user to have to manually visit a website, or download a file, or even copy a file. Since I'm not allowed to include the file with the archive, that means I need to auto-download it. It's the only way to keep it exactly as easy to use as if I had included the file, while still fulfilling FuSoYa's custom licensing conditions.

But, that's closed source software for you.
You could always scrape the page to get the download link. It would work the same as you have now as far as the user is concerned.
hm104.zip has been posted.

I've written my own minimalist HTTP download (4KB source) and ZIP extraction (10KB source) code, which eliminates the need for wget.exe and unzip.exe in the archive.

It's now just my launcher EXE, my injector DLL and my readme file.

Also, it downloads from byuusan.kuro-hitsuji.net/header-magic/lunar-magic.zip now. So in theory, all we need to do is update that archive with the latest compatible Lunar Magic release. No need to update Header Magic itself for new Lunar Magic releases. Hopefully renaming the official archive is permitted, please advise if not and I'll make it read a text file to get the latest archive name instead.

Lastly, I removed hm100/101/102.zip, since they still had FuSoYa's binary in them, and were thus violating the license.
Pages: « 1 2 »
Forum Index - SMW Hacking - SMW Hacking Discussion - Header Magic

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 23

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented