mirror of
https://github.com/BanjoRecomp/BanjoRecomp
synced 2026-05-23 22:45:12 -04:00
Fix dialog serialization and add green/blue screens.
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
#include "patches.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern struct {
|
||||
u8 unk0;
|
||||
char* ptr;
|
||||
s32 index;
|
||||
} s_dialogBin;
|
||||
|
||||
extern s32 code94620_func_8031B5B0(void);
|
||||
|
||||
static char dialog_bytes[1024];
|
||||
char* dialog_byte_cursor = NULL;
|
||||
char* dialog_byte_character_cursor = NULL;
|
||||
|
||||
void start_dialog_bin() {
|
||||
dialog_byte_cursor = &dialog_bytes[0];
|
||||
dialog_byte_character_cursor = dialog_byte_cursor;
|
||||
*(dialog_byte_cursor++) = 0;
|
||||
}
|
||||
|
||||
void add_dialog_bin_string(char command, const char* string) {
|
||||
u32 length_with_zero = strlen(string) + 1;
|
||||
*(dialog_byte_cursor++) = command;
|
||||
*(dialog_byte_cursor++) = length_with_zero;
|
||||
memcpy(dialog_byte_cursor, string, length_with_zero);
|
||||
dialog_byte_cursor += length_with_zero;
|
||||
*dialog_byte_character_cursor += 1;
|
||||
}
|
||||
|
||||
void next_dialog_bin_character() {
|
||||
dialog_byte_character_cursor = dialog_byte_cursor;
|
||||
*(dialog_byte_cursor++) = 0;
|
||||
}
|
||||
|
||||
char *end_dialog_bin() {
|
||||
u32 dialog_size = dialog_byte_cursor - dialog_bytes;
|
||||
char *alloc = malloc_recomp(dialog_size);
|
||||
memcpy(alloc, dialog_bytes, dialog_size);
|
||||
#if 0
|
||||
recomp_printf("[%d]: ", dialog_size);
|
||||
|
||||
for (u32 i = 0; i < dialog_size; i++) {
|
||||
recomp_printf("0x%X ", dialog_bytes[i]);
|
||||
}
|
||||
#endif
|
||||
return alloc;
|
||||
}
|
||||
|
||||
RECOMP_PATCH char* dialogBin_get(enum asset_e text_id) {
|
||||
char* sp1C;
|
||||
char* var_v0;
|
||||
s32 var_a0; //offset where text starts (normally 0x3)
|
||||
|
||||
//get text_bin from asset cache
|
||||
s_dialogBin.ptr = assetcache_get(text_id);
|
||||
sp1C = s_dialogBin.ptr + 1;
|
||||
sp1C += code94620_func_8031B5B0() * 2;
|
||||
var_a0 = *(sp1C++);
|
||||
var_a0 += *(sp1C++) << 8;
|
||||
if (sp1C);
|
||||
var_v0 = s_dialogBin.ptr + var_a0;
|
||||
s_dialogBin.index = text_id;
|
||||
|
||||
#if 0
|
||||
recomp_printf("static char dialog_%d[] = {", text_id);
|
||||
|
||||
char* c = var_v0;
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
char count = *(c++);
|
||||
recomp_printf("0x%X, ", count);
|
||||
|
||||
for (char j = 0; j < count; j++) {
|
||||
char cmd = *(c++);
|
||||
char len = *(c++);
|
||||
recomp_printf("0x%X, ", cmd);
|
||||
recomp_printf("0x%X, ", len);
|
||||
|
||||
for (char k = 0; k < len; k++) {
|
||||
if (*c == '\'') {
|
||||
recomp_printf("'\\'', ");
|
||||
}
|
||||
else if ((*c >= 'a' && *c <= 'z') || (*c >= 'A' && *c <= 'Z') || (*c >= '0' && *c <= '9') || (*c >= ' ' && *c <= '?')) {
|
||||
recomp_printf("'%c', ", *c);
|
||||
}
|
||||
else {
|
||||
recomp_printf("0x%X, ", *c);
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recomp_printf("}\n");
|
||||
#endif
|
||||
|
||||
#define DIALOGUE_BANJO_HEAD 0x80
|
||||
#define DIALOGUE_KAZOOIE_HEAD 0x81
|
||||
#define DIALOGUE_MUMBO_HEAD 0x84
|
||||
#define DIALOGUE_COMMAND_END 0x4
|
||||
|
||||
switch (text_id) {
|
||||
case 3705:
|
||||
static char* dialog_3705;
|
||||
if (dialog_3705 == NULL) {
|
||||
start_dialog_bin();
|
||||
add_dialog_bin_string(DIALOGUE_MUMBO_HEAD, "HEY...MUMBO GOT SECRET PICTURES!");
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
next_dialog_bin_character();
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
dialog_3705 = end_dialog_bin();
|
||||
}
|
||||
|
||||
return dialog_3705;
|
||||
case 3706:
|
||||
static char* dialog_3706;
|
||||
if (dialog_3706 == NULL) {
|
||||
start_dialog_bin();
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
next_dialog_bin_character();
|
||||
add_dialog_bin_string(DIALOGUE_KAZOOIE_HEAD, "NICE ONE, BONE BRAIN! WHAT'S ON THEM?");
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
dialog_3706 = end_dialog_bin();
|
||||
}
|
||||
|
||||
return dialog_3706;
|
||||
case 3707:
|
||||
static char* dialog_3707;
|
||||
if (dialog_3707 == NULL) {
|
||||
start_dialog_bin();
|
||||
add_dialog_bin_string(DIALOGUE_MUMBO_HEAD, "GOT PICTURES OF NEXT PORT. WISEGUY GAVE THEM TO ME.");
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
next_dialog_bin_character();
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
dialog_3707 = end_dialog_bin();
|
||||
}
|
||||
|
||||
return dialog_3707;
|
||||
case 3708:
|
||||
static char* dialog_3708;
|
||||
if (dialog_3708 == NULL) {
|
||||
start_dialog_bin();
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
next_dialog_bin_character();
|
||||
add_dialog_bin_string(DIALOGUE_BANJO_HEAD, "OOOH...DID YOU HEAR THAT KAZOOIE? THERE'S GOING TO BE ANOTHER RECOMP!");
|
||||
add_dialog_bin_string(DIALOGUE_KAZOOIE_HEAD, "IS IT THE ELF BOY AGAIN? HE ALWAYS GETS ALL THE ATTENTION.");
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
dialog_3708 = end_dialog_bin();
|
||||
}
|
||||
|
||||
return dialog_3708;
|
||||
case 3709:
|
||||
static char* dialog_3709;
|
||||
if (dialog_3709 == NULL) {
|
||||
start_dialog_bin();
|
||||
add_dialog_bin_string(DIALOGUE_MUMBO_HEAD, "NO OCARINA. TAKING FOREVER. OTHER INSTRUMENTS FIRST.");
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
next_dialog_bin_character();
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
dialog_3709 = end_dialog_bin();
|
||||
}
|
||||
|
||||
return dialog_3709;
|
||||
case 3717:
|
||||
static char* dialog_3717;
|
||||
if (dialog_3717 == NULL) {
|
||||
start_dialog_bin();
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
next_dialog_bin_character();
|
||||
add_dialog_bin_string(DIALOGUE_BANJO_HEAD, "SOUNDS EXCITING. WHAT COULD IT BE?");
|
||||
add_dialog_bin_string(DIALOGUE_KAZOOIE_HEAD, "YEAH SHOW US YOUR SECRETS.");
|
||||
add_dialog_bin_string(DIALOGUE_COMMAND_END, "");
|
||||
dialog_3717 = end_dialog_bin();
|
||||
}
|
||||
|
||||
return dialog_3717;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return var_v0;
|
||||
}
|
||||
@@ -28,3 +28,15 @@ RECOMP_PATCH void dummy_func_8025AFB0(void) {
|
||||
// This allows the start indices to account for any changes made by mods.
|
||||
calculate_map_start_note_indices();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
RECOMP_PATCH enum map_e getDefaultBootMap(void) {
|
||||
return MAP_95_CS_END_ALL_100;
|
||||
}
|
||||
|
||||
RECOMP_PATCH int ability_hasLearned(enum ability_e ability) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -335,6 +335,18 @@ RECOMP_PATCH void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx) {
|
||||
f32 sp38[3];
|
||||
f32 sp34;
|
||||
|
||||
#if 1
|
||||
// @recomp Greenscreen for recording.
|
||||
const u32 half_height = DEFAULT_FRAMEBUFFER_HEIGHT / 2;
|
||||
const u32 uly = (this->unk172 / half_height) * half_height;
|
||||
const u32 blue = 0x003F003F;
|
||||
const u32 green = 0x07C107C1;
|
||||
gDPSetCycleType((*gfx)++, G_CYC_FILL);
|
||||
gDPSetRenderMode((*gfx)++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor((*gfx)++, blue);
|
||||
gDPScisFillRectangle((*gfx)++, 0, uly, DEFAULT_FRAMEBUFFER_WIDTH - 1, uly + half_height - 1);
|
||||
#endif
|
||||
|
||||
// @recomp Align the zoombox to the left of the screen if necessary.
|
||||
// NOTE: gScissorBoxRight/gScissorBoxTop are incorrectly named in the decompilation and must be swapped.
|
||||
if (left_aligned_zoombox(this)) {
|
||||
|
||||
@@ -150,6 +150,17 @@ RECOMP_PATCH Actor *func_802E0738(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx
|
||||
return this;
|
||||
}
|
||||
|
||||
#if 1
|
||||
if (marker->modelId == 0x355) {
|
||||
// @recomp Greenscreen for recording concert Banjo.
|
||||
const u32 green = 0x07C107C1;
|
||||
gDPSetCycleType((*gfx)++, G_CYC_FILL);
|
||||
gDPSetRenderMode((*gfx)++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor((*gfx)++, green);
|
||||
gDPScisFillRectangle((*gfx)++, 0, 0, DEFAULT_FRAMEBUFFER_WIDTH - 1, DEFAULT_FRAMEBUFFER_HEIGHT - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
modelRender_preDraw((GenFunction_1)func_802E0710, (s32)this);
|
||||
modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)marker);
|
||||
modelRender_draw(gfx, mtx, this->position, sp34, this->scale, NULL, marker_loadModelBin(marker));
|
||||
|
||||
Reference in New Issue
Block a user