Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ In Golden Sun, lighting the four Elemental Lighthouses releases Alchemy upon the

The two games share much of the same code, so Alchemy recovers them side by side.

## Status: ☀️ 55.96% · ⚓️ 0.20%
## Status: ☀️ 56.01% · ⚓️ 0.20%

![ROM contents](<games/THE BROKEN SEAL/PREVIEW/TBS-EN-ROM.SVG?v=68da166347fd2c0c>)
![ROM contents](<games/THE BROKEN SEAL/PREVIEW/TBS-EN-ROM.SVG?v=3aac26d468df1da6>)

**DONE** measures recovered code: byte-exact C and evidenced permanent
assembly, divided by each game's audited executable bytes. ☀️ is The Broken
Expand Down
39 changes: 30 additions & 9 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,41 @@ that finishes it.

### ☀️ 60%

- Prefer never-drafted unknown; when that pool is too small for 60%, first-try
non-Stubborn draft_c / overlay virgin. Skip Far veneers and asm-manifest
owners (C there does not raise DONE). Bounce at 10 minutes.

Reach 60% of the fixed executable inventory. Read the current verified count
with `make progress`; do not maintain a second score in this task list.

- Recheck and adopt what the stopped recovery run found. Exact:
`main:080fa514` (72 bytes) and `main:08092878` (172 bytes). Exact at 54 bytes
each: `resource_39e:02000104` and `resource_3c9:02000104`, the `Effect_Move`
family; eleven more copies differ by one halfword, so the family wants one
shared source with instances.
- `Effect_Move` shared unit is adopted on `cursor/tbs-to-60` (24 overlay
instances). Keep taking fresh twins / named-no-source owners that score
exact quickly; if not exact inside a 10-minute window, park under Stubborn
and switch owners.
- Rebuild coverage with `make coverage`, then rank unresolved owners from it,
twins of exact owners first.
- Recount the owners still parked because their only match needed a
scheduling trick. The five overlay copies of `0809a65c` still hold a
`do { } while (0)` barrier. `SpawnConfiguredEffect` (23 copies) stays a
recorded compiler gap unless new evidence reopens it.

### Stubborn (hard-pass later)

Parked for a stronger model. Agents must not burn a 10-minute window here.

- `main:080f9a30` SoundNote_Detach (30 B) — retired-from-C allocation wall (note stays in r0; next reg reused for zero); raw already documents no ordinary C spelling.
- `main:08021e28` (32 B) — scheduling-floor, 2 halfwords; bounce.
- `main:08029274` (80 B) — scheduling-floor, 2 halfwords; bounce.
- `main:080a9d3c` (72 B) — instruction-selection wall; bounce.
- `resource_382:02001090` ActorDraw_SetupActorSceneCells twin (172 B) — equivalent to `resource_385:02000c1c`, but instance must place every `actor-motion-event-scene` member; bounce until full resource_382 map exists.
- `main:080fa514` (72 B) — still many differing halfwords (not exact).
- `main:08092878` (172 B) — still many differing halfwords (not exact).
- `resource_3bd:020013f8` FieldScene_RunExtendedActorPresentation (6220 B) —
scheduling-floor, 2 halfwords (arg load order for `Func_02003d20(0,1)`);
no established repair.
- Overlay copies of `0809a65c` with `do { } while (0)` barriers; leave parked.
- `SpawnConfiguredEffect` (23 copies) — recorded compiler gap.
- `main:0800383c`–`main:08003a3c` family (~129 B each) — scheduling-floor, 2 halfwords each; bounce.
- Allocation / instruction-selection walls already labeled
`copy_versus_rematerialise` or `instruction-selection` (e.g.
`main:080b6d30`, `main:080b6e7c`, `resource_380:02004260`,
`resource_3af:02001db0`) — do not respell.

### Reconstruct The Lost Age

Expand Down
1,733 changes: 66 additions & 1,667 deletions games/THE BROKEN SEAL/PREVIEW/TBS-EN-ROM.SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 1 addition & 10 deletions games/THE BROKEN SEAL/SRC/FIELD/BABI_CHIKA/MAP_INIT.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "TYPES.H"
#include "FIELD_EFFECT.H"
#define OverlayObject_IntegrateVelocities Effect_Move

