Back to Inindo

ROM map

I've included a lot of sub structs/enums in this code block which might later be broken up into different pages/articles to slim down the listing.

Sub structs:

#pragma pack(push)
#pragma pack(1)

struct character_desc_t
{
	char name[12];
	u08 skills;
	// bits:
	// 1 stubborn, flexible
	// 2 responsible, careless
	// 3 serious, carefree
	// 4 pro-nobu, anti-nobu
	// 5 warlike, peaceful
	// 678 null
	u08 personality;
	// category = type / 16 (0 to 3)
	// sub_type = type % 16 (0 to 15)
	character_type_t type;
	// 0 - 30 is a castle which can be looked up via
	// province array in data.province at 14704
	// 30 - 46 is another location (village, mountain, etc)
	// 30 - 46 can be looked up via the string table 
	// located in mmovl0.locations at 425f0
	u08 home;
};

struct province_desc_t
{
	char name[10];
	u08 productivity;
};

struct spell_t
{
	char name[7];
	u08 energy;
	u08 effect1;
	u08 effect2;
};

struct general_t
{
	char name[20];
	u08 war;
	u08 domestic;
};

struct skill_t
{
	char name[14];
	// same as effect2 from spell
	u08 effect;
};

struct province_connections_t
{
	province_id_t to[7];
};

struct item_desc_t
{
	char name[12];
	u16 value;
	// modifies other variables
	u08 flags;
	// same as effect1 from spell
	u08 effect;
	// misses often, high critical rate
	u08 modifier;
};

struct monster_t
{
	char name[16];

	u16 health;
	u16 energy;

	u08 unk0;
	u08 magic_class;
	u08 calls_help;
	u08 unk[8];

	item_id_t uses_item;
	item_id_t drops_item;

	u16 experience;
	u16 gold;

	u16 sprite_index;
};

struct index_addr_t
{
	int get_offset() const { return addr.get_offset(); }
	char name[8];
	snes::address_lorom_t addr;
	u16 length;
	u16 unk;
};

struct byte_pair_t
{
	u08 a, b;
};

template <int length>
struct block_t
{
	u16 head[2];
	u08 unk[length - 4];
};

template <int table_length, int data_length>
struct string_table_t
{
	const int get_length() const { return table_length; }
	const int get_data_length() const { return data_length; }
	const char *operator[](int i) const
	{
		return data + offset_table[i] - offset_table[0];
	}
	u16 offset_table[table_length];
	char data[data_length];
};

struct header_t
{
	// 00/8000
	// 00000
	u08 unk1[15];
	// 0000f
	u08 emulation_reset[141];
	// 0009c
	u32 function_pointer;
	// 000a0
	u08 sub_80a0[240];

	// 00190
	u08 code1[5071];
	
	// 0155f
	u08 tb1_a[64];
	// 0159f
	u08 tb1_b[71];
	// 015e6
	u08 tb1_c[192];
	// 016a6
	u08 tb1_d[22];

	// bitmap decompression function
	// 016bc these three may be one function with multiple rts/jmp
	u08 sub_96bc[145];
	// 0174d ends with jmp to sub_96b2 (to 96e7)
	u08 sub_974d[101];
	// 017b2 called from sub_96bc ends with rts
	u08 sub_97b2[90];

	// 0180c
	u08 unk2[25];

	// 01825 used in sub_97b2
	u16 function_table_1[17];
	// 01847 code referenced in the above table
	u08 subs_9847[38];
	// 0186d used in sub_96bc
	u16 function_table_2[17];
	// 0188f
	u08 subs_988f[42];

	// 018b9 used in sub_8d3a/dispatch_b()
	u16 function_table_3[256];
	// 01ab9
	u08 code2[2993];
	// 02606

	// 0266a used in sub_9fd0/dispatch()
	u16 function_table_4[256];
	// 0286a
	u08 code3[3990];

	// 03800
	u08 code4[16384];
	// 07800
	index_addr_t index[80];
	// 07d00
	u08 unk3[256];
	// 07e00
	u08 unk4[256];
	// 07f00
	u08 unk5[176];

	// 07fe0
	snes::rom_reg_t reg;
	// 07ff0
	snes::rom_spec_t spec;
};

