-
Notifications
You must be signed in to change notification settings - Fork 0
RE Tools
Navigation: Home - Tools - RE Tools
- IRA is an Amiga program. It is meant to run on real Amiga hardware or in WinUAE / FS-UAE, not as a native Windows .exe.
- The listing
EXTRACTED/mm2.asmin this repo was already produced by IRA V2.11. You can search and read it in any editor without running IRA yourself. - To run IRA yourself: copy
mm2onto an Amiga hardfile, run IRA from Amiga, point it at the executable, export.asm. Expect setup friction (Kickstart, tools, paths).
- Ghidra has a 68000 CPU module, but no built-in Amiga hunk loader.
- Importing
mm2directly usually fails or shows garbage, because the file is a hunk container (headers, relocations, multiple segments), not a flat ROM image. - Fixes that work on Windows:
- Import flat segments extracted by this repo (recommended below).
- Install a third-party Amiga hunk loader extension (search GitHub for
ghidra amiga hunk loader— names change; pick one that mentions LoadSeg/hunk).
From the MM2 folder:
pip install -r tools\requirements.txt
# Full linear disassembly (~50k insns) — Capstone + hunk parser
python tools\disasm_m68k.py mm2
# Segment binaries + addresses for Ghidra
python tools\extract_segments.py mm2Outputs:
| Tool | Output | Use |
|---|---|---|
disasm_m68k.py |
EXTRACTED/mm2.capstone.asm |
Quick grep, opcode search |
extract_segments.py |
EXTRACTED/ghidra/mm2_code_*.bin, mm2_segments.json
|
Ghidra / IDA raw import |
| (existing) | EXTRACTED/mm2.asm |
Best static listing (IRA labels, DC for data) |
harvest_symbols.py |
EXTRACTED/mm2_symbols.yaml |
Harvest names/addresses from EXTRACTED/docs/
|
apply_symbols.py |
EXTRACTED/mm2.annotated.asm, mm2.capstone.annotated.asm
|
Inject symbol comments into disassembly |
extract_asm_parts.py |
EXTRACTED/asm/*.asm |
Split listing into commented subsystem files |
scan_a4_jsr.py |
stdout | List JSR d(A4) thunks with names from yaml |
GOG MM2.EXE, CGA.DRV, EGA.DRV:
python tools\disasm_pc_x86.py "C:\Program Files (x86)\GOG Galaxy\Games\Might and Magic 2\MM2.EXE" `
"C:\Program Files (x86)\GOG Galaxy\Games\Might and Magic 2\CGA.DRV" `
"C:\Program Files (x86)\GOG Galaxy\Games\Might and Magic 2\EGA.DRV"| Tool | Output | Use |
|---|---|---|
disasm_pc_x86.py |
EXTRACTED/pc/mm2.capstone.asm, cga.capstone.asm, ega.capstone.asm
|
PC x86 RE (Capstone CS_MODE_16) |
decode_pc_gfx.py |
EXTRACTED/pc_gfx/ |
Extract .4 / .16 — wall sheets + monster atlas |
export_monster_variants.py |
EXTRACTED/monster_variants/ |
Per-monsters.dat Amiga/CGA/EGA combat GIFs |
gen_gfx_compare_html.py |
EXTRACTED/pc_gfx/compare/ |
Numbered slot index: monsters 01–74 + wall sheets |
pc_gfx_export.py |
wiki/public/gallery/pc/ |
Wiki gallery for PC CGA/EGA assets |
See EXTRACTED/docs/54-pc-dos-graphics-formats.md and EXTRACTED/pc/README.md for
format specs (0x2A42 LZW, MONSTERS.* u32 header, 0x6824 loader, prelude compositing, …).
python tools\decode_pc_gfx.py "C:\Program Files (x86)\GOG Galaxy\Games\Might and Magic 2" --batch
python tools\export_monster_variants.py
python tools\gen_gfx_compare_html.py
python wiki\scripts\export-platform-compare.py # wiki: monsters + walls iframe page
python wiki\scripts\export-monster-variants.py # wiki gallery page
python tools\pc_gfx_export.pyPython:
python tools\mm2_codec.py items-decode items.dat items.csv
python tools\mm2_codec.py items-encode items.csv items.dat
python tools\mm2_codec.py str-decode str.dat str.txt
python tools\mm2_codec.py str-encode str.txt str.datC (compile + run):
gcc tools\mm2_codec.c -O2 -o tools\mm2_codec.exe
tools\mm2_codec.exe items-decode items.dat items.csv
tools\mm2_codec.exe items-encode items.csv items.dat
tools\mm2_codec.exe str-decode str.dat str.txt
tools\mm2_codec.exe str-encode str.txt str.datplay is only an AmigaDOS script (assigns fonts/libs, runs mm2). Disassemble mm2, not play.
-
Run
python tools\extract_segments.py mm2. -
File → Import File →
EXTRACTED/ghidra/mm2_code_00.bin. -
Format: Raw binary.
-
Language: Motorola 68000:BE:32:default (big-endian 68000).
-
Base address: 0 (see
mm2_segments.json→ first code segmentload_addr). -
After import: Window → Memory Map — confirm base
00000000. -
Navigate → Go To →
00000018(entry after stub; see manifestentry_points). -
Symbol → Create Label at that address (e.g.
start). -
Import
mm2_code_01.binat base0x27adc(see manifest — data/BSS sit between the two code hunks in the real load map).Alternative: if you only care about code and want addresses to match
mm2.capstone.asm, place the overlay at0x2593c(immediately after the first code hunk, skipping data).
Limitations: relocations are not applied. Jump targets and A4-based Amiga OS calls may look wrong until you fix them manually or use a hunk loader plugin.
| Item | Offset (seg 0) | Notes |
|---|---|---|
| Hunk header | file 0x0
|
Not in extracted .bin
|
| Code start | file 0x20 / load 0x0
|
First byte of mm2_code_00.bin
|
jmp main |
load 0x18
|
4ef9 0002 48ae → game init ~0x248ae
|
| Data | load 0x2593c
|
mm2_data_00.bin |
| Overlay code | load 0x27adc
|
mm2_code_01.bin (or 0x2593c in code-only views) |
Main game init is around 0x248ae in the first code segment (search mm2.asm for LAB_248AE or capstone listing).
Use EXTRACTED/mm2.asm as your primary reference. Re-run IRA only if you need a fresh export after patching the binary.
For interactive decompilation on Windows without Amiga: Ghidra + extracted segments, or consider Binary Ninja / IDA with the same flat binaries and manifest bases.
- Docs Wiki Hub ← full doc index
- Getting Started ← read this first
- Overview
- Workspace Notes
- Open Questions
- Full Analysis
- Game Remake
- Startup and Init
- Runtime Memory Map
- Main Loop and Map
- Exploration Input and Options
- Party and Session
- Game State Struct
- Data Hunk mm2 data 00
- Time Era Calendar
- GFX Loading
- ANM TV Format
- PC DOS graphics
- SNES graphics
- 3D View and Game Screen
- Amiga 3D Render Process
- Scripted Scene Graphics
- Event Graphics Opcodes
- Title Screen Assets
- Title Screen Animation
- Format inventory
- items.dat
- monsters.dat
- roster.dat
- attrib.dat
- map.dat
- spells & item use
- event.dat
- Events by location ← 71 maps
- Events hub (numbered)
- Event Script Opcodes
-
Event Script DSL ←
.mm2evtauthoring - Event Text Rendering
- Event Graphics Opcodes
- Combat Overview
- Combat System
- Encounter Tables
- Spell Cast ASM
- monsters.dat abilities
- Spells and item use
- Town Services
- Spell Sources
- Character Mechanics
- Skills and Hirelings
- Commerce Formulas
- Commerce World Services
- Mount Farview Class Quest
- Class Quest HP Bug
- Event Runtime
- Event to String Path
- Embedded Exe Strings
- Copy Protection
- Time Era Calendar
- Game State Struct
- MM1 Overview ← hub + decode status
- MM1 MAZEDATA format
- MM1 to MM2 outdoor
- MM1 WALLPIX by sector
- MM1 art & graphics
- MM1 items / monsters (status)
- MM1 map walker ↗
- MM1 2D maps gallery
- MM1 WALLPIX gallery