#define OverlayObject_CreateAndInitialize Func_020009f4
#define SceneEffect_SpawnNineRadialEffects Func_020011e0
Expand Down Expand Up @@ -878,16 +879,6 @@ u8 *OverlayObject_PrepareSpawnedObjectMode4(s32 x, s32 y, s32 z, s32 kind)
return ret;
}

void OverlayObject_IntegrateVelocities(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}

/*
* resource_3c4 @ 0x02001f70 (84 bytes: 72 code + alignment + two pool words).
*
Expand Down
11 changes: 1 addition & 10 deletions games/THE BROKEN SEAL/SRC/FIELD/BABI_IRIGUCHI/BRANCHING_EVENT.C
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#define SceneData_SelectTableB91cByRuntimeSelector Func_020027a0

#include "FIELD_EFFECT.H"
#define OverlayObject_IntegrateVelocities Effect_Move
#include "STAGED_ACTOR.H"
#include "SPAWN_CONFIGURED_EFFECT.H"
#include "SELECT_OVERLAY_DATA_BY_RUNTIME_SELECTOR.H"
Expand Down Expand Up @@ -1030,16 +1031,6 @@ u8 *OverlayObject_PrepareObjectWithCommand15(s32 x, s32 y, s32 z, s32 kind)
return result;
}

void OverlayObject_IntegrateVelocities(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}

void SceneState_SetValue8Mode66(void)
{
Func_02003c00(8, 66);
Expand Down
12 changes: 12 additions & 0 deletions games/THE BROKEN SEAL/SRC/FIELD/COMMON/EFFECT/MOVE.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "TYPES.H"
#include "FIELD_EFFECT.H"

void Effect_Move(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}
15 changes: 2 additions & 13 deletions games/THE BROKEN SEAL/SRC/FIELD/GOMA_SUIRO/BURST.C
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ void *OverlayObject_CreateConfiguredObject(s32 arg0, s32 arg1, s32 arg2, s32 arg
return NULL;
}

#define SceneEffect_UpdateMotion Func_02000104
void Effect_Move(void *object);
#define SceneEffect_UpdateMotion Effect_Move

/* The object is accessed through word fields and a linked record. Keep the
* shared storage view so the record load follows the position stores. */
Expand All @@ -182,18 +183,6 @@ union MotionWork {
u8 bytes[102];
};

void SceneEffect_UpdateMotion(union MotionWork *work)
{
u16 *record;

work->fields.x += work->fields.velocity_x;
work->fields.y += work->fields.velocity_y;
work->fields.z += work->fields.velocity_z;
work->fields.accum_x += work->fields.rate_x;
work->fields.accum_y += work->fields.rate_y;
record = work->fields.record;
record[15] += work->fields.angle_step;
}

