[FE8] Modular Minimug Box 2018: It's here!


#21

I’m also looking forward to the FEBuilder integration for an easy editor with a live preview function.

Great job Zane. I’m very glad I asked you to revisit this hack back in the day. It’s really going to change things for the better, I’m sure of it. GG


#22

I hope I can edit it with FEBuilderGBA.
However, we have to solve various problems for that.

FEBuilderGBA is suitable for editing structs.
EA is suitable for describing syntax.

MMB is written in syntax rather than struct.
For example, it has the following format.
It is quite difficult to integrate this.

// Unit name options

	// Coordinates and widths are in 8x8 pixel tiles
	#define MMBNameWidth 7
	#define MMBNameColor TextBlack
	#define MMBNameX 5
	#define MMBNameY 3

For example, if it was described with the following structure, it would be easier to integrate it.

struct MMBItem{
	byte	x;
	byte	y;
	byte	color;
	bool	is_static;

	byte	type;	//enum type
	byte	arg1;
	byte	arg2;
	byte	arg3;
}; //sizeof()==8

MMBItem(0, 0 , Black , STATIC_ITEM , UNIT_NAME , 0  , 0 , 0)
MMBItem(0, 10 , Black , STATIC_ITEM , UNIT_ITEMS , 0  , 0 , 0)
MMBItem(0xFF,0xFF,0xFF , 0xFF , 0xFF , 0xFF ,0xFF , 0xFF); //term

Also, items that can be added such as the following are also problems.
These are different from the way you customize after installing FEBuilderGBA, as you will decide which to use when you install the build file.

// Inventory modules

	//#define MMBInventory
	//#define MMBEquippedWeapon
	//#define MMBEquippedWeaponName // uses alt text
	#define MMBInventoryOrEquippedWeaponName // uses alt text

// Bar modules

	//#define MMBHPBar

Probably, in the present situation, when installing the patch it will be in a format that you choose which to use.
I think that editing after installation is difficult.
If you change it, it will be in a form to uninstall the patch once and reinstall it.

Also, FEBuilderGBA does not have a lyn parser.
This is a problem when FEBuilder’s rebuild.
(rebuild is a function to rebuild the ROM and execute defragmentation)

I would need to create a new lyn parser or install it in a specific area below 0x09000000 just like a skill system.

Either way, this is a problem with FEBuilderGBA, so I’d like to do something.
Also , I want to porting to FE8J.


#23

Finally I could transplant.

I would like to give you feedback on the porting on FE8J.
First of all, you’d better create a batch file that creates an elf.

Assemble ARM.bat

@echo off

SET startDir=C:\devkitPro\devkitARM\bin\

@rem Assemble into an elf
SET as="%startDir%arm-none-eabi-as"

cd Internal

for %%i in (*.s) do (
call :gas %%i
)

cd ..
cd Modules

for %%i in (*.s) do (
call :gas %%i
)
cd ..

pause
exit

:gas
echo %1
%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf"
exit /b

You seem to be collecting definitions in Common Definitions.inc.
However, there was a part whose value was hard-coded in the source code.

Internal\MMBDrawAffinityObjs.s	ldr		r2, =0x08590F4C
Internal\MMBDrawInventoryObjs.s	ldr		r2, =0x08590F4C 
Internal\MMBDrawNumberOAM.s	ldr		r2, =0x08590F44
Modules\MMBDrawAffinity.s	ldr		r0, =0x08599714
Modules\MMBDrawEquippedWeapon.s	ldr		r0, =0x085996F4
Modules\MMBDrawEquippedWeaponName.s	ldr		r0, =0x085996F4
Modules\MMBDrawInventory.s	ldr		r0, =0x085996F4
Modules\MMBDrawInventoryOrEquippedWeaponName.s	ldr		r0, =0x085996F4
Modules\MMBDrawInventoryOrEquippedWeaponName.s	ldr		r0, =0x085996F4
Modules\MMBDrawSkillAlternatingObjs.s	ldr		r2, =0x08590F4C
Modules\MMBDrawSkills.s		ldr		r0, =0x085996F4

Also, the position of Procs is hard-coded.
It might be better to set a definition somewhere here as well.

