1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-16 04:44:44 +00:00

z_message_PAL, message_data_static and surrounding doc (#996)

* Initial progress on z_message_PAL, very messy

* Fix merge

* Some more progress

* Fix merge

* More z_message_PAL

* Small progress

* More small progress

* message_data_static files OK

* Prepare z_message_tables

* Matched another function, small updates

* Attempt to use asm-processor static-symbols branch

* Refactor text id declarations

* Begin large text codes parser function

* Fix merge

* Refactor done

* Build OK, add color and highscore names

* Remove encoded text headers and automatically encode during build

* Fix kanfont

* Various cleanups

* DISP macros

* Another match aside data

* Further progress

* Small improvements

* Deduplicate magic values for text control codes, small improvements

* Tiny progress

* Minor cleanups

* Clean up z_message_PAL comment

* Progress on large functions

* Further progress on large functions

* Changes to mkldscript to link .data in the .rodata section

* data OK

* Few improvements

* Use gDPLoadTextureBlock macros where appropriate

* rm z_message_tables, progress on large functions

* 2 more matches

* Improvements

* Small progress

* More progress on big function

* progress

* match func_80107980

* match Message_Update

* match func_8010BED8

* done

* Progress on remaining large functions

* Small progress on largest function

* Another match, extract text and move to assets, improve text build system

* Small nonmatchings improvements

* docs wip

* Largest function maybe equivalent

* Fix merge

* Document do_action values, largest function is almost instruction-matching

* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice

* Fix merge

* one match

* Last function is instruction-matching

* Fix

* Improvements thanks to engineer124

* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup

* More variables labeled, use text state enum everywhere

* More labels and names

* Fix

* Actor_IsTalking -> Actor_TalkRequested

* Match func_8010C39C and remove unused asm

* More docs

* Mostly ocarina related docs

* All msgModes named

* Fix assetclean

* Cleanup

* Extraction fixes and headers

* Suggestions

* Review suggestions

* Change text extraction again, only extract if the headers do not already exist

* Fix

* Use ast for charmap, fix assetclean for real this time

* Review suggestions

* BGM ids and ran formatter

* Review comments

* rename include_readonly to include_data_with_rodata

* Remove leading 0s in number directives

* Review suggestions for message_data_static

* textbox pos enum comments, rename several enum names from Message to TextBox

Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
This commit is contained in:
Tharo 2021-11-23 01:20:30 +00:00 committed by GitHub
parent 03636166b3
commit a497f33bda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
216 changed files with 7052 additions and 16801 deletions

View file

@ -22,6 +22,7 @@ enum
STMT_entry,
STMT_flags,
STMT_include,
STMT_include_data_with_rodata,
STMT_name,
STMT_number,
STMT_romalign,
@ -50,6 +51,7 @@ struct Segment
uint32_t entry;
uint32_t number;
char **includes;
uint8_t *data_with_rodata;
int includesCount;
};
@ -176,6 +178,7 @@ static const char *const stmtNames[] =
[STMT_entry] = "entry",
[STMT_flags] = "flags",
[STMT_include] = "include",
[STMT_include_data_with_rodata] = "include_data_with_rodata",
[STMT_name] = "name",
[STMT_number] = "number",
[STMT_romalign] = "romalign",
@ -215,7 +218,7 @@ static void parse_rom_spec(char *spec)
if (currSeg != NULL)
{
// ensure no duplicates (except for 'include')
if (stmt != STMT_include && (currSeg->fields & (1 << stmt)))
if (stmt != STMT_include && stmt != STMT_include_data_with_rodata && (currSeg->fields & (1 << stmt)))
util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtName);
currSeg->fields |= 1 << stmt;
@ -267,8 +270,11 @@ static void parse_rom_spec(char *spec)
util_fatal_error("line %i: alignment is not a power of two", lineNum);
break;
case STMT_include:
case STMT_include_data_with_rodata:
currSeg->includesCount++;
currSeg->includes = realloc(currSeg->includes, currSeg->includesCount * sizeof(*currSeg->includes));
currSeg->data_with_rodata = realloc(currSeg->data_with_rodata, currSeg->includesCount * sizeof(*currSeg->data_with_rodata));
currSeg->data_with_rodata[currSeg->includesCount - 1] = (stmt == STMT_include_data_with_rodata);
if (!parse_quoted_string(args, &currSeg->includes[currSeg->includesCount - 1]))
util_fatal_error("line %i: invalid filename", lineNum);
break;
@ -359,7 +365,10 @@ static void write_ld_script(void)
fprintf(fout, " _%sSegmentDataStart = .;\n", seg->name);
for (j = 0; j < seg->includesCount; j++)
fprintf(fout, " %s (.data)\n", seg->includes[j]);
{
if (!seg->data_with_rodata[j])
fprintf(fout, " %s (.data)\n", seg->includes[j]);
}
/*
for (j = 0; j < seg->includesCount; j++)
@ -378,6 +387,8 @@ static void write_ld_script(void)
for (j = 0; j < seg->includesCount; j++)
{
if (seg->data_with_rodata[j])
fprintf(fout, " %s (.data)\n", seg->includes[j]);
fprintf(fout, " %s (.rodata)\n", seg->includes[j]);
// Compilers other than IDO, such as GCC, produce different sections such as
// the ones named directly below. These sections do not contain values that