H4ResourceEditor

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.
User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 14 Jul 2023, 04:59

Okay so I think I've got importing mp3's settled for real this time.

The field I didn't know was already known and I either meant to come back around and finish it up, or just missed it here.

The field is the decoded length in bytes of all samples in the file. So, by getting the duration of the file in seconds and multiplying it by the sample rate and 4, you get the number of bytes. (multiplying by 4 since 32 bits per sample is 4 bytes per sample). I'm now figuring out what the bits per sample for the imported track is in case it's different than the usual 32 bits per sample.

The only thing I need to figure out is getting the number of channels from the mp3 library I'm using since it just has a string with channel names instead of just a number of channels. Might be overthinking that, but I don't really know much about music format so right now it's just assuming Stereo (2 channels).

I should probably test out .wav files again just to make sure I didn't break anything there, but then I'll upload the updated resource editor with fixed importing of mp3's :D

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 16 Jul 2023, 04:25

Went ahead and updated the resource editor (link in original post).

Fixed importing and exporting mp3's.

User avatar
Grythandril
Leprechaun
Leprechaun
Posts: 19
Joined: 06 Jan 2006
Location: Grythandril

Re: H4ResourceEditor

Unread postby Grythandril » 17 Jul 2023, 22:13

Hi still having problems

Donloaded the latest progam

tried to change 2 tracks combat 5 and grass by imporing the mp3

I then save as h4r file

but when i open it up in in H4ResourceEditor it wont play

what am i doing wrong?

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 18 Jul 2023, 03:50

Grythandril wrote: 17 Jul 2023, 22:13 Hi still having problems

Donloaded the latest progam

tried to change 2 tracks combat 5 and grass by imporing the mp3

I then save as h4r file

but when i open it up in in H4ResourceEditor it wont play

what am i doing wrong?

Again, please upload the files somewhere, specifically the mp3's you're trying to import, so that I can access them and figure out what's going on. I can't help you if I can't see the problem. If the tracks won't play in the resource editor, then I feel like you're not actually using the latest.

What exactly are you doing? Try listing out all of the steps you are taking, starting with which file you are opening first. Are you using file association with H4ResourceEditor.bat, so that you can double click h4r / h4d files to open them easier? Or are you double clicking H4ResourceEditor.jar and then File->Open to open music.h4r?

If you're opening the h4r file, and then opening the music track from there, are you remembering to save the h4d file after importing your mp3? You need to create the modded h4d files that you then pack into new.h4r (new_mod.h4r for Equilibris). Then you put a copy of your new.h4r / new_mod.h4r into your data folder and it will work.

I just imported a bunch of Lord of Magic mp3 tracks to all combat and town tracks, as well as the main menu, and they all worked just fine.

User avatar
Grythandril
Leprechaun
Leprechaun
Posts: 19
Joined: 06 Jan 2006
Location: Grythandril

Re: H4ResourceEditor

Unread postby Grythandril » 18 Jul 2023, 07:11

will do and give a step by step list of what i am doing

One question - when you uploaded your new music files are you meant to keep to the same length as orginal heroes 4 music files?

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 18 Jul 2023, 20:53

Grythandril wrote: 18 Jul 2023, 07:11 will do and give a step by step list of what i am doing

One question - when you uploaded your new music files are you meant to keep to the same length as orginal heroes 4 music files?

Nope, file length and track length don't matter. I just downloaded all the Lords of Magic faction, battle, adventure map, and menu themes and imported them into the town, battle, adventure map, and menu h4d files.

User avatar
Grythandril
Leprechaun
Leprechaun
Posts: 19
Joined: 06 Jan 2006
Location: Grythandril

Re: H4ResourceEditor

Unread postby Grythandril » 22 Jul 2023, 17:07

I manage to get this done but not sure if that was the right process

This is the steps I took

1. Downloaded latest H4sresourceEditor program
2. Put H4sresourceEditor into my documents folder
3. Created new sound files for the H4
4. Made sure .Mp3 file are 32bit,128kbps & bit rate of 44100hz like originals.
5. Renamed new according to the file name of H4

H4 file name--------------------------Music from
sound.combat.lose-------------------Heroes 4 original
sound.combat.music.1--------------Heroes 4 original
sound.combat.music.2-------------- Heroes 4 original
sound.combat.music.3--------------Heroes 4 original
sound.combat.music.4--------------Heroes 3 combat 2
sound.combat.music.5--------------Heroes 1 combat 1
sound.combat.music.6--------------Heroes 6 Haven Siege
sound.combat.start------------------Heroes 4 original
sound.combat.win--------------------Heroes 4 original
sound.credits--------------------------Heroes 6 Credits 02
sound.end_turn-----------------------Heroes 1 & Heroes 2 AI turn
sound.main_menu--------------------Heroes 4 original
sound.terrain.Dirt--------------------Heroes 2 Dirt
sound.terrain.grass------------------Heroes 4 Wandering (unused)
sound.terrain.Rough-----------------Heroes 2 Rough
sound.terrain.Sand-------------------Might & Magic Heroes Online Fang bay Harbour
sound.terrain.Snow------------------Heroes 4 Shades of Darkness Snow
sound.terrain.Subterranean------- Heroes 6 Underground
sound.terrain.Swamp--------------- Heroes 6 Swamp 02
sound.terrain.Volcanic--------------Heroes 2 Lava
sound.terrain.Water-----------------Heroes 4 original
sound.town.chaos--------------------Heroes 3 Dungeon
sound.town.death--------------------Heroes 3 NecroTown
sound.town.life ----------------------Heroes 6 Haven
sound.town.might--------------------Heroes 6 Stronghold
sound.town.nature-------------------Heroes 5 preserve
sound.town.order--------------------Heroes 5 End credits

6. Double click to Open H4ResourceEditor
7. Click file
8. Click New an select H4r container press ok
9. This creates a new.h4r directory
10. Click File then Add and change to all file types select all the mp3
11. Click save
12. this will create a sub directories for the music names.
13. Click file and save
14. Save as new.h4r
15. I had to close down the program as it would not open each music name
16. Double click to Open H4ResourceEditor again
17. Click file
18. Click Open and changed file type to .h4r and selected new.h4r and clicked open
19. Clicked each track file in the directory
20. Right Click and click open
21. A popup box appears with the sound file name in .h4d
Press Play to make sure the you hear the sound
If you do then click file save as .h4d
22. If sound does not play then
click file then import sound and select required mp3 and click open
Press Play to make sure the you hear the sound
if you hear music the click file save as filename.h4d
23. Keep doing this until all tracks are save as h4d
24. For some reason the original heroes mp3 work when doing (step 21)
25. For new music tracks I had to follow (step 22)
26. I made sure the file names were the same in the pop box for each music track.
27. Once all the h4d are loaded in
28. I save the file as music.h4r
29. Then moved them into the data folder in the game


but thanks

It great to hear different music tracks for heroes 4

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 23 Jul 2023, 00:54

Grythandril wrote: 22 Jul 2023, 17:07 I manage to get this done but not sure if that was the right process

Looking at your process I'm not sure how you got it to work, though it isn't your fault. There isn't a nice written how-to-use write up for the h4 resource editor. The way you should be doing things is as follows:

1) Open music.h4r and extract the h4d files for the tracks you want to replace. Ie expand the node tree and right click on sound.combat.music.4, and extract it to the directory of your choice.

2) For each of the h4d files you extracted, do the following: Open the h4d file. I use file association so I can just double click the h4d file to open it. If you're not using file association you'll need to use the resource editor, File->Open and select the h4d file. Once the music file is open, from the music file window File->import sound. Select the mp3 file you want for the sound. File->Save.

2.5) After you have done the import AND saved for the new mp3 file, you can click "play" to hear the track. There may be a bug where playing it directly after import won't let you save over the file when File->Saving, so check them after you have imported AND saved the sound files.

3) After you have done the previous for each of the h4d files you are replacing, create a new h4r file. File->New in the h4 resource editor, select h4r container.

4) File->Add each of the updated h4d files. If they are all in the same directory, you can ctrl + click each file in the file chooser dialogue.

5) File->Save as new.h4r

6) Place new.h4r in the Data folder and profit.

User avatar
Grythandril
Leprechaun
Leprechaun
Posts: 19
Joined: 06 Jan 2006
Location: Grythandril

Re: H4ResourceEditor

Unread postby Grythandril » 25 Jul 2023, 20:13

i did what you suggested and it worked which was easier than the way was doing it

However i noticed that when you replace the sound file file you have to save it as a new h4d file because it will not overwrite the existing one.

So i was able to change the terrain music with heroes II terrain music and change the towns music to heroes III music.

Thanks

Much apprreciated

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 25 Jul 2023, 21:49

Grythandril wrote: 25 Jul 2023, 20:13 i did what you suggested and it worked which was easier than the way was doing it

However i noticed that when you replace the sound file file you have to save it as a new h4d file because it will not overwrite the existing one.

So i was able to change the terrain music with heroes II terrain music and change the towns music to heroes III music.

Thanks

Much apprreciated

Yeah, if you played the sound right after importing it, instead of saving first, I believe that locks the file for some reason. It could be something else though, since I haven't really tried to figure it out yet. I always save right after importing. Hmm, or maybe it's because I don't save the files in the same place. I keep a directory for the un-modded h4d files and a directory for the updated h4d files to make it easy for me to redo anything I need to.

I'll pay closer attention to this issue when I update my Lords of Magic music mod and see if I can at least figure out what's causing it. Then there's also a Final Fantasy music mod I'll be putting together :)

Either way, glad the resource editor was able to help you get your desired music tracks into the game!

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 21 Nov 2023, 22:00

Hello!

The resource editor has been updated.

- The resource editor has been updated to no longer require users to install Java. The necessary JRE is now included with the resource editor, and the main jar file is now wrapped by an exe. This means that everything is ready to go once you download and unpack the resource editor.

- Updated to use the system look and feel. No more default Java (metal) look and feel.

- Added text coloring indicators. Blue text indicates the file is a redirection to another file. Red text indicates a missing file or bad format.

- Many other minor fixes and updates.