Internal\UI1 Proc Code.event	ORG 0x00A0190C	
Internal\UI1 Proc Code.event	PROC_WHILE_EXISTS(0x0859A48) // Halt if GENS
Internal\UI1 Proc Code.event	PROTECT 0x00A0190C CURRENTOFFSET

Of course, hard coding is not bad.
We can easily fix it by using the editor’s bulk replacement.

And , I want to feed back the concrete source code after testing the version of FE8J more.


#24

Well done! I’m glad that you were able to get things working. Thank you for taking the time to look at this and give feedback, it has been a long time since I have written anything for GBAFE.


#25

If we’re still suggesting stuff, how about turning the chapter goal window into a skills window which then turns back into a goal window when the cursor is away from the unit? It would allow for more info without impeding normal function (I think)


#26

This looks cool.


#27

I posted the modified version of 7z to Discord’s spell academy.

Bug fixes.
MMBDrawInventoryOrEquippedWeaponName.s
Fixed a bug where the enemy’s weapon name is not displayed.

Added new functions.

Supports FE8J.

MMBDrawWeaponNameCentered.s
It is a module that displays only the weapon’s name with center alignment.

I wanted to display the name of the weapon equipped while displaying all my items.

MMBDrawHPBarOrBadStatus.s
HPBar is displayed, but in case of Bad Status, the contents of Bat Status are displayed.

I hated GBAFE’s combination display.
Because I have to wait a few seconds to confirm the turn that an enemy is sleeping on.
Normally, HPBar is displayed, but in the case of Bad Status, its contents are displayed.
There is no need to wait a few seconds.

MMBDrawHPStatusNoCombination.s
Since I implemented “MMBDrawHPBarOrBadStatus”, it was necessary to prevent Bad Status from being displayed in MMBDrawHPStatus.
This module always displays HP only.

Suggest
I changed the installer to call the configuration, but the setting to call the installer.
The more we can make the preset, the convenience will improve.

NG: installer <- data
OK: data -> installer

For example, if we prepare a GFE1R style reset or a REDFE style preset, the user can use it by simply selecting it.
We will be able to satisfy the demands of not only users who want to customize everything, but users who want to use it more easily.

I renamed the dependent program as MMB Core.
And I include it from each style.
#include “MMB Core.event”

I made styles.

MMB Installer 2018 Default.event
It is the default style of MMB2018.

MMB Installer GFE1R Style.event
It is a style of GFE1R style.
I reverse-engineered it from the screenshot of the game. :slight_smile:

MMB Installer REDFE style.event
It is a style of REDFE style.
I reverse-engineered it from the screenshot of the game. :slight_smile:

MMB Installer Kaitou Style.event
It is a style of Kaitou patch style.
This game keeps items in large quantities, so it specializes on items.

I got some screenshots with FE8J.


#28

Maybe it would be better to replace the terrain window with this, so that way you have at least the logical consistency of “this window has information relating to the highlighted map coordinate”. :thinking:


#29

Well, it’s just that the terrain window provide information you might want to see as well as normal unit data, where the chapter goal is something that doesn’t really have to be viewed all the time


#30

I agree, while we know most of the vanilla terrains stats, some project can include custom ones


#31

I made a routine to change the color of weapons’ strings and notify them When the number of weapons decreases.
If the durability of the weapon falls below 35%, the color of the name of the weapon will be the specified color.

In the case of cheap weapons it is not a problem, but for expensive weapons like sacred weapons, there is a cost to open the menu to check the remaining number.
Since this is troublesome, if the number of uses of weapons is decreasing, I changed the color of letters and warn them.

The latest version of github seems to have changed the code considerably.
I think the way of writing coordinates is different from the previous version.
So I write the changes I made here instead github.

	#define MMBWeaponNameCenteredWarningColor
	#define MMBWeaponNameX 48
	#define MMBWeaponNameY 40
	#define MMBWeaponNameCenteredWarningColor_Parcent	35		//<= 35%
	#define MMBWeaponNameCenteredWarningColor_Color		TextYellow
		#ifdef MMBWeaponNameCenteredWarningColor
			#inctevent lyn "Modules/MMBDrawWeaponNameCenteredWarningColor.elf" "Internal/Definitions.elf"
			SHORT MMBAltTextWidth * 8
			SHORT MMBTextAltColor
			WORD (2 * ((32 * (MMBWeaponNameY/8)) + (MMBWeaponNameX/8))) + 4
			SHORT MMBWeaponNameCenteredWarningColor_Parcent
			SHORT MMBWeaponNameCenteredWarningColor_Color
		#endif // MMBWeaponNameCenteredWarningColor