s32 SceneData_GetTable8818OrTable88d8(void)
{
Expand Down
16 changes: 2 additions & 14 deletions games/THE BROKEN SEAL/SRC/FIELD/KUUPUAPPU_MURA_SAI/MOTION_EVENT.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#define SetOverlayObjectSlot Func_02001244
#define OverlayObject_CreateConfigured Func_02000048
#define OverlayObject_CreateConfiguredObjectB Func_020000a0
#define SceneEffect_UpdateMotion Func_02000104
void Effect_Move(void *object);
#define SceneEffect_UpdateMotion Effect_Move
#define SceneDialogue_RunActorFifteenDialogue Func_02000864
#define SceneDialogue_RunActorFourteenFlagDialogue Func_0200058c
#define CalculateFixedPointPositionDistance Func_02000314
Expand Down Expand Up @@ -663,19 +664,6 @@ void *OverlayObject_CreateConfiguredObjectB(s32 arg0, s32 arg1, s32 arg2, s32 ar
#include "CREATE_CONFIGURED_OVERLAY_OBJECT_BODY.INC"
}

void SceneEffect_UpdateMotion(union MotionWork *work)
{
extern u8 Data_03001ebc[];

u16 *record;
work->fields.x += work->fields.velocity_x;
work->fields.y += work->fields.velocity_y;
work->fields.z += work->fields.velocity_z;
work->fields.accum_x += work->fields.rate_x;
work->fields.accum_y += work->fields.rate_y;
record = work->fields.record;
record[15] += work->fields.angle_step;
}

s32 Func_02000314(s32 *first_position, s32 *second_position)
{
Expand Down
16 changes: 2 additions & 14 deletions games/THE BROKEN SEAL/SRC/FIELD/MAKYURI_CHOJO/AERIE.C
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,8 @@ static __inline__ void Call6(void (*f)(), s32 a0, s32 a1, s32 a2, s32 a3, s32 a4
#define SetOverlayObjectSlot Func_02003844
#define SetOverlayObjectRecordField1 Func_02000030
#define OverlayObject_CreateConfiguredObject Func_020000a0
#define OverlayObject_ApplyVelocity Func_02000104
void Effect_Move(union Slot *object);
#define OverlayObject_ApplyVelocity Effect_Move

#include "OVERLAY_OBJECT.H"
#include "CREATE_CONFIGURED_OVERLAY_OBJECT.H"
Expand Down Expand Up @@ -1580,19 +1581,6 @@ void *OverlayObject_CreateConfiguredObject(s32 arg0, s32 arg1, s32 arg2, s32 arg
#include "CREATE_CONFIGURED_OVERLAY_OBJECT_BODY.INC"
}

void OverlayObject_ApplyVelocity(union Slot *object)
{
u16 *record;

object[2].w += object[17].w;
object[3].w += object[18].w;
object[4].w += object[19].w;
object[6].w += object[12].w;
object[7].w += object[13].w;
record = (u16 *)object[20].p;
record[15] += object[25].h[0];
}

void *SceneData_GetTableB938(void)
{
return Data_0200b938;
Expand Down
11 changes: 1 addition & 10 deletions games/THE BROKEN SEAL/SRC/FIELD/MOGORU_MORI/WAYPOINT.C
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#define SceneData_SelectTableBa48ByRuntimeSelector Func_020024ac

#include "FIELD_EFFECT.H"
#define OverlayObject_IntegrateVelocities Effect_Move
#include "STAGED_ACTOR.H"
#include "SELECT_OVERLAY_DATA_BY_RUNTIME_SELECTOR.H"

Expand Down Expand Up @@ -756,16 +757,6 @@ u8 *OverlayObject_SpawnConfiguredWithMode15(s32 x, s32 y, s32 z, s32 kind)
return ret;
}

void OverlayObject_IntegrateVelocities(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}

/* Three sites of the record accessor, so three names. */

/* Five sites of one import. */
Expand Down
9 changes: 0 additions & 9 deletions games/THE BROKEN SEAL/SRC/FIELD/RUNPA_MURA/EFFECT.C
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ struct FieldEffect *Effect_Create(s32 x, s32 y, s32 z, s32 type)
return NULL;
}

void Effect_Move(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}

/*
* The motion scripts a spawn chooses from. Each holds the effect for its
Expand Down
17 changes: 2 additions & 15 deletions games/THE BROKEN SEAL/SRC/FIELD/SHIAN_HEYA/FLAGGED_OBJECT.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#define OverlayObject_SetEntryField Func_02000030
#define OverlayObject_SpawnWithMode14 Func_02000048
#define OverlayObject_CreateConfigured Func_020000a0
#define OverlayObject_IntegrateVelocities Func_02000104
void Effect_Move(void *object);
#define OverlayObject_IntegrateVelocities Effect_Move
#define SceneData_GetTable8778 Func_02000314
#define SceneData_ReturnZero Func_0200031c
#define SceneData_GetTable8868 Func_02000320
Expand Down Expand Up @@ -155,20 +156,6 @@ void *OverlayObject_CreateConfigured(s32 arg0, s32 arg1, s32 arg2, s32 arg3)
return NULL;
}

void OverlayObject_IntegrateVelocities(void *arg0)
{
union Slot *s = (union Slot *)arg0;
union Slot *obj;

s[2].w += s[17].w;
s[3].w += s[18].w;
s[4].w += s[19].w;
s[6].w += s[12].w;
s[7].w += s[13].w;
obj = (union Slot *)s[20].p;
obj[7].h[1] += s[25].h[0];
}

s32 SceneData_GetTable8778(void)
{
return (s32)Data_02008778;
Expand Down
14 changes: 2 additions & 12 deletions games/THE BROKEN SEAL/SRC/FIELD/SORU_STAR/PARTY_INTRO.C
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#define OverlayObject_SetHandleFlagBits2And3 Func_02000030
#define OverlayObject_CreateConfiguredObject Func_020000a0
#define UpdateOverlayObjectAngle Func_02000314
#define SceneEffect_UpdateMotion Func_02000104
void Effect_Move(void *object);
#define SceneEffect_UpdateMotion Effect_Move
#define SceneData_GetTableCd88 Func_0200036c
#define SceneData_ReturnZero Func_02000374
#define SceneData_GetTableCDB8 Func_02000378
Expand Down Expand Up @@ -1557,17 +1558,6 @@ void *OverlayObject_CreateConfiguredObject(s32 arg0, s32 arg1, s32 arg2, s32 arg
#include "CREATE_CONFIGURED_OVERLAY_OBJECT_BODY.INC"
}

void SceneEffect_UpdateMotion(union MotionWork *work)
{
u16 *record;
work->fields.x += work->fields.velocity_x;
work->fields.y += work->fields.velocity_y;
work->fields.z += work->fields.velocity_z;
work->fields.accum_x += work->fields.rate_x;
work->fields.accum_y += work->fields.rate_y;
record = work->fields.record;
record[15] += work->fields.angle_step;
}

s32 UpdateOverlayObjectAngle(struct OverlayObject *object)
{
Expand Down
11 changes: 1 addition & 10 deletions games/THE BROKEN SEAL/SRC/FIELD/TAKARA_SHIMA/ISLAND_AND_CAVES.C
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@

#include "STAGED_ACTOR.H"
#include "FIELD_EFFECT.H"
#define OverlayObject_IntegrateVelocities Effect_Move

/* Integrate position, velocity, rate and sprite angle for one scene effect.
Signed division preserves decay toward zero for negative Z velocity. */
Expand Down Expand Up @@ -1024,16 +1025,6 @@ u8 *SpawnMode15Effect(s32 x, s32 y, s32 z, s32 kind)
return 0;
}

void OverlayObject_IntegrateVelocities(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}

/* Deliberate no-op callback. */
void NoOpEffectCallback(void) {}

Expand Down
11 changes: 1 addition & 10 deletions games/THE BROKEN SEAL/SRC/FIELD/VINASU_HEYA/ENTRY_SETUP.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "TYPES.H"
#include "FIELD_EFFECT.H"
#define OverlayObject_IntegrateVelocities Effect_Move

#define NULL ((void *)0)
#define RunOverlayObjectCommand0 Func_02004e8c
Expand Down Expand Up @@ -1035,16 +1036,6 @@ void *OverlayObject_PrepareObjectWithCommand15(s32 arg0, s32 arg1, s32 arg2, s32
return 0;
}

void OverlayObject_IntegrateVelocities(union FieldObject *object)
{
object->effect.x += object->effect.velocity_x;
object->effect.y += object->effect.velocity_y;
object->effect.z += object->effect.velocity_z;
object->effect.scale_x += object->effect.scale_rate_x;
object->effect.scale_y += object->effect.scale_rate_y;
object->effect.sprite->rotation += object->effect.spin;
}

s32 SceneActor_CalculateFixedPointDistance(s32 *a, s32 *b)
{
s32 dx = (*a++ - *b++) >> 16;
Expand Down
16 changes: 2 additions & 14 deletions games/THE BROKEN SEAL/raw/overlays/resource_382_overlay.s
Original file line number Diff line number Diff line change
Expand Up @@ -413,20 +413,8 @@ AlchemyC_02000048:
AlchemyC_020000a0:
.space 0x62
.2byte 0x0000
.4byte 0x6c426883
.4byte 0x6083189b
.4byte 0x68c36c82
.4byte 0x60c3189b
.4byte 0x69036cc2
.4byte 0x6103189b
.4byte 0x69836b02
.4byte 0x6183189b
.4byte 0x69c36b42
.4byte 0x61c3189b
.4byte 0x30646d01
.4byte 0x88028bcb
.4byte 0x83cb189b
.2byte 0x4770
AlchemyC_02000104:
.space 0x36
.2byte 0x0000
push {r5, r6, r7, lr}
mov r7, fp
Expand Down
3 changes: 2 additions & 1 deletion games/THE BROKEN SEAL/raw/overlays/resource_385_overlay.s
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ AlchemyC_020000a0:
.space 0x62
.2byte 0x0000
AlchemyC_02000104:
.space 0x38
.space 0x36
.2byte 0x0000
push {r5, r6, r7, lr}
mov r7, fp
mov r6, sl
Expand Down
Loading