struct indexed_t
{
	// 01/8000
	// 08000
	//block_t<15226> root;
	struct root_t
	{
		u16 head[2];
		u08 unk1[0xfc];
		// 8100
		u08 unk2[0x90];

		u08 unk2b[4096 - 0x90];
		u08 unk2c[1246];
		// 95de (values?)
		u16 unk3[327];
		u08 unk3z;

		// 986d
		u16 function_table[16];
		// 988d
		u08 unk4[8941];
	} root;
	
	// 0bb7a
	//block_t<3988> kp;
	struct kp_t
	{
		u16 head[2];
		i08 unk[3984];
	} kp;

	// 0cb0e
	//block_t<3316> kj;
	struct kj_t
	{
		u16 head[2];
		//u08 unk[3312];
		struct unk_t
		{
			struct unkunk_t
			{
				u08 a;
				struct triplet_t
				{
					u08 x, y, z;
				} b;
				u08 c;
			};

			u08 z1;
			byte_pair_t u1;
			unkunk_t u2;
			u08 z2;
			byte_pair_t u3;
			unkunk_t u4;
		} unk[207];
	} kj;

	// 0d802
	//block_t<5308> rj;
	struct rjdata_t
	{
		u16 head[2];
		monster_t monster[136];
	} rj;

	// 0ecbe
	//block_t<800> ss;
	struct ss_t
	{
		u16 head[2];
		//u08 unk[796];
		struct unk_t
		{
			u16 a, b;
		} unk[199];
	} ss;

	// 0efde
	//block_t<3888> s;
	struct s_t
	{
		u16 head[2];
		u08 unk[3884];
	} s;

	// 0ff0e
	//block_t<16634> cbm;
	struct cbm_t
	{
		u16 head[2];
		u16 unk[8315];
	} cbm;
	
	// 02/c008
	// 14008
	//block_t<8924> data;
	struct data1_t
	{
		u08 head[4];
		character_desc_t character[105];
		u08 unk1[104];
		province_desc_t province[30];
		spell_t spell[42];
		general_t general[103];
		skill_t skill[14];
		u16 level_exp_1[50];
		u16 level_exp_2[50];
		u16 level_exp_3[50];
		u16 level_exp_4[50];
		province_connections_t province_connection[30];
		// 15600
		// 15640 = 2 landscape palette
		// 15660 = 3, 4, 5, 6 to
		// 156c0 white in last entry only
		// 15700 fulltone + halftone palette
		snes::palette_t palette[44];
		u08 unk4[1636];
		u08 unk5[135];
		u16 table1[30];
		u08 unk6[61];
	} data;

	// 162e4
	//block_t<3874> iovl;
	struct iovl_t
	{
		u08 head[4];
		u08 code[3438];
		// 17056
		char sdata[6];
		char load_which_game[17];
		char fmt1[5];
		char fmt2[11];
		char no_saved_game[14];
		char fourteen_hyphens[15];
		char game_is_loaded[27];
		char no_saved_data[25];
		char cannot_load_saved_data[25];
		// 170e7 name entry alphabet
		char caps1[20];
		char caps2[20];
		char caps3[12];
		char lower1[20];
		char lower2[20];
		char lower3[12];
		char space_delete_done[20];
		// 17163
		u16 table[24];
		// 17193
		char is_this_ok[12];
		char underscore1[2];
		char fmt3[3];
		char underscore2[2];
		char fmt4[3];
		char name_your_character[20];
		char ten_hyphens[11];
		// 171c8
		char begin_a_new_game[17];
		char continue_saved_game[20];
		char which_one[25];
	} i;

	// 17206
	//block_t<21540> senmap;
	struct senmap_t
	{
		u16 head[2];

		// 1720a = first palette (+0)
		//
		// = 26 gs gold
		// = 40 gs slate
		// 177ea = 47 gs gray
		// = 48 gs maroon
		// = 49 gs blue
		// = 50 gs red
		// 1786a = 51 black
		//
		// battle palette for:
		// 1788a = 52 hero
		// = 53 koga ninja
		// 178ca = 54 giant rat
		// 178ea = 55 giant centipede
		// 1790a = 56 giant serpent
		// 1792a = 57 toxic worm
		// 1794a = 58 venomora
		// 17a2a = 65 doki
		// 17aaa = 70 manticore
		// 17aca = 71 roc
		// 189aa = last apparent palette
		snes::palette_t pal[190];

