Black Magic and ALL the Source Code

Go down

Black Magic and ALL the Source Code Empty Black Magic and ALL the Source Code

Post by assassin17 Sun 22 Jan 2017 - 6:17

Source code for newest version:
* assassin17 mirror: http://assassin17.brinkster.net/mathonnapkins/Black_Magic_2015_04_04.7z
* bwass.org/bucket: http://www.bwass.org/bucket/Black_Magic_2015_04_04.7z
Alpha source code
* bwass.org/bucket: http://bwass.org/bucket/Black_Magic_src_a09.zip

BM will always be needed, unless you want to die from some sort of sepsis.
assassin17
assassin17

Black Magic and ALL the Source Code Image111

Since : 2015-03-14

http://assassin17.brinkster.net/

Back to top Go down

Black Magic and ALL the Source Code Empty Re: Black Magic and ALL the Source Code

Post by Conn Sat 22 Jul 2017 - 17:58

I still have the partial source code but am not sure whether this is what people look after.
Other than that I believe he got it from MoN, so the code isn't lost anyway.
Attachments
Black Magic and ALL the Source Code Attachment
Hyrule_Magic_Source_Code_(v963).txt You don't have permission to download attachments.(258 Kb) Downloaded 7 times
Conn
Conn

Black Magic and ALL the Source Code Image212

Since : 2013-06-30

Back to top Go down

Black Magic and ALL the Source Code Empty Re: Black Magic and ALL the Source Code

Post by Euclid Sun 23 Jul 2017 - 0:14

looking at that code gives me the headaches, i can see why seph3 never wanted to touch it again.
Euclid
Euclid

Black Magic and ALL the Source Code Image212

Since : 2012-06-21

Back to top Go down

Black Magic and ALL the Source Code Empty Re: Black Magic and ALL the Source Code

Post by Founder Sun 23 Jul 2017 - 0:25

Even though it is badly coded, can you read some parts of it Euclid?

Founder

Black Magic and ALL the Source Code Image212

Since : 2012-06-19

Back to top Go down

Black Magic and ALL the Source Code Empty Re: Black Magic and ALL the Source Code

Post by Euclid Sun 23 Jul 2017 - 9:02

Yes... (un)fortunately I have no issues reading it.

For example, that (in)famous monologue killing ganon AI code around 0xE8000 is caused by this

Line 5266 or thereabouts
Code:

 s+=bd; <--- add length to the current begin write location (think s is the pointer start for this block of text, bd is the length of the current text block calculated in extremely badly named variables above)
 if(s<0xe0000 && s>0x77400) {  <--- check if s is out of bounds and ran out of space in bank 0E (if it's above 0xe0000 it's writing into first bank still)
 doc->t_modf=1;
 MessageBox(framewnd,"Not enough space for monologue.","Bad error happened",MB_OK);
 return;
 }
 if(s>0xe8000) {  <--- so basically when you hit the end of bank 1E if the length of current text will push it beyond this offset
 rom[s-bd]=0x80;  <--- write 80, indicator that the text in this bank has ended.
 s=0x75f40+bd; <-- set the current pointer to location 0E, so this current text block begins there.
 }
 memcpy(rom+s-bd,b2,bd); <-- copy the text from ram into the target location
 rom[s++]=0x7f;  <--- pad the text with 7F (End of Line char)
 }
 rom[s]=0xff; <-- once it's all done pad the text with 0xFF (End of Data char)

To the untrained eye, the code above don't seem to have any issues, until you realise the check only check if the current text string overflows to 0xe8000. So what if it lands exactly on 0xe7FFF?

if it lands on 0xe7FFF, the next text block would cause it to go over 0xe8000, and then HM, by its buggyness, will write a 0x80 (indicator that the text in this bank has ended) @ 0xe8000, overwriting the next bank's ASM which is already there. What's worse is that if that happens to be the last block of text, HM will slam a FF in that spot instead. FF is usually very bad for ASM as it's some weird SBC instruction which normally guarantees rom crash.

If I were to fix HM I would put the check to 0xe7FF8 rather than 0xe8000, which would solve all the HM mysteriously writing over stuff in the next bank from the monologue editor.
Euclid
Euclid

Black Magic and ALL the Source Code Image212

Since : 2012-06-21

Back to top Go down

Back to top

- Similar topics

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