Rejko97
Leprechaun
Leprechaun
Posts: 2
Joined: 21 Jun 2024

Re: H4ResourceEditor

Unread postby Rejko97 » 21 Jun 2024, 18:46

Hey, not sure if still is still alive since I stumbled upon this only today, but for some reason H4ResourceEditor still requires Java Runtime Enviroment 1.8.0_0 - 1.8.0_381.

Also unrelated to this, but the site heroescommunity is dead? I can't access it, I have blank white page with: Access denied for user ''@'localhost' (using password: NO)

The only thing I wanted from this is to change hero portraits, in the past(like 5 years ago), I used H4fk095 from http://modhomm3.free.fr/heroes4/h4_face_kit.htm , but today I can't seem to run it, it just tells me: Name length is overflow!

Any help would be much appreciated!

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 22 Jun 2024, 22:37

Rejko97 wrote: 21 Jun 2024, 18:46 Hey, not sure if still is still alive since I stumbled upon this only today, but for some reason H4ResourceEditor still requires Java Runtime Enviroment 1.8.0_0 - 1.8.0_381.
That's very odd. When I run the resource / advanced editors on my desktop, which does not have any Java installed, they start up right away and work as expected.

Do you have any more information here? Do you have the latest version with an exe instead of a jarfile? What happens when you double click the exe? Screenshots?

It does still use Java 1.8, but the jre is packaged up and distributed along with the resource editor.
Rejko97 wrote: 21 Jun 2024, 18:46 Also unrelated to this, but the site heroescommunity is dead? I can't access it, I have blank white page with: Access denied for user ''@'localhost' (using password: NO)
HeroesCommunity does seem to still be down. It's been down for a few days now.
Rejko97 wrote: 21 Jun 2024, 18:46 The only thing I wanted from this is to change hero portraits, in the past(like 5 years ago), I used H4fk095 from http://modhomm3.free.fr/heroes4/h4_face_kit.htm , but today I can't seem to run it, it just tells me: Name length is overflow!

Any help would be much appreciated!
I don't know anything about facekit, but the resource editor can easily update / edit portraits. Just extract the hero portraits files and then it depends on your workflow preference.

If you just want to change a few portraits, you should be able to insert single png files. As long as you use the same name as the layer, it should overwrite the current portrait. Then make sure to save.

The other way is to export either as ora or png, modify the portraits, and then import back into the layers file and save.

After that, create a new h4r file, File->New, add your layers file, save it (new.h4r for Wow, new_mod.h4r for Equi), and drop it in your data folder.

Rejko97
Leprechaun
Leprechaun
Posts: 2
Joined: 21 Jun 2024

Re: H4ResourceEditor

Unread postby Rejko97 » 23 Jun 2024, 14:27

Yes I have the latest version, although I downloaded the file again today and suddently it works with not java version error, no idea what or how it fixed itself by I'll take it haha.

So I've been fiddling with H4ResourceEditor for a few minutes and got a couple questions. If I want to replace portraits, do I need to do it only in heroes4.h4r? or also storm.h4r or where everywhere do I need to replace it. I've got the game from GOG if that matters. (And the path is I assume Layers, icons, hero and their respective faction right?)

HeroesCommunity it would be a shame if they were to shutdown the site, there was quite a lot of useful info about HOMM games.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 779
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 24 Jun 2024, 13:03

Rejko97 wrote: 23 Jun 2024, 14:27 Yes I have the latest version, although I downloaded the file again today and suddently it works with not java version error, no idea what or how it fixed itself by I'll take it haha.
Maybe just a corrupted download!
Rejko97 wrote: 23 Jun 2024, 14:27So I've been fiddling with H4ResourceEditor for a few minutes and got a couple questions. If I want to replace portraits, do I need to do it only in heroes4.h4r? or also storm.h4r or where everywhere do I need to replace it. I've got the game from GOG if that matters. (And the path is I assume Layers, icons, hero and their respective faction right?)
You'll want to follow my instructions above for your question :) You normally don't want to mess with the game files so that you don't corrupt them, so you should create a new h4r file that you add your modded h4d files to (and name the h4r file correctly for the version you are playing: WoW or Equilibris). You only need your one new h4r file with any modded files inside.

You do need to start with layers file that has all of the expansion portraits, so probably in one of the expansion h4r files. You'll be able to take a look before I have the time to verify :)

Let me know if you have any more questions!

User avatar
Pol
Admin
Admin
Posts: 10129
Joined: 29 Nov 2005
Location: IN SOMNIS VERITAS
Contact:

Re: H4ResourceEditor

Unread postby Pol » 29 Jun 2024, 20:58

Rejko97 wrote: 23 Jun 2024, 14:27 HeroesCommunity it would be a shame if they were to shutdown the site, there was quite a lot of useful info about HOMM games.
You know, life of old sites is pretty rough. Thankfully they are back. :D
"We made it!"
The Archives | Collection of H3&WoG files | Older albeit still useful | CH Downloads
PC Specs: A10-7850K, FM2A88X+K, 16GB-1600, SSD-MLC-G3, 1TB-HDD-G3, MAYA44, SP10 500W Be Quiet


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 4 guests