		// 189ca
		byte_pair_t unk1[1808];

		// 197ea = bg palettes
		// 0 grass & sky
		// 1 brown cave
		// 2 orange
		// 3 blue
		// 4 wood wall & floor
		snes::palette_t pal2[10];

		// 1992a
		byte_pair_t unk2[5760];
	} senmap;

	// 1c62a
	//block_t<8346> movl;
	struct movl_t
	{
		u16 head[2];
		u08 unk1[5324];
		
		struct text_data_t
		{
			char passed_away[16];
			char want_continue[24];
			u16 unk1[4];
			char defeated[19];
			char killed[17];
			u16 unk2[32];
			char unk3[4];
			char unk4[6];
			char none[5];
			char unkt5[4];
			char select[12];
			char question[4];
			u16 unk5[7];
		} text;

		item_desc_t item[138];
		u08 unk2[475];
	} m;

	// 1e6c4
	//block_t<412> hovl;
	struct hovl_t
	{
		u16 head[2];
		u08 unk1[273];
		struct unk_t
		{
			char name[8];
			u16 a;
			u16 b;
		} unk2[6];
		u08 unk3[63];
	} h;

	// 1e860
	block_t<6812> n0;
	block_t<9502> d0;
	block_t<6000> j0;
	block_t<3368> s0;

	struct c_t
	{
		// 24cb2
		block_t<782>  c1;
		// 24fc0
		// 254aa duplicate of hero combat palette 1788a
		// 254ca duplicate of next palette        178aa
		block_t<1350> c2;
		// 25506
		block_t<2276> c3;
		block_t<1856> c4;
		block_t<1876> c5;
		block_t<2536> c6;
		struct c7_t
		{
			// 27666
			// debug menu
			u16 head[2];
			u08 unk1[4768];
			char see_ending[12];
			char fmt1[9];
			string_table_t<18, 119> game_flags;
			char fmt2[3];
			char end_the_month[14];
			char put_gold_at_maximum[20];
			u08 unk2[184];
			u16 unk_offsets[11];
			u08 unk3[4];
			char add_how_many_points[21];
			string_table_t<8, 48> ai_actions;
			string_table_t<18, 120> town_names;
			string_table_t<3, 15> castle_inn_tea;
			char fmt3[12];
			string_table_t<14, 112> traits;
			char fmt4[20];
			char health[21];
			char energy[13];
			char fmt5[8];
			char home_likability[37];
			char location[22];
			char six_hypens[2][7];
			char command[32];
			char congeniality[22];
			char character_equipment[31];
			char fmt6[13];
			char fmt7[8];
			char fourteen_hyphens[15];
			string_table_t<4, 22> war_spy_sabotage;
			char fmt8[8];
			string_table_t<7, 67> ai_algorithm;
			char fmt9[10];
			char ruler[12];
			char algorithm[19];
			char genls_gold_rice[46];
			char men_arms_trng[44];
			char ask_people_success[70];
			char four_hyphens[5];
			char person_trust[35];
			char ten_hyphens[11];
			char hit_any_key[12];
			char generals[10];
			char fmt10[14];
			char item_number[15];
			string_table_t<2, 18> scenario_version;
			char version[12];
			string_table_t<16, 63> debug_menu_0;
			string_table_t<6, 15> debug_menu_1;
			char C0[5];
		} c7;
	} c;

	// 28f96
	block_t<4560> n1;
	block_t<5680> cs;
	block_t<10148> a;
	block_t<8824> k;

	struct j_t
	{
		// 301b2
		block_t<2068> j1;
		block_t<5994> j2;
	} j;

	struct km_t
	{
		// 32130
		block_t<10656> km1;
		block_t<11040> km2;
		block_t<11092> km3;
		block_t<11386> km4;
		block_t<11284> km5;
	} km;

	// 3f9d2
	block_t<9110> d1;

