Kalindor Posted July 23, 2017 Share Posted July 23, 2017 I have just started delving into the world of FE ROM hacking and have a couple very basic questions that I cannot seem to find simple answers to in the large amount of information that is out there: 1) What commands do you need to use to simply write over data from a specific hex offset in an ASM build file? For example, Venno implemented a drop item flag shortcut for FE7 and his instructions to enable it are to paste-write "201C4130007840210840000000000000" at offset "0x17826." It would be nice to just do this in the ROM build file so that I don't have to keep using the hex editor every time I build the ROM again. 2) I'd like to add additional items to some shops that are already in the game. However, it appears that NMM only allows you to replace items and not add additional ones (unless I am missing something). How would I go about inserting additional items in existing shops? Thank you for the assistance! Quote Link to comment Share on other sites More sharing options...
Darrman Posted July 23, 2017 Share Posted July 23, 2017 (edited) 1: Open your hex editor and create a new file. Paste the hex dump into the new file and save it as "DropItemFlagShortcutFE7.dmp". Assuming you're building off one of the standard buildfile tutorials, save it in the engine hacks folder. The filename itself doesn't matter, but descriptive filenames beat not-descriptive filenames.. In your engine hacks folder create a text file. Call it "DropItemFlagShortcutFE7.txt" and write the following. PUSH ORG 0x17826 #incbin "DropItemFlagShortcutFE7.dmp" POP Then open your master hack installer and add a line to the effect of: #include "DropItemFlagShortcutFE7.txt" Like so. You might also want to add a comment describing what you've installed in case things go wrong later on and you need to comment things out. Something like //Drop Item Flag Shortcut should do. 2: You would need to edit the events to expand shop data; it's beyond the scope of Nightmare. Event Assembler comes with scripts that disassemble the vanilla events. There's plenty of event tutorials poking around the internet; SHLI is the code you're looking for to edit the shops. The numbers following that are the internal item IDs. Check the FE7 Definitions.txt file to see what IDs equal what item. Edited July 23, 2017 by Darrman closing quotes Quote Link to comment Share on other sites More sharing options...
Stanツ_ Posted July 23, 2017 Share Posted July 23, 2017 (edited) I'll assume you are using the buildfile method (see that (still WIP) tutorial for anyone reading this that is interested). 1. you use ORG to jump your cursor to an offset, and simply BYTE or anything alike (SHORT, WORD or POIN) to write there. Be careful tho, because when you use ORG you are making everything after that writing at the specified offset, so you use PUSH (to save the current offset) and POP (to load it) to enclose your commands. You'll have something like this then: PUSH ORG 0x17826 BYTE 0x20 0x1C 0x41 0x30 0x00 0x78 0x40 0x21 0x08 0x40 0x00 0x00 0x00 0x00 0x00 0x00 POP (two hex digits represents a byte, and in EA you use the 0x prefix to specify hex notation) Put that somewhere in one of your included files (or the main buildfile your choice). 2. If you want to modify the size of some already existing data, You'll definitely need to repoint it (that is moving the data to some free space and changing all pointers to that data to ones that point to that free space). Shops are usually defined through events, so what you'd do is take some disassembled events, change them to have any SHOP (code for Shops) point to your new SHLI (code for Shop Item List). For example, in FE8 Ch1 (should be essentially the same for FE7 (for shops anyway)) disassembled events, you will find this in the location events: SHOP 0x0 label23 [5,7] 0x16 Which means that the shop list is located at where label23 is defined, which is later in the disassembly: label23: SHLI 0x2 0x1 0x15 0x14 0x1F If you want to do in depth changes the chapter, I would suggest you to remove all the ORGs, include that in free space and use EventPointerTable(id, ptr) with the corresponding data. But since you're (supposedly) only here for the shop, we will only do the moving for the shop list: Enclose the whole file with PUSH and POP (similarly to what we did in the Q1 answer) (keep the ORGs!), move the label23 and SHLI part at the end of the file (*after* the POP, so that those will now be in free space) and now the SHLI is safe to edit! (the different numbers are the index of the items, just add another one at the end of the line to, well, add one) Also ALIGN 4 at the beginning and end of the file (we never know, better safe than sorry). Edit: or do what Darr said (gdi ninja'd again) Edited July 23, 2017 by Stanツ_ Quote Link to comment Share on other sites More sharing options...
Kalindor Posted July 23, 2017 Author Share Posted July 23, 2017 Thank you both for your assistance. I have successfully completed the two tasks I was having trouble with. I appreciate your patience. Quote Link to comment Share on other sites More sharing options...
Kalindor Posted July 24, 2017 Author Share Posted July 24, 2017 Another basic questions: venno's passive stat booster mod states that it needs to be written to 4-aligned space. I assume this has something to do with the ALIGN 4 command I have seen in some places, but I am not sure where to put it or when it is appropriate/necessary to use. Thanks again. Quote Link to comment Share on other sites More sharing options...
Primefusion Posted July 24, 2017 Share Posted July 24, 2017 4 byte aligned means the offset should be divisible by 4 (i.e. end in 0, 4, 8, or C). If you're installing via build file, try doing an ALIGN 4 before including the package. Quote Link to comment Share on other sites More sharing options...
Kalindor Posted July 24, 2017 Author Share Posted July 24, 2017 (edited) I get the following from Event Assembler: Quote Finished. 1 errors encountered: File Passive Stat Boosts.event, Line 46, Column 1: Code POIN's offset $DDDE21 is not divisible by 4 No data written to output. The relevant part of my build file is: Quote ALIGN 4 #include "Passive Stat Boosts.event" Note: it's currently ORG'd to 0x1000000 before including the package. The error message pertains to the very last block of the included passive stat boost script: Quote ORG PassiveBooster BYTE $00 $B5 $F0 $B4 $0F $49 $07 $1C $1E $33 $00 $26 $1C $78 $00 $2C BYTE $13 $D0 $E5 $00 $65 $19 $AD $00 $6D $18 $A8 $7A $40 $24 $20 $40 BYTE $00 $28 $06 $D0 $E8 $68 $00 $28 $03 $D0 $80 $56 $C7 $19 $00 $28 BYTE $03 $D1 $02 $33 $01 $36 $05 $2E $E8 $DB $38 $1C $F0 $BC $02 $BC BYTE $08 $47 $00 $00 POIN Pas_ItemTable It's the last line that it's choking on. That line refers to the top definitions block in the script: Quote #ifndef PASSIVE_BOOST #define PASSIVE_BOOST #define PassiveBooster 0xDDDDDD #define Pas_ItemTable 0xBE222C #endif I have not messed with the pointers to the item table, so it should be at the listed default location for FE7. Thanks for the assistance. *Edit: I should add that this error also occurs when I use EA to assemble only his stat boost script, suggesting that it does not arise from compatibility with other elements in my build file. Edited July 24, 2017 by Kalindor Quote Link to comment Share on other sites More sharing options...
Kirb1337 Posted July 24, 2017 Share Posted July 24, 2017 It means that the current offset when ea arrives to that point is not divisible by 4. You could fix it by doing BYTE 0x2c 0x22 0xbe 0x08 instead. Quote Link to comment Share on other sites More sharing options...
Kalindor Posted July 25, 2017 Author Share Posted July 25, 2017 16 hours ago, Kirb1337 said: It means that the current offset when ea arrives to that point is not divisible by 4. You could fix it by doing BYTE 0x2c 0x22 0xbe 0x08 instead. Sorry, instead of what? Quote Link to comment Share on other sites More sharing options...
CT075 Posted July 25, 2017 Share Posted July 25, 2017 (edited) that's not the problem #define PassiveBooster 0xDDDDDD remember this line? That's not 4-aligned, so you're trying to write the BYTE data to a non-four aligned address. The reason it doesn't complain until the POIN is that BYTE (along with SHORT) are special-cased to allow being misaligned (because they're for writing raw data, which may or may not need to be aligned) In fact, you don't need another ORG directive in your #include'd file -- the whole point of buildfiles is that EA will organize it for you. Removing the "ORG PassiveBooster" line should fix the problem Edited July 25, 2017 by CT075 Quote Link to comment Share on other sites More sharing options...
Kalindor Posted July 25, 2017 Author Share Posted July 25, 2017 Hmm. Using your advice, I played with the offsets and ORG commands and got it to patch fine in EA. However, the patched ROM hangs when loading any stage. This behavior occurs also when I patch the ROM with the vanilla script that was included with the zip. All that was changed from its initial state was the initial offset definition. Code: Spoiler #define PassiveBooster 0x1000000 #define Pas_ItemTable 0xBE222C ORG 0x16040 BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $47 $48 $09 $18 $00 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $82 $E0 ORG 0x1606C BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $3C $48 $09 $18 $01 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $6C $E0 ORG 0x16098 BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $31 $48 $09 $18 $02 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $56 $E0 ORG 0x160C4 BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $26 $48 $09 $18 $03 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $40 $E0 ORG 0x160F0 BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $1B $48 $09 $18 $04 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $2A $E0 ORG 0x1611C BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $10 $48 $09 $18 $05 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $14 $E0 ORG 0x16148 BYTE $FF $21 $01 $40 $C8 $00 $09 $18 $89 $00 $05 $48 $09 $18 $06 $22 BYTE $C8 $68 $00 $28 $00 $D0 $80 $56 $00 $49 $08 $47 POIN PassiveBooster POIN Pas_ItemTable ORG 0x1677A BYTE $00 $06 $33 $1C $00 $28 $01 $D0 ORG PassiveBooster BYTE $00 $B5 $F0 $B4 $0F $49 $07 $1C $1E $33 $00 $26 $1C $78 $00 $2C BYTE $13 $D0 $E5 $00 $65 $19 $AD $00 $6D $18 $A8 $7A $40 $24 $20 $40 BYTE $00 $28 $06 $D0 $E8 $68 $00 $28 $03 $D0 $80 $56 $C7 $19 $00 $28 BYTE $03 $D1 $02 $33 $01 $36 $05 $2E $E8 $DB $38 $1C $F0 $BC $02 $BC BYTE $08 $47 $00 $00 POIN Pas_ItemTable Quote Link to comment Share on other sites More sharing options...
CT075 Posted July 25, 2017 Share Posted July 25, 2017 show me your entire buildfile. my gut tells me you're either misunderstanding the point of using EA (note that, if you're #include'ing that file from a bigger buildfile, you don't need to ORG the #include'd file, as outlined here) or the patch itself is not correct Quote Link to comment Share on other sites More sharing options...
Kalindor Posted July 27, 2017 Author Share Posted July 27, 2017 (edited) On 7/25/2017 at 0:00 PM, CT075 said: show me your entire buildfile. my gut tells me you're either misunderstanding the point of using EA (note that, if you're #include'ing that file from a bigger buildfile, you don't need to ORG the #include'd file, as outlined here) or the patch itself is not correct Sorry for the confusion: the issue of the game hanging on a black screen when loading a stage is also present even when the spoiler-ed code in the above post is the only thing being patched to the ROM by EA. (Not #include-ed as part of a larger buildfile.) If the syntax in that code looks good to you, should I conclude that that modification is just not working? Thanks. *Edit: maybe it's these .asm files in the "source" folder that was distributed with the mod. I wonder if something separate has to be done with these. It's not in the readme.txt, however. This is probably not worth spending more time on. It would be a neat feature, but I can live without it. Edited July 27, 2017 by Kalindor Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.