Zeldix Magic
Zeldix :: Zelda III Hacking :: The Archives :: Zeldix Magic
Page 5 of 8
Page 5 of 8 • 1, 2, 3, 4, 5, 6, 7, 8
Re: Zeldix Magic
Small update. I am in the process of coding a graphic readers reader. This is all thanks to the documentation linked by Zarby, thanks! So far I've coded a decoder for NES formats. Currently, only 8 by 8 metatiles exported. I will code later a means to store these tiles into a list so that they be all written to a bitmap. The code is on GitHub.
One minor issue is that it appears that bitmaps have incorrect headers, some file viewers don't care.
One minor issue is that it appears that bitmaps have incorrect headers, some file viewers don't care.
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
I'm a bit busy, but zarby89 has publicly posted Hyrule Magic source code for the dungeon editor on his github!:
https://github.com/Zarby89/DungeonEditorZelda/blob/master/HM.cpp
https://github.com/Zarby89/DungeonEditorZelda/blob/master/HM.cpp
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
Great. I don't get it, where did he get it. This should ease up making a new dungeon editor.Trovsky wrote:I'm a bit busy, but zarby89 has publicly posted Hyrule Magic source code for the dungeon editor on his github!:
https://github.com/Zarby89/DungeonEditorZelda/blob/master/HM.cpp
Puzzledude- Since : 2012-06-20
Re: Zeldix Magic
Puzzledude wrote:Great. I don't get it, where did he get it. This should ease up making a new dungeon editor.
zarby89 PMed me saying he got it from the exe. I'm looking at the exe in raw ASCII, apparently there's uncompiled source code in its terribly coded glory. 265.6 KB of uncompiled source code! The source code goes from 0x85A0 to 0x92FF. Rather fortunate it was the dungeon editor code, eh?
Last edited by Trovsky on Mon 16 Jan 2017 - 1:23; edited 1 time in total
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
I'm looking at the code and the code features:
As for the code quality:
In the end, I'm really not too surprised by any of this. Hyrule Magic is super buggy and the author has refused to release the source code in the past. I wish Sephiroth3 swallowed his pride and released the code despite the quality, I would've been far less critical if so.
IF ANYONE HAS AN EARLIER VERSION OF HYRULE MAGIC THAT PREDATES THE ONE ON ROMHACKING.NET, OPEN IT UP WITH A HEX EDITOR AND SEE IF YOU CAN FIND ANY MORE SOURCE CODE.
- Dungeon editor code
- SPC editor code
- Overworld editor code
As for the code quality:
- Lots of variable names with one letter
- Lots of variables named "blah"
- Lot's of uncommented code that does not speak for itself
- I think all 8000 lines belong to one class.
- I don't see a lot of data structures outside of arrays.
- I presume this comment is a note left by Sephiroth3 to fix something that never got fixed:
// FIX!!!!
memcpy(ed->hbuf, rom + 0x28000 + i, 14); // copy 14 bytes from the i offset.
In the end, I'm really not too surprised by any of this. Hyrule Magic is super buggy and the author has refused to release the source code in the past. I wish Sephiroth3 swallowed his pride and released the code despite the quality, I would've been far less critical if so.
IF ANYONE HAS AN EARLIER VERSION OF HYRULE MAGIC THAT PREDATES THE ONE ON ROMHACKING.NET, OPEN IT UP WITH A HEX EDITOR AND SEE IF YOU CAN FIND ANY MORE SOURCE CODE.
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
There you go:
http://www.bwass.org/bucket/HM.zip
these are all known versions:
-964 (current, also on romhacking)
-963 (what everyone was using until SePH found out that 964 is actually different)
-962 (older version)
there was also 960 or 96 however this one is nowhere to be found and obsolete.
I hope you can find some more helpful code in there.
http://www.bwass.org/bucket/HM.zip
these are all known versions:
-964 (current, also on romhacking)
-963 (what everyone was using until SePH found out that 964 is actually different)
-962 (older version)
there was also 960 or 96 however this one is nowhere to be found and obsolete.
I hope you can find some more helpful code in there.
Puzzledude- Since : 2012-06-20
Re: Zeldix Magic
Thank you. There's different source code in version 963, but nothing in version 962. It seems that Sephiroth3 switched to Visual Studio in version 963 judging by this code at the end of the file (this explains the leaked code):Puzzledude wrote:There you go:
there was also 960 or 96 however this one is nowhere to be found and obsolete.
I hope you can find some more helpful code in there.
D:\Visual Studio 6.0\MSDev98\MyProjects\Hyrule Magic Source\HMagic\Debug\HMagic.pdb.
Thanks Microsoft! And to think the source was under our noses the whole time. The source code this time is from 0x86EF0 to 0xC72EF.
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
Version 963 more or less has same content as version 964 but here you go:
http://www.bwass.org/bucket/Hyrule_Magic_Source_Code_(v963).txt
EDIT: Version 963 has some additional methods, Editblocks and z3dlgproc, because the source code is a bit shorter in length.
EDIT2: On the topic of leaked source code, I wonder if Black Magic has any. I can't find any builds on the internet.
http://www.bwass.org/bucket/Hyrule_Magic_Source_Code_(v963).txt
EDIT: Version 963 has some additional methods, Editblocks and z3dlgproc, because the source code is a bit shorter in length.
EDIT2: On the topic of leaked source code, I wonder if Black Magic has any. I can't find any builds on the internet.
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
Seems like the shortcuts are all gone, so here's the re-upload of the Black Magic editor (alpha 09 as the release was called):On the topic of leaked source code, I wonder if Black Magic has any. I can't find any builds on the internet.
http://www.bwass.org/bucket/Black_Magic_a09.zip
I don't have the source obviously for BM. Regarding the changes. BM does a lot of things better, specially the overworld area pointers and possibility of data expansion for overworld areas, as well as indoor room-header expansion.
I think BM however can not edit dungeons at all. But still I hope you can find something useful.
Puzzledude- Since : 2012-06-20
Re: Zeldix Magic
Puzzledude wrote:BM does a lot of things better, specially the overworld area pointers and possibility of data expansion for overworld areas, as well as indoor room-header expansion.
I think BM however can not edit dungeons at all. But still I hope you can find something useful.
I found an assembly patch related to overworld expansion. That's about it:
http://www.bwass.org/bucket/Black_Magic_a09_(Source_code).txt
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
Alright, Zarby gave me all of Black Magic's source code. So here you go everyone:
On github: https://github.com/trovsky/Black-Magic
On bwass.org: http://bwass.org/bucket/Black_Magic_src_a09.zip
On github: https://github.com/trovsky/Black-Magic
On bwass.org: http://bwass.org/bucket/Black_Magic_src_a09.zip
Last edited by Trovsky on Wed 18 Jan 2017 - 0:53; edited 1 time in total
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
I realize now that this thread should be in the projects topic. Can an admin move this?
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
But you can move it too, since any Moderator can. It should be just below the thread under "quick tools".
Puzzledude- Since : 2012-06-20
Re: Zeldix Magic
So does this mean Black Magic will no longer be necessary? if so then this new program will be like the Zone Doctor, which was a replacement of FF6LE.
wizzrobemaster- Ganon
- Since : 2015-01-04
Re: Zeldix Magic
Puzzledude wrote:That's not really the HM thing, it is the game thing.I, for instance, would like to include the extra dungeon found in the GBA version but the limitation of Hyrule Magic of not being able to create new stuff without deleting something else is a huge bummer.
ALTTP simply will not allow more than 319+1 rooms.
Note: original is using 295+1.
And yet these additional rooms were reserved for houses and caves only, they can not handle dungeons (at least not dungeons with multiple entrances).
Max use for dungeons is from 00 to FF, which makes it 255 rooms +1= Ganon room= room0.
ALTTP however has around 20 percent of all rooms unused (empty) in the 295+1 section. This is something which hacks can use, however again not with HM, as it has a data limit. Also, filling all rooms completely is a bad idea in general for additional bugs as the data "overflow" might cause.
This basically means you are more or less limited to what the original game had, but you can add a little extra rooms. I would say, you can squeeze in around 15-20 more HM rooms max, however these rooms were already predesigned in which dungeon they will go, so making a brand new dungeon is doable, but the global grid of such a dungeon would be extremely limited, ie would need lots of staircases or warps to actually come to the empty rooms on the grid.
Not sure how they handled this in the GBA, but obviously this should thus be compatible, as other dungeons are the same, so the leftovers (empty rooms) should match with what is empty on the room grid between GBA and SNES versions.
Didn't the GBA port have more memory which allowed for a bonus dungeon to exist or did it use up left over data from the SNES version?
wizzrobemaster- Ganon
- Since : 2015-01-04
Re: Zeldix Magic
I actually have not looked into the GBA version at all, so it could be both: either the unused rooms were used, or they expanded the number of rooms all together.Didn't the GBA port have more memory which allowed for a bonus dungeon to exist or did it use up left over data from the SNES version?
Puzzledude- Since : 2012-06-20
Re: Zeldix Magic
(Notes: the top window's color doesn't use the palette seen in the program as of now)
The graphic viewer is now more user friendly. I tried to read palettes from the ROM. Currently, 4BPP mode uses Link's green tunic palette. Unfortunately, 3BPP and 4BPP mode have a bug that has the converted Bitmap images skip palettes therefore using invalid palette values, currently a hack fixes this so the program doesn't crash. Currently, Link at 0x80000 uses the wrong colors as seen above.
How I interprets SNES colors:
x = unused ... unless you are ZSNES
b = blue
g = green
r = red
x0 b0 b1 b2 b3 b4 g0 g1 g2 g3 g4 r0 r1 r2 r3 r4
To interpret the green part of the color, I do:
blue =
b0 * 2^(0) +
b1 * 2^(1) +
b2 * 2^(2) +
b3 * 2^(3) +
b4 * 2^(4)
If anyone could help, that would be great. I am more than happy to explain my code.
EDIT: Spotted a bug for interpreting the palettes, the colors are still wrong.
The graphic viewer is now more user friendly. I tried to read palettes from the ROM. Currently, 4BPP mode uses Link's green tunic palette. Unfortunately, 3BPP and 4BPP mode have a bug that has the converted Bitmap images skip palettes therefore using invalid palette values, currently a hack fixes this so the program doesn't crash. Currently, Link at 0x80000 uses the wrong colors as seen above.
How I interprets SNES colors:
x = unused ... unless you are ZSNES
b = blue
g = green
r = red
x0 b0 b1 b2 b3 b4 g0 g1 g2 g3 g4 r0 r1 r2 r3 r4
To interpret the green part of the color, I do:
blue =
b0 * 2^(0) +
b1 * 2^(1) +
b2 * 2^(2) +
b3 * 2^(3) +
b4 * 2^(4)
If anyone could help, that would be great. I am more than happy to explain my code.
EDIT: Spotted a bug for interpreting the palettes, the colors are still wrong.
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
https://web.archive.org/web/20091023152009/http://geocities.com/Qwertie256/attic/snesemu/qsnesdoc.html#ColorPalettes
so red is in the bottom of the 16-bit word, starting with r0, then green is next highest, then blue, then that unused bit in the top.
this confuses me, because it's suggesting that either:
- x0 is in the bottom of the word
- the n0 through n4 for each color are in reverse order
so red is in the bottom of the 16-bit word, starting with r0, then green is next highest, then blue, then that unused bit in the top.
x0 b0 b1 b2 b3 b4 g0 g1 g2 g3 g4 r0 r1 r2 r3 r4
this confuses me, because it's suggesting that either:
- x0 is in the bottom of the word
- the n0 through n4 for each color are in reverse order
Re: Zeldix Magic
maybe this can help you?
this is what i'm using for the palettes and it seems to work properly, c = color id in the palette bytes array, the color format is 555 (2bytes)
- Code:
public Color getColor(byte c)
{
short bc = BitConverter.ToInt16(colorBytes, c * 2);
return Color.FromArgb((bc & 31) * 8, ((bc >> 5) & 31) * 8, ((bc >> 10) & 31) * 8);
}
public void setColor(byte c, Color col)
{
short s = (short)(((col.B / 8) << 10) | ((col.G / 8) << 5) | ((col.R / 8) << 0));
byte[] bb = BitConverter.GetBytes(s);
colorBytes[c * 2] = bb[0];
colorBytes[(c * 2) + 1] = bb[1];
}
this is what i'm using for the palettes and it seems to work properly, c = color id in the palette bytes array, the color format is 555 (2bytes)
zarby89- Since : 2016-10-30
Re: Zeldix Magic
zarby89 wrote:maybe this can help you?
- Code:
public Color getColor(byte c)
{
short bc = BitConverter.ToInt16(colorBytes, c * 2);
return Color.FromArgb((bc & 31) * 8, ((bc >> 5) & 31) * 8, ((bc >> 10) & 31) * 8);
}
public void setColor(byte c, Color col)
{
short s = (short)(((col.B / 8) << 10) | ((col.G / 8) << 5) | ((col.R / 8) << 0));
byte[] bb = BitConverter.GetBytes(s);
colorBytes[c * 2] = bb[0];
colorBytes[(c * 2) + 1] = bb[1];
}
this is what i'm using for the palettes and it seems to work properly, c = color id in the palette bytes array, the color format is 555 (2bytes)
Thank you for this. I will try it out. I will get around to implementing your decompression code.
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
By the way, the origin of the 3BPP and 4BPP color value problem has become clear to me, this. I just need documentation to show me how to interweave the bit planes. Currently, my algorithm works well with interweaving 1BPP planes but nothing else.
This is an example of how I interpret 2BPP formats
0 1 0 0 1 (Plane 1, row 1)
1 0 1 0 1 (Plane 2, row 1)
1 2 1 0 3
I might have the results of 01 and 10 flipped but it's right in the program.
This is the algorithm:
pixels[x, y] += (byte)(Convert.ToInt16(pixels[x, y]) + Convert.ToInt32(boolArray[i++]));
Where pixels is the array of the first Bitplane. It seems the formula works for 1BPP and 2BPP just fine. Instead of adding the binary values, I think I should treat the binary values as strings that form a binary string. So if I have 3 planes:
1 0 1 0 1 (Plane 1, row 1)
1 0 1 0 1 (Plane 2, row 1)
1 0 1 0 1 (Plane 3, row 1)
I get:
111 000 111 000 111
So would 111 be the palette value for the the first pixel. Is this how the SNES does it? Is this the correct way?
EDIT: Thanks superskuj for the docs.
This is an example of how I interpret 2BPP formats
0 1 0 0 1 (Plane 1, row 1)
1 0 1 0 1 (Plane 2, row 1)
1 2 1 0 3
I might have the results of 01 and 10 flipped but it's right in the program.
This is the algorithm:
pixels[x, y] += (byte)(Convert.ToInt16(pixels[x, y]) + Convert.ToInt32(boolArray[i++]));
Where pixels is the array of the first Bitplane. It seems the formula works for 1BPP and 2BPP just fine. Instead of adding the binary values, I think I should treat the binary values as strings that form a binary string. So if I have 3 planes:
1 0 1 0 1 (Plane 1, row 1)
1 0 1 0 1 (Plane 2, row 1)
1 0 1 0 1 (Plane 3, row 1)
I get:
111 000 111 000 111
So would 111 be the palette value for the the first pixel. Is this how the SNES does it? Is this the correct way?
EDIT: Thanks superskuj for the docs.
Last edited by Trovsky on Tue 24 Jan 2017 - 7:40; edited 1 time in total
Mr.x- Fluteboy
- Since : 2014-04-10
Re: Zeldix Magic
Will I be able to rename the title on this new program. I had trouble renaming the opening with HM.
wizzrobemaster- Ganon
- Since : 2015-01-04
Re: Zeldix Magic
The editing program does not need to also be a gfx editor, since gfx editing is considered to be something else and can be done completely separately.Will I be able to rename the title on this new program. I had trouble renaming the opening with HM.
From the upper pictures it should be painfully obvious that the program will be able to do so. Why else would someone have the entire files named 2BPP, 3BPP, 4BPP.
No matter the program though, the process is/will be the same, since loading of gfx onto the title screen can not be done otherwise.
Puzzledude- Since : 2012-06-20
Page 5 of 8 • 1, 2, 3, 4, 5, 6, 7, 8
Similar topics
» Zeldix Magic Dev Area
» Zeldix Magic Open Alpha
» So what's a "Zeldix" anyway?
» Cats Take Over Zeldix
» Zeldix Ranking
» Zeldix Magic Open Alpha
» So what's a "Zeldix" anyway?
» Cats Take Over Zeldix
» Zeldix Ranking
Zeldix :: Zelda III Hacking :: The Archives :: Zeldix Magic
Page 5 of 8
Permissions in this forum:
You cannot reply to topics in this forum