	struct mm_t
	{
		// 41d68 root
		struct mm0_t
		{
			u16 head[2];
			u08 unk1[2000];
			u16 unk2[39];
			char weapon[11];
			char protection[11];
			char item[11];
			char strcode1[4];
			char attack_defend_resist[25];
			char strcodes2[27];
			char lands[6];
			char people[7];
			string_table_t<18, 154> town_names;
			u16 unk3[4];
			char strcode3[8];
			string_table_t<12, 54> location_names;
			char unk4[4];
			struct weird_3byte_code_t
			{
				u08 a,b,c;
			};
			weird_3byte_code_t C2;
			char you_dont_have_enough[22];
			weird_3byte_code_t C0;
			weird_3byte_code_t G;
			char nul;
		} mm0;
		// 42730 tower
		block_t<650>  mm1;
		// 429ba inn
		block_t<1468> mm2;
		// 42f76 tea
		block_t<174>  mm3;
		// 43024 guild
		block_t<1012> mm4;
		// 43418 arms
		block_t<780>  mm5;
		// 43724 medic
		block_t<702>  mm6;
		// 439e2 pawn
		block_t<2228> mm7;
		// 44296 bingo
		block_t<6848> mm8;
		// 45d56 seer
		block_t<1418> mm9;
	} mmovl;

	struct ms_t
	{
		// 462e0 castle (meet)
		block_t<1684> ms0;
		// 46974 meet
		struct ms1_t
		{
			u08 head[4];
			u08 code[1302];
			string_table_t<3, 82> name;
			char im_s_the[11];
			char cs_period[6];
			string_table_t<3, 94> goal1;
			string_table_t<3, 69> goal2;
			string_table_t<1, 24> goal3;
			string_table_t<6, 216> goal4;
			string_table_t<4, 172> goal5;
			string_table_t<19, 332> goal6;
			string_table_t<10, 418> goal7;
			u16 offsets1[8];
			string_table_t<11, 446> info;
			string_table_t<15, 654> oda;
			u16 offsets2[5];
			string_table_t<4, 76> dislike;
		} ms1;
		// 4796e meet
		block_t<1918> ms2;
		// 480ec castle war / jobs
		block_t<3924> ms3;
		// 49040 daimyo
		block_t<3816> ms4;
		// 49f28 information (tea)
		block_t<1518> ms5;
	} msovl;

	struct sen_t
	{
		// 4a516
		struct sn_t
		{
			block_t<3364> s1;
			// battle strings
			block_t<8048> s2;
			block_t<3238> s3;
		} sn;

		struct ssn_t
		{
			// 4de50
			// combat related strings "Attack with your sidearm?"
			block_t<8726> ss1;
			block_t<5538> ss2;
			block_t<1406> ss3;
		} ssn;

		struct sss_t
		{
			// 51b86
			// magic strings
			block_t<2856> sss1;
			block_t<3570> sss2;
			block_t<4410> sss3;
			block_t<3870> sss4;
			block_t<2232> sss5;
		} sss;
	} sen;

	struct h_t
	{
		// 55db0
		// battle magic (?)
		block_t<18188> hm;
		block_t<3758> hi;
		block_t<3016> he;
		block_t<6190> hu;
		block_t<1390> hc;
		// 5dcce
		// "the dragon blasted fire"
		block_t<3346> hk;
	} hovl;

	// 5e9e0
	block_t<9064> opening;

	// 60d48
	struct endovl_t
	{
		u16 head[2];
		u16 unk1[3453];
		u16 unk2[120];
		struct data_pattern_t
		{
			u16 a, b, c, d, e;
		} unk3[32];

		struct text_data_t
		{
			string_table_t<8, 114> text0;
			string_table_t<23, 398> text1;
			char unkc;
			string_table_t<24, 405> text2;
			string_table_t<17, 225> text3;
			char format_str[13];
		} text;

		u16 unk4[1575];
		u16 unk5[121];
		u16 unk6[512];
	} end;
};

struct rom_data_t
{
	// 00000
	header_t head;
	// 08000
	indexed_t indexed;
	// 640ca
	tile_data_t tile;
	// fffff
}; 

#pragma pack(pop)