Modules/MMBDrawWeaponNameCenteredWarningColor.s


.thumb

.include "../Common Definitions.inc"

MMBDrawWeaponNameCenteredWarningColor:

	.global	MMBDrawWeaponNameCenteredWarningColor
	.type	MMBDrawWeaponNameCenteredWarningColor, %function

	.set MMBAltTextWidth	,	EALiterals + 0
	.set MMBTextAltColor,		EALiterals + 2
	.set MMBItemNamePosition,	EALiterals + 4
	.set MMBTextWarningParcent,	EALiterals + 8
	.set MMBTextWarningColor,	EALiterals + 10

	@ Inputs:
	@ r0: pointer to proc state
	@ r1: pointer to unit in RAM

	push	{r4-r7, r14}

	mov		r4, r0

	@ Check if unit has an equipped weapon

	mov		r0, r1
	ldr		r1, =GetEquippedWeapon
	mov		r14, r1
	.short 0xF800

	@ if not, end

	cmp		r0, #0x00
	beq		End

	@ save Weapon Count
	mov		r1, r0
	lsr		r1, #0x08
	mov		r5, r1

	mov		r1, #0xFF
	and		r0, r1

	ldr		r1, =GetROMItemStructPtr
	mov		r14, r1
	.short 0xF800

	mov		r6, r0

	@ get color to r5

	ldrb	r0, [r6,#0x8]  @Item->Attribute1 & INF
	mov     r2, #0x8
	and     r0, r2
	cmp     r0, #0x00
	bne     NormalColor

	ldrb	r1, [r6,#0x14]  @Item->MaxCount
	cmp		r1, #0x00
	beq		NormalColor

	mov		r0, r5
	mov		r2, #100
	mul		r0, r2
	swi		0x6    @ div

	@ Switch the color with the rest of the weapon.

	ldr		r1, =MMBTextWarningParcent
	ldrh	r1, [r1]
	cmp		r0,r1
	ble		WarningColor

NormalColor:
	ldr		r2, =MMBTextAltColor
	ldrh	r5, [r2]
	b       ColorJoin

WarningColor:
	ldr		r2, =MMBTextWarningColor
	ldrh	r5, [r2]
@	b       ColorJoin

ColorJoin:

	@ get item name

	mov		r0, r6
	ldrh	r0, [r0]

	ldr		r1, =TextBufferWriter
	mov		r14, r1
	.short 0xF800

	@ save resulting width for later

	mov		r6, r0
	mov		r1, r0

	ldr		r0, =MMBAltTextWidth 
	ldrh	r0, [r0]             @ multiplied by 8 in EA
	ldr		r2, =GetStringTextCenteredPos
	mov		r14, r2
	.short 0xF800

	@ save resulting padding distance

	mov		r7, r0

	@ write item name

	add		r4, #AltTextStructStart
	mov		r0, r4
	ldr		r1, =TextClear
	mov		r14, r1
	.short 0xF800

	@ we write the text info to the proc state

	mov		r0, r4
	mov		r1, r7
	mov		r2, r5  @ Switch the color with the rest of the weapon.

	ldr		r3, =TextSetParameters
	mov		r14, r3
	.short 0xF800

	@ Write name

	mov		r0, r4
	mov		r1, r6

	ldr		r2, =TextAppendString
	mov		r14, r2
	.short 0xF800

	@ write tilemap

	mov		r0, r4
	ldr		r1, =WindowBuffer
	ldr		r2, MMBItemNamePosition
	add		r1, r1, r2

	ldr		r2, =TextDraw
	mov		r14, r2
	.short 0xF800

End:

	pop		{r4-r7}
	pop		{r0}
	bx		r0

.ltorg

EALiterals:
	@ MMBAltTextWidth
	@ MMBTextAltColor
	@ MMBItemNamePosition
	@ MMBTextWarningColor
	@ MMBTextWarningParcent