Zeldix Magic

Page 5 of 8 Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Fri 13 Jan 2017 - 10:10

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.

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Sun 15 Jan 2017 - 18:09

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

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Puzzledude Sun 15 Jan 2017 - 19:15

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
Great. I don't get it, where did he get it. This should ease up making a new dungeon editor.
Puzzledude
Puzzledude

Zeldix Magic - Page 5 Image213

Since : 2012-06-20

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Sun 15 Jan 2017 - 20:45

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
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Sun 15 Jan 2017 - 22:03

I'm looking at the code and the code features:

  • 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
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Puzzledude Mon 16 Jan 2017 - 7:28

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.
Puzzledude
Puzzledude

Zeldix Magic - Page 5 Image213

Since : 2012-06-20

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 16 Jan 2017 - 10:06

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.
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):

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
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 16 Jan 2017 - 11:00

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.

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Puzzledude Mon 16 Jan 2017 - 12:32

On the topic of leaked source code, I wonder if Black Magic has any. I can't find any builds on the internet.
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):
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
Puzzledude

Zeldix Magic - Page 5 Image213

Since : 2012-06-20

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 16 Jan 2017 - 13:00

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
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 16 Jan 2017 - 14:32

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


Last edited by Trovsky on Wed 18 Jan 2017 - 0:53; edited 1 time in total

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 16 Jan 2017 - 23:20

Zeldix Magic - Page 5 Zeldix_Magic_GFX_viewer

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Wed 18 Jan 2017 - 0:47

I realize now that this thread should be in the projects topic. Can an admin move this?

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Puzzledude Wed 18 Jan 2017 - 7:02

But you can move it too, since any Moderator can. It should be just below the thread under "quick tools".
Puzzledude
Puzzledude

Zeldix Magic - Page 5 Image213

Since : 2012-06-20

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Fri 20 Jan 2017 - 22:46

Update: superskuj's sprite editor was added. Enjoy.

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by wizzrobemaster Sun 22 Jan 2017 - 2:12

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
Ganon

Since : 2015-01-04

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by wizzrobemaster Sun 22 Jan 2017 - 2:24

Puzzledude wrote:
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.
That's not really the HM thing, it is the game thing.
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
Ganon

Since : 2015-01-04

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Puzzledude Sun 22 Jan 2017 - 7:03

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?
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.
Puzzledude
Puzzledude

Zeldix Magic - Page 5 Image213

Since : 2012-06-20

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 23 Jan 2017 - 0:19

(Notes: the top window's color doesn't use the palette seen in the program as of now)

Zeldix Magic - Page 5 Zeldix_Magic_gafx2

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
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by assassin17 Mon 23 Jan 2017 - 4:04

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.

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
assassin17
assassin17

Zeldix Magic - Page 5 Image111

Since : 2015-03-14

http://assassin17.brinkster.net/

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by zarby89 Mon 23 Jan 2017 - 14:29

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)
zarby89
zarby89

Zeldix Magic - Page 5 Image111

Since : 2016-10-30

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 23 Jan 2017 - 17:03

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
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Mr.x Mon 23 Jan 2017 - 18:10

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.


Last edited by Trovsky on Tue 24 Jan 2017 - 7:40; edited 1 time in total

Mr.x
Fluteboy
Fluteboy

Since : 2014-04-10

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by wizzrobemaster Tue 24 Jan 2017 - 7:27

Will I be able to rename the title on this new program. I had trouble renaming the opening with HM.

wizzrobemaster
Ganon
Ganon

Since : 2015-01-04

Back to top Go down

Zeldix Magic - Page 5 Empty Re: Zeldix Magic

Post by Puzzledude Tue 24 Jan 2017 - 8:07

Will I be able to rename the title on this new program. I had trouble renaming the opening with HM.
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.

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
Puzzledude

Zeldix Magic - Page 5 Image213

Since : 2012-06-20

Back to top Go down

Page 5 of 8 Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum