You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
2.1.0 Puppyprint Changes (#362)
* Puppyprint text size * Update puppyprint.c * Revert broken render_multi_image changes * revert multi image tweak parallel momento * Update puppyprint debug colors to work with new hexadecimal system * Puppyprint color reversion to currEnv + some bugfixes * Remove a pointless color array * Add forgotten comment * i can type yes definitely * Fix some puppyprint formatting edge cases * Missed one last puppyprint edge case * Additional strLen check * Variable length fix + command ignoring strlen * type changes * Update puppyprint.c * Box clamping * Revamped profiling, fixed right alignment * Update puppycam2.c * Deferred printing * Update puppyprint.c * Fixed negatives being stupid * Puppyprint Memory view rework * Update level_script.c * tweaks * Fix new line spacing with different scales also small bit of optimisation * Spacing fixes * Lightweight text option * puppyprint debug now using light text where applicable * Update puppyprint.c * Update puppyprint.c * level select menu * merge profilers into one WIP * Fully ascii compliant * Finishing touches hopefully * Update puppyprint.c * new font * vanilla font * o * Update hud.c * last kerning fixes * Requested changes * requested changes * fix the j * requested changes * change ur clothes * Update surface_collision.c * requested changes * Update puppyprint.h * Update camera.c * . * Update puppyprint.c * Update puppyprint.c * Update puppyprint.c * fix J * font * font system rework * ia4 outline font * pain * fix deferred printing * fix format change * Add audio profiling to Puppyprint Debug * Optimize audio profiling substantially * Minor audio optimizations * requested changes * oops accidentally commited 6 lmfao * Update game_init.c * Update puppyprint.c * Update puppyprint.c * Improve Puppyprint deferred prints This is safer, more readable, and more runtime efficient all in the same package * change return type * fix building with profiler only * Update profiling.c * fix upscaled texture rectangles from multi image --------- Co-authored-by: gheskett <gheskett@gmail.com>
This commit is contained in:
150
bin/segment2.c
150
bin/segment2.c
@@ -5,40 +5,152 @@
|
||||
#include "macros.h"
|
||||
#include "types.h"
|
||||
#include "game/ingame_menu.h"
|
||||
#include "game/puppyprint.h"
|
||||
|
||||
#include "make_const_nonconst.h"
|
||||
|
||||
// SM64 (US/JP/EU/SH) Segment 02
|
||||
#ifdef PUPPYPRINT
|
||||
ALIGNED8 static const Texture small_font_1[] = {
|
||||
ALIGNED8 static const Texture small_font_default[] = {
|
||||
#include "textures/segment2/custom_text.i4.inc.c"
|
||||
};
|
||||
ALIGNED8 static const Texture small_font_2[] = {
|
||||
#include "textures/segment2/custom_text2.i4.inc.c"
|
||||
ALIGNED8 static const Texture small_font_outline[] = {
|
||||
#include "textures/segment2/custom_text2.ia4.inc.c"
|
||||
};
|
||||
ALIGNED8 static const Texture small_font_plain[] = {
|
||||
#include "textures/segment2/custom_text3.i4.inc.c"
|
||||
};
|
||||
ALIGNED8 static const Texture small_font_vanilla[] = {
|
||||
#include "textures/segment2/custom_text4.i4.inc.c"
|
||||
};
|
||||
|
||||
const Texture *const puppyprint_font_lut[2] = {
|
||||
small_font_1, small_font_2
|
||||
const u8 small_font_kerning_default[] = {
|
||||
/*!*/ 4, /*"*/ 5, /*#*/ 0, /*$*/ 0, /*%*/ 8, /*&*/ 8, /*'*/ 2, /*(*/ 5, /*)*/ 5, /***/ 0, /*+*/ 8, /*,*/ 3, /*-*/ 8, /*.*/ 3, /*/*/ 8, /*0*/ 6,
|
||||
/*1*/ 5, /*2*/ 7, /*3*/ 7, /*4*/ 7, /*5*/ 7, /*6*/ 8, /*7*/ 7, /*8*/ 7, /*9*/ 6, /*:*/ 3, /*;*/ 3, /*<*/ 0, /*=*/ 0, /*>*/ 0, /*?*/ 6, /*@*/ 0,
|
||||
/*A*/ 7, /*B*/ 7, /*C*/ 7, /*D*/ 7, /*E*/ 6, /*F*/ 5, /*G*/ 8, /*H*/ 6, /*I*/ 6, /*J*/ 5, /*K*/ 7, /*L*/ 6, /*M*/ 7, /*N*/ 7, /*O*/ 7, /*P*/ 6,
|
||||
/*Q*/ 8, /*R*/ 6, /*S*/ 7, /*T*/ 7, /*U*/ 7, /*V*/ 7, /*W*/ 8, /*X*/ 7, /*Y*/ 7, /*Z*/ 7, /*[*/ 0, /*\\*/ 0, /*]*/ 0, /*^*/ 8, /*_*/ 0, /*`*/ 0,
|
||||
/*a*/ 7, /*b*/ 7, /*c*/ 6, /*d*/ 7, /*e*/ 7, /*f*/ 7, /*g*/ 7, /*h*/ 7, /*i*/ 3, /*j*/ 5, /*k*/ 8, /*l*/ 4, /*m*/ 7, /*n*/ 7, /*o*/ 7, /*p*/ 7,
|
||||
/*q*/ 7, /*r*/ 6, /*s*/ 6, /*t*/ 6, /*u*/ 6, /*v*/ 7, /*w*/ 8, /*x*/ 6, /*y*/ 8, /*z*/ 7, /*~*/ 8,
|
||||
};
|
||||
|
||||
static const u8 small_font_kerning_1[80] = {
|
||||
/*0*/ 6, /*1*/ 5, /*2*/ 7, /*3*/ 7, /*4*/ 7, /*5*/ 7, /*6*/ 8, /*7*/ 7, /*8*/ 7, /*9*/ 6, /*-*/ 8, /*+*/ 8, /*(*/ 5, /*)*/ 5, /*!*/ 4, /*?*/ 6,
|
||||
/*A*/ 7, /*B*/ 7, /*C*/ 7, /*D*/ 7, /*E*/ 6, /*F*/ 5, /*G*/ 8, /*H*/ 6, /*I*/ 6, /*J*/ 5, /*K*/ 7, /*L*/ 6, /*M*/ 7, /*N*/ 7, /*O*/ 7, /*P*/ 6,
|
||||
/*Q*/ 8, /*R*/ 6, /*S*/ 7, /*T*/ 7, /*U*/ 7, /*V*/ 7, /*W*/ 8, /*X*/ 7, /*Y*/ 7, /*Z*/ 7, /*"*/ 5, /*'*/ 2, /*:*/ 3, /*;*/ 3, /*.*/ 3, /*,*/ 3,
|
||||
/*a*/ 7, /*b*/ 7, /*c*/ 6, /*d*/ 7, /*e*/ 7, /*f*/ 7, /*g*/ 7, /*h*/ 7, /*i*/ 3, /*j*/ 5, /*k*/ 8, /*l*/ 4, /*m*/ 7, /*n*/ 7, /*o*/ 7, /*p*/ 7,
|
||||
/*q*/ 7, /*r*/ 6, /*s*/ 6, /*t*/ 6, /*u*/ 6, /*v*/ 7, /*w*/ 8, /*x*/ 6, /*y*/ 8, /*z*/ 7, /*~*/ 8, /*¨*/ 7, /*^*/ 8, /*/*/ 8, /*%*/ 8, /*&*/ 8,
|
||||
const u16 small_font_offsets_default[] = {
|
||||
/*!*/ 0, /*"*/ 8, /*#*/ 16, /*$*/ 24, /*%*/ 32, /*&*/ 40, /*'*/ 48, /*(*/ 56, /*)*/ 64, /***/ 72, /*+*/ 80, /*,*/ 88, /*-*/ 96, /*.*/ 104, /*/*/ 112,
|
||||
/*0*/ 120, /*1*/ 128, /*2*/ 136, /*3*/ 144, /*4*/ 152, /*5*/ 160, /*6*/ 168, /*7*/ 176, /*8*/ 184, /*9*/ 192, /*:*/ 200, /*;*/ 208, /*<*/ 216, /*=*/ 216,
|
||||
/*>*/ 0, /*?*/ 216, /*@*/ 0, /*A*/ 224, /*B*/ 232, /*C*/ 240, /*D*/ 248, /*E*/ 256, /*F*/ 264, /*G*/ 272, /*H*/ 280, /*I*/ 288, /*J*/ 296, /*K*/ 304,
|
||||
/*L*/ 312, /*M*/ 320, /*N*/ 328, /*O*/ 336, /*P*/ 344, /*Q*/ 352, /*R*/ 360, /*S*/ 368, /*T*/ 376, /*U*/ 384, /*V*/ 392, /*W*/ 400, /*X*/ 408, /*Y*/ 416,
|
||||
/*Z*/ 424, /*[*/ 432, /*\*/ 432, /*]*/ 432, /*^*/ 432, /*_*/ 440, /*`*/ 440, /*a*/ 440, /*b*/ 448, /*c*/ 456, /*d*/ 464, /*e*/ 472, /*f*/ 480, /*g*/ 488,
|
||||
/*h*/ 496, /*i*/ 504, /*j*/ 512, /*k*/ 520, /*l*/ 528, /*m*/ 536, /*n*/ 544, /*o*/ 552, /*p*/ 560, /*q*/ 568, /*r*/ 576, /*s*/ 584, /*t*/ 592, /*u*/ 600,
|
||||
/*v*/ 608, /*w*/ 616, /*x*/ 624, /*y*/ 632, /*z*/ 640, /*{*/ 648, /*|*/ 648, /*}*/ 648, /*~*/ 648, /*:)*/ 656
|
||||
};
|
||||
|
||||
static const u8 small_font_kerning_2[80] = {
|
||||
/*0*/ 6, /*1*/ 6, /*2*/ 6, /*3*/ 6, /*4*/ 6, /*5*/ 6, /*6*/ 6, /*7*/ 6, /*8*/ 6, /*9*/ 6, /*-*/ 6, /*+*/ 6, /*(*/ 3, /*)*/ 3, /*!*/ 4, /*?*/ 5,
|
||||
/*A*/ 6, /*B*/ 6, /*C*/ 6, /*D*/ 6, /*E*/ 6, /*F*/ 6, /*G*/ 6, /*H*/ 6, /*I*/ 6, /*J*/ 6, /*K*/ 6, /*L*/ 6, /*M*/ 6, /*N*/ 6, /*O*/ 6, /*P*/ 6,
|
||||
/*Q*/ 6, /*R*/ 6, /*S*/ 6, /*T*/ 6, /*U*/ 6, /*V*/ 6, /*W*/ 6, /*X*/ 6, /*Y*/ 6, /*Z*/ 6, /*"*/ 4, /*'*/ 1, /*:*/ 2, /*;*/ 2, /*.*/ 2, /*,*/ 2,
|
||||
/*a*/ 5, /*b*/ 5, /*c*/ 5, /*d*/ 5, /*e*/ 5, /*f*/ 5, /*g*/ 5, /*h*/ 5, /*i*/ 1, /*j*/ 5, /*k*/ 5, /*l*/ 3, /*m*/ 5, /*n*/ 5, /*o*/ 5, /*p*/ 5,
|
||||
/*q*/ 5, /*r*/ 5, /*s*/ 5, /*t*/ 5, /*u*/ 5, /*v*/ 5, /*w*/ 5, /*x*/ 5, /*y*/ 5, /*z*/ 5, /*~*/ 6, /*¨*/ 5, /*^*/ 6, /*/*/ 5, /*%*/ 5, /*&*/ 6,
|
||||
static const u8 small_font_kerning_outline[] = {
|
||||
/*!*/ 3, /*"*/ 4, /*#*/ 0, /*$*/ 0, /*%*/ 6, /*&*/ 6, /*'*/ 2, /*(*/ 4, /*)*/ 4, /***/ 0, /*+*/ 6, /*,*/ 2, /*-*/ 6, /*.*/ 2, /*/*/ 6, /*0*/ 6,
|
||||
/*1*/ 6, /*2*/ 6, /*3*/ 6, /*4*/ 6, /*5*/ 6, /*6*/ 6, /*7*/ 6, /*8*/ 6, /*9*/ 6, /*:*/ 2, /*;*/ 2, /*<*/ 0, /*=*/ 0, /*>*/ 0, /*?*/ 6, /*@*/ 0,
|
||||
/*A*/ 6, /*B*/ 6, /*C*/ 6, /*D*/ 6, /*E*/ 6, /*F*/ 6, /*G*/ 6, /*H*/ 6, /*I*/ 5, /*J*/ 7, /*K*/ 6, /*L*/ 6, /*M*/ 6, /*N*/ 6, /*O*/ 6, /*P*/ 6,
|
||||
/*Q*/ 6, /*R*/ 6, /*S*/ 6, /*T*/ 6, /*U*/ 6, /*V*/ 6, /*W*/ 6, /*X*/ 6, /*Y*/ 6, /*Z*/ 6, /*[*/ 0, /*\\*/ 0, /*]*/ 0, /*^*/ 7, /*_*/ 0, /*`*/ 0,
|
||||
/*a*/ 5, /*b*/ 5, /*c*/ 5, /*d*/ 5, /*e*/ 5, /*f*/ 5, /*g*/ 5, /*h*/ 5, /*i*/ 2, /*j*/ 6, /*k*/ 4, /*l*/ 2, /*m*/ 5, /*n*/ 5, /*o*/ 5, /*p*/ 5,
|
||||
/*q*/ 5, /*r*/ 5, /*s*/ 5, /*t*/ 5, /*u*/ 5, /*v*/ 5, /*w*/ 5, /*x*/ 5, /*y*/ 5, /*z*/ 5, /*~*/ 6,
|
||||
};
|
||||
|
||||
const u8 *const puppyprint_kerning_lut[2][80] = {
|
||||
small_font_kerning_1, small_font_kerning_2
|
||||
const u16 small_font_offsets_outline[] = {
|
||||
/*!*/ 0, /*"*/ 8, /*#*/ 16, /*$*/ 24, /*%*/ 32, /*&*/ 40, /*'*/ 48, /*(*/ 56, /*)*/ 64, /***/ 72, /*+*/ 80, /*,*/ 88, /*-*/ 96, /*.*/ 104, /*/*/ 112,
|
||||
/*0*/ 120, /*1*/ 128, /*2*/ 136, /*3*/ 144, /*4*/ 152, /*5*/ 160, /*6*/ 168, /*7*/ 176, /*8*/ 184, /*9*/ 192, /*:*/ 200, /*;*/ 208, /*<*/ 216, /*=*/ 216,
|
||||
/*>*/ 0, /*?*/ 216, /*@*/ 0, /*A*/ 224, /*B*/ 232, /*C*/ 240, /*D*/ 248, /*E*/ 256, /*F*/ 264, /*G*/ 272, /*H*/ 280, /*I*/ 288, /*J*/ 296, /*K*/ 304,
|
||||
/*L*/ 312, /*M*/ 320, /*N*/ 328, /*O*/ 336, /*P*/ 344, /*Q*/ 352, /*R*/ 360, /*S*/ 368, /*T*/ 376, /*U*/ 384, /*V*/ 392, /*W*/ 400, /*X*/ 408, /*Y*/ 416,
|
||||
/*Z*/ 424, /*[*/ 432, /*\*/ 432, /*]*/ 432, /*^*/ 432, /*_*/ 440, /*`*/ 440, /*a*/ 440, /*b*/ 448, /*c*/ 456, /*d*/ 464, /*e*/ 472, /*f*/ 480, /*g*/ 488,
|
||||
/*h*/ 496, /*i*/ 504, /*j*/ 512, /*k*/ 520, /*l*/ 528, /*m*/ 536, /*n*/ 544, /*o*/ 552, /*p*/ 560, /*q*/ 568, /*r*/ 576, /*s*/ 584, /*t*/ 592, /*u*/ 600,
|
||||
/*v*/ 608, /*w*/ 616, /*x*/ 624, /*y*/ 632, /*z*/ 640, /*{*/ 648, /*|*/ 648, /*}*/ 648, /*~*/ 648, /*:)*/ 656
|
||||
};
|
||||
|
||||
static const u8 small_font_kerning_plain[] = {
|
||||
/*!*/ 5, /*"*/ 4, /*#*/ 0, /*$*/ 0, /*%*/ 6, /*&*/ 7, /*'*/ 2, /*(*/ 4, /*)*/ 4, /***/ 0, /*+*/ 6, /*,*/ 2, /*-*/ 6, /*.*/ 2, /*/*/ 6, /*0*/ 6,
|
||||
/*1*/ 5, /*2*/ 5, /*3*/ 5, /*4*/ 5, /*5*/ 5, /*6*/ 5, /*7*/ 5, /*8*/ 5, /*9*/ 5, /*:*/ 3, /*;*/ 3, /*<*/ 0, /*=*/ 0, /*>*/ 0, /*?*/ 6, /*@*/ 0,
|
||||
/*A*/ 6, /*B*/ 6, /*C*/ 6, /*D*/ 6, /*E*/ 6, /*F*/ 6, /*G*/ 6, /*H*/ 6, /*I*/ 4, /*J*/ 6, /*K*/ 6, /*L*/ 6, /*M*/ 7, /*N*/ 7, /*O*/ 6, /*P*/ 6,
|
||||
/*Q*/ 6, /*R*/ 6, /*S*/ 6, /*T*/ 6, /*U*/ 6, /*V*/ 6, /*W*/ 7, /*X*/ 6, /*Y*/ 6, /*Z*/ 6, /*[*/ 0, /*\\*/ 0, /*]*/ 0, /*^*/ 7, /*_*/ 0, /*`*/ 0,
|
||||
/*a*/ 6, /*b*/ 6, /*c*/ 6, /*d*/ 6, /*e*/ 6, /*f*/ 6, /*g*/ 6, /*h*/ 6, /*i*/ 3, /*j*/ 4, /*k*/ 6, /*l*/ 5, /*m*/ 7, /*n*/ 6, /*o*/ 6, /*p*/ 6,
|
||||
/*q*/ 6, /*r*/ 6, /*s*/ 6, /*t*/ 6, /*u*/ 6, /*v*/ 6, /*w*/ 7, /*x*/ 6, /*y*/ 6, /*z*/ 6, /*~*/ 7,
|
||||
};
|
||||
|
||||
const u16 small_font_offsets_plain[] = {
|
||||
/*!*/ 0, /*"*/ 8, /*#*/ 16, /*$*/ 24, /*%*/ 32, /*&*/ 40, /*'*/ 48, /*(*/ 56, /*)*/ 64, /***/ 72, /*+*/ 80, /*,*/ 88, /*-*/ 96, /*.*/ 104, /*/*/ 112,
|
||||
/*0*/ 120, /*1*/ 128, /*2*/ 136, /*3*/ 144, /*4*/ 152, /*5*/ 160, /*6*/ 168, /*7*/ 176, /*8*/ 184, /*9*/ 192, /*:*/ 200, /*;*/ 208, /*<*/ 216, /*=*/ 216,
|
||||
/*>*/ 0, /*?*/ 216, /*@*/ 0, /*A*/ 224, /*B*/ 232, /*C*/ 240, /*D*/ 248, /*E*/ 256, /*F*/ 264, /*G*/ 272, /*H*/ 280, /*I*/ 288, /*J*/ 296, /*K*/ 304,
|
||||
/*L*/ 312, /*M*/ 320, /*N*/ 328, /*O*/ 336, /*P*/ 344, /*Q*/ 352, /*R*/ 360, /*S*/ 368, /*T*/ 376, /*U*/ 384, /*V*/ 392, /*W*/ 400, /*X*/ 408, /*Y*/ 416,
|
||||
/*Z*/ 424, /*[*/ 432, /*\*/ 432, /*]*/ 432, /*^*/ 432, /*_*/ 440, /*`*/ 440, /*a*/ 440, /*b*/ 448, /*c*/ 456, /*d*/ 464, /*e*/ 472, /*f*/ 480, /*g*/ 488,
|
||||
/*h*/ 496, /*i*/ 504, /*j*/ 512, /*k*/ 520, /*l*/ 528, /*m*/ 536, /*n*/ 544, /*o*/ 552, /*p*/ 560, /*q*/ 568, /*r*/ 576, /*s*/ 584, /*t*/ 592, /*u*/ 600,
|
||||
/*v*/ 608, /*w*/ 616, /*x*/ 624, /*y*/ 632, /*z*/ 640, /*{*/ 648, /*|*/ 648, /*}*/ 648, /*~*/ 648, /*:)*/ 656
|
||||
};
|
||||
|
||||
static const u8 small_font_kerning_vanilla[] = {
|
||||
/*!*/ 4, /*"*/ 4, /*#*/ 0, /*$*/ 0, /*%*/ 6, /*&*/ 7, /*'*/ 3, /*(*/ 4, /*)*/ 4, /***/ 0, /*+*/ 6, /*,*/ 2, /*-*/ 4, /*.*/ 3, /*/*/ 4, /*0*/ 5,
|
||||
/*1*/ 5, /*2*/ 6, /*3*/ 6, /*4*/ 6, /*5*/ 6, /*6*/ 6, /*7*/ 6, /*8*/ 6, /*9*/ 6, /*:*/ 4, /*;*/ 4, /*<*/ 0, /*=*/ 0, /*>*/ 0, /*?*/ 5, /*@*/ 0,
|
||||
/*A*/ 5, /*B*/ 5, /*C*/ 5, /*D*/ 5, /*E*/ 5, /*F*/ 5, /*G*/ 5, /*H*/ 5, /*I*/ 3, /*J*/ 5, /*K*/ 5, /*L*/ 5, /*M*/ 7, /*N*/ 7, /*O*/ 6, /*P*/ 5,
|
||||
/*Q*/ 6, /*R*/ 5, /*S*/ 5, /*T*/ 5, /*U*/ 5, /*V*/ 5, /*W*/ 7, /*X*/ 6, /*Y*/ 5, /*Z*/ 5, /*[*/ 0, /*\\*/ 0, /*]*/ 0, /*^*/ 7, /*_*/ 0, /*`*/ 0,
|
||||
/*a*/ 5, /*b*/ 4, /*c*/ 4, /*d*/ 4, /*e*/ 4, /*f*/ 5, /*g*/ 5, /*h*/ 4, /*i*/ 3, /*j*/ 4, /*k*/ 3, /*l*/ 2, /*m*/ 6, /*n*/ 4, /*o*/ 4, /*p*/ 4,
|
||||
/*q*/ 5, /*r*/ 4, /*s*/ 4, /*t*/ 4, /*u*/ 4, /*v*/ 4, /*w*/ 7, /*x*/ 5, /*y*/ 4, /*z*/ 5, /*~*/ 6,
|
||||
};
|
||||
|
||||
const u16 small_font_offsets_vanilla[] = {
|
||||
/*!*/ 0, /*"*/ 8, /*#*/ 16, /*$*/ 24, /*%*/ 32, /*&*/ 40, /*'*/ 48, /*(*/ 56, /*)*/ 64, /***/ 72, /*+*/ 80, /*,*/ 88, /*-*/ 96, /*.*/ 104, /*/*/ 112,
|
||||
/*0*/ 120, /*1*/ 128, /*2*/ 136, /*3*/ 144, /*4*/ 152, /*5*/ 160, /*6*/ 168, /*7*/ 176, /*8*/ 184, /*9*/ 192, /*:*/ 200, /*;*/ 208, /*<*/ 216, /*=*/ 216,
|
||||
/*>*/ 0, /*?*/ 216, /*@*/ 0, /*A*/ 224, /*B*/ 232, /*C*/ 240, /*D*/ 248, /*E*/ 256, /*F*/ 264, /*G*/ 272, /*H*/ 280, /*I*/ 288, /*J*/ 296, /*K*/ 304,
|
||||
/*L*/ 312, /*M*/ 320, /*N*/ 328, /*O*/ 336, /*P*/ 344, /*Q*/ 352, /*R*/ 360, /*S*/ 368, /*T*/ 376, /*U*/ 384, /*V*/ 392, /*W*/ 400, /*X*/ 408, /*Y*/ 416,
|
||||
/*Z*/ 424, /*[*/ 432, /*\*/ 432, /*]*/ 432, /*^*/ 432, /*_*/ 440, /*`*/ 440, /*a*/ 440, /*b*/ 448, /*c*/ 456, /*d*/ 464, /*e*/ 472, /*f*/ 480, /*g*/ 488,
|
||||
/*h*/ 496, /*i*/ 504, /*j*/ 512, /*k*/ 520, /*l*/ 528, /*m*/ 536, /*n*/ 544, /*o*/ 552, /*p*/ 560, /*q*/ 568, /*r*/ 576, /*s*/ 584, /*t*/ 592, /*u*/ 600,
|
||||
/*v*/ 608, /*w*/ 616, /*x*/ 624, /*y*/ 632, /*z*/ 640, /*{*/ 648, /*|*/ 648, /*}*/ 648, /*~*/ 648, /*:)*/ 656
|
||||
};
|
||||
|
||||
const struct PPTextFont sPPFont_default = {
|
||||
small_font_default,
|
||||
small_font_kerning_default,
|
||||
small_font_offsets_default,
|
||||
NULL,
|
||||
G_IM_FMT_I, G_IM_SIZ_4b,
|
||||
672, 12,
|
||||
8, 12
|
||||
};
|
||||
|
||||
const struct PPTextFont sPPFont_outline = {
|
||||
small_font_outline,
|
||||
small_font_kerning_outline,
|
||||
small_font_offsets_outline,
|
||||
NULL,
|
||||
G_IM_FMT_IA, G_IM_SIZ_4b,
|
||||
672, 12,
|
||||
8, 12
|
||||
};
|
||||
|
||||
const struct PPTextFont sPPFont_plain = {
|
||||
small_font_plain,
|
||||
small_font_kerning_plain,
|
||||
small_font_offsets_plain,
|
||||
NULL,
|
||||
G_IM_FMT_I, G_IM_SIZ_4b,
|
||||
672, 12,
|
||||
8, 12
|
||||
};
|
||||
|
||||
const struct PPTextFont sPPFont_vanilla = {
|
||||
small_font_vanilla,
|
||||
small_font_kerning_vanilla,
|
||||
small_font_offsets_vanilla,
|
||||
NULL,
|
||||
G_IM_FMT_I, G_IM_SIZ_4b,
|
||||
672, 12,
|
||||
8, 12
|
||||
};
|
||||
|
||||
const struct PPTextFont *const gPuppyPrintFontTable[] = {
|
||||
&sPPFont_default, &sPPFont_outline, &sPPFont_plain, &sPPFont_vanilla
|
||||
};
|
||||
|
||||
|
||||
const Texture *const puppyprint_font_lut[] = {
|
||||
small_font_default, small_font_outline, small_font_plain, small_font_vanilla
|
||||
};
|
||||
|
||||
const u8 *const puppyprint_kerning_lut[][95] = {
|
||||
small_font_kerning_default, small_font_kerning_outline, small_font_kerning_plain, small_font_kerning_vanilla
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
/**
|
||||
* Enables a custom, enhanced performance profiler. (Enables PUPPYPRINT by default in config_safeguards).
|
||||
*/
|
||||
// #define PUPPYPRINT_DEBUG 1
|
||||
// #define PUPPYPRINT_DEBUG
|
||||
|
||||
/**
|
||||
* Uses cycles instead of microseconds in Puppyprint debug output.
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
#define PUPPYPRINT
|
||||
|
||||
#undef PUPPYPRINT_DEBUG
|
||||
#define PUPPYPRINT_DEBUG 1
|
||||
#define PUPPYPRINT_DEBUG
|
||||
|
||||
#undef VISUAL_DEBUG
|
||||
#define VISUAL_DEBUG
|
||||
|
||||
@@ -51,11 +51,18 @@ DECLARE_SEGMENT(goddard)
|
||||
DECLARE_SEGMENT(framebuffers)
|
||||
DECLARE_SEGMENT(assets)
|
||||
extern u8 _goddardSegmentStart[];
|
||||
extern u8 _goddardSegmentEnd[];
|
||||
extern u8 _engineSegmentStart[];
|
||||
extern u8 _engineSegmentBssEnd[];
|
||||
extern u8 _mainSegmentStart[];
|
||||
extern u8 _mainSegmentEnd[];
|
||||
extern u8 _engineSegmentEnd[];
|
||||
extern u8 _framebuffersSegmentBssStart[];
|
||||
extern u8 _framebuffersSegmentBssEnd[];
|
||||
extern u8 _zbufferSegmentBssStart[];
|
||||
extern u8 _zbufferSegmentBssEnd[];
|
||||
extern u8 _buffersSegmentBssStart[];
|
||||
extern u8 _buffersSegmentBssEnd[];
|
||||
|
||||
DECLARE_LEVEL_SEGMENT(menu)
|
||||
DECLARE_LEVEL_SEGMENT(intro)
|
||||
|
||||
@@ -688,6 +688,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
task->yield_data_size = 0;
|
||||
|
||||
decrease_sample_dma_ttls();
|
||||
|
||||
return gAudioTask;
|
||||
}
|
||||
#endif
|
||||
@@ -2186,7 +2187,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
||||
|
||||
// Abort if the queue is already full.
|
||||
if (sBackgroundMusicQueueSize >= MAX_BACKGROUND_MUSIC_QUEUE_SIZE) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
append_puppyprint_log("Sequence queue full, aborting.");
|
||||
#endif
|
||||
return;
|
||||
|
||||
@@ -301,7 +301,7 @@ void sound_init_main_pools(s32 sizeForAudioInitPool) {
|
||||
sound_alloc_pool_init(&gAudioSessionPool, (gAudioHeap + sizeForAudioInitPool), (gAudioHeapSize - sizeForAudioInitPool));
|
||||
}
|
||||
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
void puppyprint_get_allocated_pools(s32 *audioPoolList) {
|
||||
u32 i, j;
|
||||
const struct SoundAllocPool *pools[NUM_AUDIO_POOLS] = {
|
||||
@@ -1204,7 +1204,7 @@ void audio_reset_session(void) {
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
s8 updatesPerFrame;
|
||||
#endif
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
s32 j;
|
||||
@@ -1436,7 +1436,7 @@ void audio_reset_session(void) {
|
||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||
}
|
||||
#endif
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG_CYCLES
|
||||
append_puppyprint_log("Audio Initialised in %dc.", (s32)(osGetTime() - first));
|
||||
#else
|
||||
|
||||
@@ -129,7 +129,7 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size);
|
||||
void *sound_alloc_uninitialized(struct SoundAllocPool *pool, u32 size);
|
||||
void sound_init_main_pools(s32 sizeForAudioInitPool);
|
||||
void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size);
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
void puppyprint_get_allocated_pools(s32 *audioPoolList);
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
|
||||
@@ -87,7 +87,7 @@ enum Codecs {
|
||||
#include "game/puppyprint.h"
|
||||
|
||||
#ifdef VERSION_EU
|
||||
/*#if PUPPYPRINT_DEBUG
|
||||
/*#ifdef PUPPYPRINT_DEBUG
|
||||
#define eu_stubbed_printf_0(msg) append_puppyprint_log(msg)
|
||||
#define eu_stubbed_printf_1(msg, a) append_puppyprint_log(msg, a)
|
||||
#define eu_stubbed_printf_2(msg, a, b) append_puppyprint_log(msg, a, b)
|
||||
|
||||
@@ -2682,8 +2682,10 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
// This runs 240 times per second.
|
||||
void process_sequences(UNUSED s32 iterationsRemaining) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < SEQUENCE_PLAYERS; i++) {
|
||||
if (gSequencePlayers[i].enabled == TRUE) {
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
sequence_player_process_sequence(&gSequencePlayers[i]);
|
||||
sequence_player_process_sound(&gSequencePlayers[i]);
|
||||
@@ -2693,8 +2695,13 @@ void process_sequences(UNUSED s32 iterationsRemaining) {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SEQUENCES_SCRIPT, PROFILER_TIME_SUB_AUDIO_SEQUENCES_RECLAIM);
|
||||
reclaim_notes();
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SEQUENCES_RECLAIM, PROFILER_TIME_SUB_AUDIO_SEQUENCES_PROCESSING);
|
||||
#else
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SEQUENCES_SCRIPT, PROFILER_TIME_SUB_AUDIO_SEQUENCES_PROCESSING);
|
||||
#endif
|
||||
process_notes();
|
||||
}
|
||||
|
||||
@@ -73,13 +73,11 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
#ifdef VERSION_EU
|
||||
u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s16 *aiBuf, s32 bufLen, u64 *cmd);
|
||||
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad);
|
||||
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags);
|
||||
u64 *process_envelope(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, u32 flags);
|
||||
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight);
|
||||
#else
|
||||
u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd);
|
||||
u64 *load_wave_samples(u64 *cmd, struct Note *note, s32 nSamplesToLoad);
|
||||
u64 *final_resample(u64 *cmd, struct Note *note, s32 count, u16 pitch, u16 dmemIn, u32 flags);
|
||||
u64 *process_envelope(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf, s32 headsetPanSettings,
|
||||
u32 flags);
|
||||
u64 *process_envelope_inner(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf,
|
||||
@@ -409,29 +407,6 @@ void synthesis_load_note_subs_eu(s32 updateIndex) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef VERSION_EU
|
||||
s32 get_volume_ramping(u16 sourceVol, u16 targetVol, s32 arg2) {
|
||||
// This roughly computes 2^16 * (targetVol / sourceVol) ^ (8 / arg2),
|
||||
// but with discretizations of targetVol, sourceVol and arg2.
|
||||
f32 ret;
|
||||
switch (arg2) {
|
||||
default:
|
||||
ret = gVolRampingLhs136[targetVol >> 8] * gVolRampingRhs136[sourceVol >> 8];
|
||||
break;
|
||||
case 128:
|
||||
ret = gVolRampingLhs128[targetVol >> 8] * gVolRampingRhs128[sourceVol >> 8];
|
||||
break;
|
||||
case 136:
|
||||
ret = gVolRampingLhs136[targetVol >> 8] * gVolRampingRhs136[sourceVol >> 8];
|
||||
break;
|
||||
case 144:
|
||||
ret = gVolRampingLhs144[targetVol >> 8] * gVolRampingRhs144[sourceVol >> 8];
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
// TODO: (Scrub C) pointless mask and whitespace
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
|
||||
@@ -536,11 +511,22 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
|
||||
chunkLen += 8;
|
||||
}
|
||||
}
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_UPDATE, PROFILER_TIME_SUB_AUDIO_SEQUENCES);
|
||||
AUDIO_PROFILER_START_SHARED(PROFILER_TIME_SUB_AUDIO_SEQUENCES, PROFILER_TIME_SUB_AUDIO_SEQUENCES_SCRIPT);
|
||||
|
||||
process_sequences(i - 1);
|
||||
|
||||
AUDIO_PROFILER_COMPLETE_AND_SWITCH(PROFILER_TIME_SUB_AUDIO_SEQUENCES_PROCESSING, PROFILER_TIME_SUB_AUDIO_SEQUENCES, PROFILER_TIME_SUB_AUDIO_SYNTHESIS);
|
||||
AUDIO_PROFILER_START_SHARED(PROFILER_TIME_SUB_AUDIO_SYNTHESIS, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB);
|
||||
|
||||
if (gSynthesisReverb.useReverb) {
|
||||
prepare_reverb_ring_buffer(chunkLen, gAudioUpdatesPerFrame - i);
|
||||
}
|
||||
cmd = synthesis_do_one_audio_update((s16 *) aiBufPtr, chunkLen, cmd, gAudioUpdatesPerFrame - i);
|
||||
|
||||
AUDIO_PROFILER_COMPLETE_AND_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB, PROFILER_TIME_SUB_AUDIO_SYNTHESIS, PROFILER_TIME_SUB_AUDIO_UPDATE);
|
||||
|
||||
bufLen -= chunkLen;
|
||||
aiBufPtr += chunkLen;
|
||||
}
|
||||
@@ -705,7 +691,10 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
|
||||
if (!gSynthesisReverb.useReverb) {
|
||||
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING);
|
||||
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB);
|
||||
} else {
|
||||
if (gReverbDownsampleRate == 1) {
|
||||
// Put the oldest samples in the ring buffer into the wet channels
|
||||
@@ -741,7 +730,11 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_LEFT_CH, /*out*/ DMEM_ADDR_LEFT_CH);
|
||||
aDMEMMove(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
}
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING);
|
||||
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB);
|
||||
|
||||
if (gReverbDownsampleRate == 1) {
|
||||
aSetSaveBufferPair(cmd++, 0, v1->lengthA, v1->startPos);
|
||||
if (v1->lengthB != 0) {
|
||||
@@ -1020,15 +1013,25 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
if (audioBookSample->loaded == 0x81) {
|
||||
v0_2 = sampleAddr + temp * 9;
|
||||
} else {
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_DMA);
|
||||
|
||||
v0_2 = dma_sample_data(
|
||||
(uintptr_t) (sampleAddr + temp * 9),
|
||||
t0 * 9, flags, &synthesisState->sampleDmaIndex);
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_DMA, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING);
|
||||
}
|
||||
#else
|
||||
// HACKERSM64_TODO: Is the EU thing above applicable to US? Could potentially save some resources.
|
||||
temp = (note->samplePosInt - s2 + 0x10) / 16;
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_DMA);
|
||||
|
||||
v0_2 = dma_sample_data(
|
||||
(uintptr_t) (sampleAddr + temp * 9),
|
||||
t0 * 9, flags, ¬e->sampleDmaIndex);
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_DMA, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING);
|
||||
#endif
|
||||
a3 = (u32)((uintptr_t) v0_2 & 0xf);
|
||||
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA, 0, t0 * 9 + a3);
|
||||
@@ -1197,16 +1200,18 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
noteSubEu->needsInit = FALSE;
|
||||
}
|
||||
|
||||
cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint,
|
||||
noteSamplesDmemAddrBeforeResampling, flags);
|
||||
// final resample
|
||||
aSetBuffer(cmd++, /*flags*/ 0, noteSamplesDmemAddrBeforeResampling, /*dmemout*/ DMEM_ADDR_TEMP, bufLen * 2);
|
||||
aResample(cmd++, flags, resamplingRateFixedPoint, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState));
|
||||
#else
|
||||
if (note->needsInit == TRUE) {
|
||||
flags = A_INIT;
|
||||
note->needsInit = FALSE;
|
||||
}
|
||||
|
||||
cmd = final_resample(cmd, note, bufLen * 2, resamplingRateFixedPoint,
|
||||
noteSamplesDmemAddrBeforeResampling, flags);
|
||||
// final resample
|
||||
aSetBuffer(cmd++, /*flags*/ 0, noteSamplesDmemAddrBeforeResampling, /*dmemout*/ DMEM_ADDR_TEMP, bufLen * 2);
|
||||
aResample(cmd++, flags, resamplingRateFixedPoint, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->finalResampleState));
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
@@ -1224,11 +1229,13 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
leftRight = 0;
|
||||
}
|
||||
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB);
|
||||
#ifdef VERSION_EU
|
||||
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0, leftRight, flags);
|
||||
#else
|
||||
cmd = process_envelope(cmd, note, bufLen, 0, leftRight, flags);
|
||||
#endif
|
||||
AUDIO_PROFILER_SWITCH(PROFILER_TIME_SUB_AUDIO_SYNTHESIS_ENVELOPE_REVERB, PROFILER_TIME_SUB_AUDIO_SYNTHESIS_PROCESSING);
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (noteSubEu->usesHeadsetPanEffects) {
|
||||
@@ -1293,20 +1300,6 @@ u64 *load_wave_samples(u64 *cmd, struct Note *note, s32 nSamplesToLoad) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags) {
|
||||
aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count);
|
||||
aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState));
|
||||
return cmd;
|
||||
}
|
||||
#else
|
||||
u64 *final_resample(u64 *cmd, struct Note *note, s32 count, u16 pitch, u16 dmemIn, u32 flags) {
|
||||
aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count);
|
||||
aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->finalResampleState));
|
||||
return cmd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef VERSION_EU
|
||||
u64 *process_envelope(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf, s32 headsetPanSettings,
|
||||
UNUSED u32 flags) {
|
||||
@@ -1406,8 +1399,24 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
|
||||
rampLeft = gCurrentLeftVolRamping[targetLeft >> 5] * gCurrentRightVolRamping[sourceLeft >> 5];
|
||||
rampRight = gCurrentLeftVolRamping[targetRight >> 5] * gCurrentRightVolRamping[sourceRight >> 5];
|
||||
#else
|
||||
rampLeft = get_volume_ramping(vol->sourceLeft, vol->targetLeft, nSamples);
|
||||
rampRight = get_volume_ramping(vol->sourceRight, vol->targetRight, nSamples);
|
||||
// volume ramping
|
||||
// This roughly computes 2^16 * (targetVol / sourceVol) ^ (8 / arg2),
|
||||
// but with discretizations of targetVol, sourceVol and arg2.
|
||||
switch (nSamples) {
|
||||
case 128:
|
||||
rampLeft = gVolRampingLhs128[vol->targetLeft >> 8] * gVolRampingRhs128[vol->sourceLeft >> 8];
|
||||
rampRight = gVolRampingLhs128[vol->targetRight >> 8] * gVolRampingRhs128[vol->sourceRight >> 8];
|
||||
break;
|
||||
case 144:
|
||||
rampLeft = gVolRampingLhs144[vol->targetLeft >> 8] * gVolRampingRhs144[vol->sourceLeft >> 8];
|
||||
rampRight = gVolRampingLhs144[vol->targetRight >> 8] * gVolRampingRhs144[vol->sourceRight >> 8];
|
||||
break;
|
||||
case 136:
|
||||
default:
|
||||
rampLeft = gVolRampingLhs136[vol->targetLeft >> 8] * gVolRampingRhs136[vol->sourceLeft >> 8];
|
||||
rampRight = gVolRampingLhs136[vol->targetRight >> 8] * gVolRampingRhs136[vol->sourceRight >> 8];
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// The operation's parameters change meanings depending on flags
|
||||
|
||||
@@ -129,7 +129,7 @@ void main_pool_init(void *start, void *end) {
|
||||
sPoolListHeadL->next = NULL;
|
||||
sPoolListHeadR->prev = NULL;
|
||||
sPoolListHeadR->next = NULL;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
mempool = sPoolFreeSpace;
|
||||
#endif
|
||||
}
|
||||
@@ -334,8 +334,9 @@ void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side, u8 *bssStart
|
||||
set_segment_base_addr(segment, addr);
|
||||
}
|
||||
}
|
||||
#if PUPPYPRINT_DEBUG
|
||||
ramsizeSegment[(segment + nameTable) - 2] = ((s32)srcEnd - (s32)srcStart);
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
u32 ppSize = ALIGN16(srcEnd - srcStart) + 16;
|
||||
set_segment_memory_printout(segment, ppSize);
|
||||
#endif
|
||||
return addr;
|
||||
}
|
||||
@@ -411,8 +412,9 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
main_pool_free(compressed);
|
||||
}
|
||||
}
|
||||
#if PUPPYPRINT_DEBUG
|
||||
ramsizeSegment[(segment + nameTable) - 2] = (s32)srcEnd - (s32)srcStart;
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
u32 ppSize = ALIGN16((u32)*size) + 16;
|
||||
set_segment_memory_printout(segment, ppSize);
|
||||
#endif
|
||||
return dest;
|
||||
}
|
||||
@@ -543,6 +545,9 @@ struct MemoryPool *mem_pool_init(u32 size, u32 side) {
|
||||
block->next = NULL;
|
||||
block->size = pool->totalSpace;
|
||||
}
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
gPoolMem += ALIGN16(size) + 16;
|
||||
#endif
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
#include "game/game_init.h"
|
||||
#include "game/main.h"
|
||||
#include "config.h"
|
||||
#include "audio/data.h"
|
||||
|
||||
extern u8 gDecompressionHeap[];
|
||||
|
||||
extern u8 gAudioHeap[];
|
||||
extern u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE)];
|
||||
|
||||
extern u8 gIdleThreadStack[THREAD1_STACK];
|
||||
extern u8 gThread3Stack[THREAD3_STACK];
|
||||
|
||||
@@ -347,6 +347,9 @@ void unmap_tlbs(void) {
|
||||
osUnmapTLB(gTlbEntries);
|
||||
gTlbSegments[i]--;
|
||||
gTlbEntries--;
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
set_segment_memory_printout(i, 0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
gTlbEntries -= gTlbSegments[i];
|
||||
@@ -823,7 +826,7 @@ static void level_cmd_puppyvolume(void) {
|
||||
if ((sPuppyVolumeStack[gPuppyVolumeCount] = mem_pool_alloc(gPuppyMemoryPool, sizeof(struct sPuppyVolume))) == NULL) {
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
gPuppyError |= PUPPY_ERROR_POOL_FULL;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
append_puppyprint_log("Puppycamera volume allocation failed.");
|
||||
#endif
|
||||
return;
|
||||
@@ -873,7 +876,7 @@ static void level_cmd_puppylight_node(void) {
|
||||
#ifdef PUPPYLIGHTS
|
||||
gPuppyLights[gNumLights] = mem_pool_alloc(gLightsPool, sizeof(struct PuppyLight));
|
||||
if (gPuppyLights[gNumLights] == NULL) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
append_puppyprint_log("Puppylight allocation failed.");
|
||||
#endif
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
|
||||
@@ -322,6 +322,7 @@ void mtxf_copy(register Mat4 dest, register Mat4 src) {
|
||||
|
||||
/// Set mtx to the identity matrix.
|
||||
void mtxf_identity(register Mat4 mtx) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
s32 i;
|
||||
f32 *dest;
|
||||
for (dest = ((f32 *) mtx + 1), i = 0; i < 14; dest++, i++) {
|
||||
@@ -334,6 +335,7 @@ void mtxf_identity(register Mat4 mtx) {
|
||||
|
||||
/// Set dest to a translation matrix of vector b.
|
||||
void mtxf_translate(Mat4 dest, Vec3f b) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register s32 i;
|
||||
register f32 *pen;
|
||||
for (pen = ((f32 *) dest + 1), i = 0; i < 12; pen++, i++) {
|
||||
@@ -354,6 +356,7 @@ void mtxf_translate(Mat4 dest, Vec3f b) {
|
||||
* i.e. a matrix representing a linear transformation over 3 space.
|
||||
*/
|
||||
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
s32 i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
dst[i] = ((m[0][i] * v[0])
|
||||
@@ -363,6 +366,7 @@ void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
|
||||
}
|
||||
|
||||
void linear_mtxf_mul_vec3f_and_translate(Mat4 m, Vec3f dst, Vec3f v) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
s32 i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
dst[i] = ((m[0][i] * v[0])
|
||||
@@ -381,6 +385,7 @@ void linear_mtxf_mul_vec3f_and_translate(Mat4 m, Vec3f dst, Vec3f v) {
|
||||
* i.e. a matrix representing a linear transformation over 3 space.
|
||||
*/
|
||||
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
s32 i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
dst[i] = vec3_dot(m[i], v);
|
||||
@@ -389,6 +394,7 @@ void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
|
||||
|
||||
/// Build a matrix that rotates around the z axis, then the x axis, then the y axis, and then translates.
|
||||
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f trans, Vec3s rot) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register f32 sx = sins(rot[0]);
|
||||
register f32 cx = coss(rot[0]);
|
||||
register f32 sy = sins(rot[1]);
|
||||
@@ -414,6 +420,7 @@ void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f trans, Vec3s rot) {
|
||||
|
||||
/// Build a matrix that rotates around the x axis, then the y axis, then the z axis, and then translates.
|
||||
UNUSED void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f trans, Vec3s rot) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register f32 sx = sins(rot[0]);
|
||||
register f32 cx = coss(rot[0]);
|
||||
register f32 sy = sins(rot[1]);
|
||||
@@ -439,6 +446,7 @@ UNUSED void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f trans, Vec3s rot) {
|
||||
|
||||
/// Build a matrix that rotates around the z axis, then the x axis, then the y axis, and then translates and multiplies.
|
||||
void mtxf_rotate_zxy_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Mat4 src) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register f32 sx = sins(rot[0]);
|
||||
register f32 cx = coss(rot[0]);
|
||||
register f32 sy = sins(rot[1]);
|
||||
@@ -469,6 +477,7 @@ void mtxf_rotate_zxy_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Ma
|
||||
|
||||
/// Build a matrix that rotates around the x axis, then the y axis, then the z axis, and then translates and multiplies.
|
||||
void mtxf_rotate_xyz_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Mat4 src) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register f32 sx = sins(rot[0]);
|
||||
register f32 cx = coss(rot[0]);
|
||||
register f32 sy = sins(rot[1]);
|
||||
@@ -504,6 +513,7 @@ void mtxf_rotate_xyz_and_translate_and_mul(Vec3s rot, Vec3f trans, Mat4 dest, Ma
|
||||
* angle allows a bank rotation of the camera.
|
||||
*/
|
||||
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
Vec3f colX, colY, colZ;
|
||||
register f32 dx = (to[0] - from[0]);
|
||||
register f32 dz = (to[2] - from[2]);
|
||||
@@ -544,6 +554,7 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
|
||||
* 'angle' rotates the object while still facing the camera.
|
||||
*/
|
||||
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s16 angle) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register s32 i;
|
||||
register f32 sx = scale[0];
|
||||
register f32 sy = scale[1];
|
||||
@@ -591,6 +602,7 @@ void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, Vec3f scale, s16 angle)
|
||||
* 'yaw' is the angle which it should face
|
||||
*/
|
||||
void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s16 yaw) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
Vec3f lateralDir;
|
||||
Vec3f leftDir;
|
||||
Vec3f forwardDir;
|
||||
@@ -616,6 +628,7 @@ void mtxf_shadow(Mat4 dest, Vec3f upDir, Vec3f pos, Vec3f scale, s16 yaw) {
|
||||
* 'pos' is the object's position in the world
|
||||
*/
|
||||
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
Vec3f lateralDir;
|
||||
Vec3f leftDir;
|
||||
Vec3f forwardDir;
|
||||
@@ -641,6 +654,7 @@ void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
|
||||
* 'radius' is the distance from each triangle vertex to the center
|
||||
*/
|
||||
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
struct Surface *floor;
|
||||
Vec3f point0, point1, point2;
|
||||
Vec3f forward;
|
||||
@@ -691,6 +705,7 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
|
||||
* then a.
|
||||
*/
|
||||
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
Vec3f entry;
|
||||
register f32 *temp = (f32 *)a;
|
||||
register f32 *temp2 = (f32 *)dest;
|
||||
@@ -717,6 +732,7 @@ void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b) {
|
||||
* Set matrix 'dest' to 'mtx' scaled by vector s
|
||||
*/
|
||||
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, register Vec3f s) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register f32 *temp = (f32 *)dest;
|
||||
register f32 *temp2 = (f32 *)mtx;
|
||||
register s32 i;
|
||||
@@ -737,6 +753,7 @@ void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, register Vec3f s) {
|
||||
* true for transformation matrices if the translation has a w component of 1.
|
||||
*/
|
||||
UNUSED void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register f32 x = b[0];
|
||||
register f32 y = b[1];
|
||||
register f32 z = b[2];
|
||||
@@ -760,6 +777,7 @@ UNUSED void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
|
||||
((s16 *) mtx)[a ] = (((s32) b) >> 16); \
|
||||
((s16 *) mtx)[a + 16] = (((s32) b) & 0xFFFF);
|
||||
void mtxf_rotate_xy(Mtx *mtx, s16 angle) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
register s32 i = (coss(angle) * 0x10000);
|
||||
register s32 j = (sins(angle) * 0x10000);
|
||||
register f32 *temp = (f32 *)mtx;
|
||||
@@ -1264,7 +1282,7 @@ s32 anim_spline_poll(Vec3f result) {
|
||||
|
||||
/**
|
||||
* @brief Checks if a ray intersects a surface using Möller–Trumbore intersection algorithm.
|
||||
*
|
||||
*
|
||||
* @param orig is the starting point of the ray.
|
||||
* @param dir is the normalized ray direction.
|
||||
* @param dir_length is the length of the ray.
|
||||
@@ -1312,7 +1330,7 @@ s32 ray_surface_intersect(Vec3f orig, Vec3f dir, f32 dir_length, struct Surface
|
||||
f32 u = f * vec3f_dot(s, h);
|
||||
// Check if 'u' is within bounds.
|
||||
if ((u < 0.0f) || (u > 1.0f)) return FALSE;
|
||||
// Make 'q' the cross product of 's' and edge 1.
|
||||
// Make 'q' the cross product of 's' and edge 1.
|
||||
Vec3f q;
|
||||
vec3f_cross(q, s, e1);
|
||||
// Make 'v' the cos(angle) between the ray and 'q', divided by 'det'.
|
||||
@@ -1338,6 +1356,7 @@ void find_surface_on_ray_list(struct SurfaceNode *list, Vec3f orig, Vec3f dir, f
|
||||
f32 length;
|
||||
Vec3f chk_hit_pos;
|
||||
f32 top, bottom;
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
// Get upper and lower bounds of ray
|
||||
if (dir[1] >= 0.0f) {
|
||||
// Ray is upwards.
|
||||
@@ -1361,6 +1380,7 @@ void find_surface_on_ray_list(struct SurfaceNode *list, Vec3f orig, Vec3f dir, f
|
||||
*max_length = length;
|
||||
}
|
||||
}
|
||||
profiler_collision_update(first);
|
||||
}
|
||||
|
||||
void find_surface_on_ray_cell(s32 cellX, s32 cellZ, Vec3f orig, Vec3f normalized_dir, f32 dir_length, struct Surface **hit_surface, Vec3f hit_pos, f32 *max_length, s32 flags) {
|
||||
@@ -1391,6 +1411,7 @@ void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Ve
|
||||
f32 step;
|
||||
s32 i;
|
||||
const f32 invcell = 1.0f / CELL_SIZE;
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_raycast);
|
||||
|
||||
// Set that no surface has been hit
|
||||
*hit_surface = NULL;
|
||||
@@ -1488,6 +1509,7 @@ static ALWAYS_INLINE float construct_float(const float f)
|
||||
// Converts a floating point matrix to a fixed point matrix
|
||||
// Makes some assumptions about certain fields in the matrix, which will always be true for valid matrices.
|
||||
OPTIMIZE_OS void mtxf_to_mtx_fast(s16* dst, float* src) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.matrix);
|
||||
float scale = construct_float(65536.0f / WORLD_SCALE);
|
||||
// Iterate over pairs of values in the input matrix
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
||||
@@ -205,10 +205,13 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
|
||||
s32 numCollisions = 0;
|
||||
s32 x = colData->x;
|
||||
s32 z = colData->z;
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_wall);
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
|
||||
colData->numWalls = 0;
|
||||
|
||||
if (is_outside_level_bounds(x, z)) {
|
||||
profiler_collision_update(first);
|
||||
return numCollisions;
|
||||
}
|
||||
|
||||
@@ -232,6 +235,7 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
|
||||
gNumCalls.wall++;
|
||||
#endif
|
||||
|
||||
profiler_collision_update(first);
|
||||
return numCollisions;
|
||||
}
|
||||
|
||||
@@ -347,12 +351,15 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
f32 height = CELL_HEIGHT_LIMIT;
|
||||
f32 dynamicHeight = CELL_HEIGHT_LIMIT;
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_ceil);
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
s32 x = posX;
|
||||
s32 y = posY;
|
||||
s32 z = posZ;
|
||||
*pceil = NULL;
|
||||
|
||||
if (is_outside_level_bounds(x, z)) {
|
||||
profiler_collision_update(first);
|
||||
return height;
|
||||
}
|
||||
|
||||
@@ -395,6 +402,7 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
gNumCalls.ceil++;
|
||||
#endif
|
||||
|
||||
profiler_collision_update(first);
|
||||
return height;
|
||||
}
|
||||
|
||||
@@ -575,6 +583,9 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
|
||||
* Find the highest floor under a given position and return the height.
|
||||
*/
|
||||
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_floor);
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
|
||||
f32 height = FLOOR_LOWER_LIMIT;
|
||||
f32 dynamicHeight = FLOOR_LOWER_LIMIT;
|
||||
|
||||
@@ -588,6 +599,7 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
*pfloor = NULL;
|
||||
|
||||
if (is_outside_level_bounds(x, z)) {
|
||||
profiler_collision_update(first);
|
||||
return height;
|
||||
}
|
||||
// Each level is split into cells to limit load, find the appropriate cell.
|
||||
@@ -632,6 +644,8 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
// Increment the debug tracker.
|
||||
gNumCalls.floor++;
|
||||
#endif
|
||||
|
||||
profiler_collision_update(first);
|
||||
return height;
|
||||
}
|
||||
|
||||
@@ -698,6 +712,8 @@ s32 find_water_level_and_floor(s32 x, s32 y, s32 z, struct Surface **pfloor) {
|
||||
s32 loX, hiX, loZ, hiZ;
|
||||
TerrainData *p = gEnvironmentRegions;
|
||||
struct Surface *floor = NULL;
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_water);
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
s32 waterLevel = find_water_floor(x, y, z, &floor);
|
||||
|
||||
if (p != NULL && waterLevel == FLOOR_LOWER_LIMIT) {
|
||||
@@ -723,6 +739,7 @@ s32 find_water_level_and_floor(s32 x, s32 y, s32 z, struct Surface **pfloor) {
|
||||
*pfloor = floor;
|
||||
}
|
||||
|
||||
profiler_collision_update(first);
|
||||
return waterLevel;
|
||||
}
|
||||
|
||||
@@ -734,6 +751,8 @@ s32 find_water_level(s32 x, s32 z) { // TODO: Allow y pos
|
||||
s32 loX, hiX, loZ, hiZ;
|
||||
TerrainData *p = gEnvironmentRegions;
|
||||
struct Surface *floor = NULL;
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_water);
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
s32 waterLevel = find_water_floor(x, ((gCollisionFlags & COLLISION_FLAG_CAMERA) ? gLakituState.pos[1] : gMarioState->pos[1]), z, &floor);
|
||||
|
||||
if ((p != NULL) && (waterLevel == FLOOR_LOWER_LIMIT)) {
|
||||
@@ -757,6 +776,8 @@ s32 find_water_level(s32 x, s32 z) { // TODO: Allow y pos
|
||||
}
|
||||
}
|
||||
|
||||
profiler_collision_update(first);
|
||||
|
||||
return waterLevel;
|
||||
}
|
||||
|
||||
@@ -768,6 +789,8 @@ s32 find_poison_gas_level(s32 x, s32 z) {
|
||||
s32 loX, hiX, loZ, hiZ;
|
||||
s32 gasLevel = FLOOR_LOWER_LIMIT;
|
||||
TerrainData *p = gEnvironmentRegions;
|
||||
PUPPYPRINT_ADD_COUNTER(gPuppyCallCounter.collision_water);
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
|
||||
if (p != NULL) {
|
||||
s32 numRegions = *p++;
|
||||
@@ -793,7 +816,8 @@ s32 find_poison_gas_level(s32 x, s32 z) {
|
||||
p += 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
profiler_collision_update(first);
|
||||
return gasLevel;
|
||||
}
|
||||
|
||||
|
||||
@@ -498,6 +498,7 @@ u32 get_area_terrain_size(TerrainData *data) {
|
||||
* boxes (water, gas, JRB fog).
|
||||
*/
|
||||
void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, s16 *macroObjects) {
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
s32 terrainLoadType;
|
||||
TerrainData *vertexData = NULL;
|
||||
u32 surfacePoolData;
|
||||
@@ -558,12 +559,14 @@ void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, s16
|
||||
|
||||
gNumStaticSurfaceNodes = gSurfaceNodesAllocated;
|
||||
gNumStaticSurfaces = gSurfacesAllocated;
|
||||
profiler_collision_update(first);
|
||||
}
|
||||
|
||||
/**
|
||||
* If not in time stop, clear the surface partitions.
|
||||
*/
|
||||
void clear_dynamic_surfaces(void) {
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
if (!(gTimeStopState & TIME_STOP_ACTIVE)) {
|
||||
gSurfacesAllocated = gNumStaticSurfaces;
|
||||
gSurfaceNodesAllocated = gNumStaticSurfaceNodes;
|
||||
@@ -578,6 +581,7 @@ void clear_dynamic_surfaces(void) {
|
||||
sNumCellsUsed = 0;
|
||||
sClearAllCells = FALSE;
|
||||
}
|
||||
profiler_collision_update(first);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -691,6 +695,7 @@ static TerrainData sVertexData[600];
|
||||
* Transform an object's vertices, reload them, and render the object.
|
||||
*/
|
||||
void load_object_collision_model(void) {
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
TerrainData *collisionData = o->collisionData;
|
||||
f32 marioDist = o->oDistanceToMario;
|
||||
|
||||
@@ -727,12 +732,14 @@ void load_object_collision_model(void) {
|
||||
}
|
||||
}
|
||||
COND_BIT((marioDist < o->oDrawingDistance), o->header.gfx.node.flags, GRAPH_RENDER_ACTIVE);
|
||||
profiler_collision_update(first);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform an object's vertices and add them to the static surface pool.
|
||||
*/
|
||||
void load_object_static_model(void) {
|
||||
PUPPYPRINT_GET_SNAPSHOT();
|
||||
TerrainData *collisionData = o->collisionData;
|
||||
u32 surfacePoolData;
|
||||
|
||||
@@ -756,4 +763,5 @@ void load_object_static_model(void) {
|
||||
|
||||
gNumStaticSurfaceNodes = gSurfaceNodesAllocated;
|
||||
gNumStaticSurfaces = gSurfacesAllocated;
|
||||
profiler_collision_update(first);
|
||||
}
|
||||
|
||||
@@ -376,10 +376,14 @@ void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 b
|
||||
}
|
||||
|
||||
void render_game(void) {
|
||||
PROFILER_GET_SNAPSHOT_TYPE(PROFILER_DELTA_COLLISION);
|
||||
if (gCurrentArea != NULL && !gWarpTransition.pauseRendering) {
|
||||
if (gCurrentArea->graphNode) {
|
||||
geo_process_root(gCurrentArea->graphNode, gViewportOverride, gViewportClip, gFBSetColor);
|
||||
}
|
||||
#ifdef PUPPYPRINT
|
||||
bzero(gCurrEnvCol, sizeof(ColorRGBA));
|
||||
#endif
|
||||
|
||||
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gViewport));
|
||||
|
||||
@@ -389,6 +393,9 @@ void render_game(void) {
|
||||
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
render_text_labels();
|
||||
#ifdef PUPPYPRINT
|
||||
puppyprint_print_deferred();
|
||||
#endif
|
||||
do_cutscene_handler();
|
||||
print_displaying_credits_entry();
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, gBorderHeight, SCREEN_WIDTH,
|
||||
@@ -422,6 +429,9 @@ void render_game(void) {
|
||||
}
|
||||
} else {
|
||||
render_text_labels();
|
||||
#ifdef PUPPYPRINT
|
||||
puppyprint_print_deferred();
|
||||
#endif
|
||||
if (gViewportClip != NULL) {
|
||||
clear_viewport(gViewportClip, gWarpTransFBSetColor);
|
||||
} else {
|
||||
@@ -431,11 +441,10 @@ void render_game(void) {
|
||||
|
||||
gViewportOverride = NULL;
|
||||
gViewportClip = NULL;
|
||||
|
||||
profiler_update(PROFILER_TIME_GFX);
|
||||
profiler_print_times();
|
||||
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(PROFILER_TIME_GFX, profiler_get_delta(PROFILER_DELTA_COLLISION) - first);
|
||||
profiler_print_times();
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
puppyprint_render_profiler();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "level_table.h"
|
||||
#include "config.h"
|
||||
#include "puppyprint.h"
|
||||
#include "profiling.h"
|
||||
|
||||
#define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
|
||||
|
||||
@@ -2865,12 +2866,12 @@ void update_lakitu(struct Camera *c) {
|
||||
gLakituState.defMode = c->defMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main camera update function.
|
||||
* Gets controller input, checks for cutscenes, handles mode changes, and moves the camera
|
||||
*/
|
||||
void update_camera(struct Camera *c) {
|
||||
PROFILER_GET_SNAPSHOT_TYPE(PROFILER_DELTA_COLLISION);
|
||||
gCamera = c;
|
||||
update_camera_hud_status(c);
|
||||
if (c->cutscene == CUTSCENE_NONE
|
||||
@@ -3113,6 +3114,7 @@ void update_camera(struct Camera *c) {
|
||||
}
|
||||
#endif
|
||||
gLakituState.lastFrameAction = sMarioCamState->action;
|
||||
profiler_update(PROFILER_TIME_CAMERA, profiler_get_delta(PROFILER_DELTA_COLLISION) - first);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
enum crashPages {
|
||||
PAGE_CONTEXT,
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
PAGE_LOG,
|
||||
#endif
|
||||
PAGE_STACKTRACE,
|
||||
@@ -233,7 +233,7 @@ void draw_crash_context(OSThread *thread, s32 cause) {
|
||||
}
|
||||
|
||||
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
void draw_crash_log(void) {
|
||||
s32 i;
|
||||
crash_screen_draw_rect(25, 20, 270, 210);
|
||||
@@ -361,7 +361,7 @@ void draw_crash_screen(OSThread *thread) {
|
||||
crash_screen_print(30, 10, "Page:%02d L/Z: Left R: Right", crashPage);
|
||||
switch (crashPage) {
|
||||
case PAGE_CONTEXT: draw_crash_context(thread, cause); break;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
case PAGE_LOG: draw_crash_log(); break;
|
||||
#endif
|
||||
case PAGE_STACKTRACE: draw_stacktrace(thread, cause); break;
|
||||
|
||||
@@ -38,7 +38,7 @@ int computeS(unsigned char letter) {
|
||||
static const u8 fast_text_font_kerning[] = {
|
||||
/* */ 2, /*!*/ 4, /*"*/ 5, /*#*/ 0, /*$*/ 0, /*%*/ 7, /*&*/ 7, /*'*/ 2, /*(*/ 5, /*)*/ 5, /***/ 0, /*+*/ 7, /*,*/ 3, /*-*/ 7, /*.*/ 3, /*/*/ 7,
|
||||
/*0*/ 7, /*1*/ 7, /*2*/ 7, /*3*/ 7, /*4*/ 7, /*5*/ 7, /*6*/ 7, /*7*/ 7, /*8*/ 7, /*9*/ 7, /*:*/ 3, /*;*/ 3, /*<*/ 0, /*=*/ 0, /*>*/ 0, /*?*/ 7,
|
||||
/*@*/ 0, /*A*/ 7, /*B*/ 7, /*C*/ 7, /*D*/ 7, /*E*/ 7, /*F*/ 7, /*G*/ 7, /*H*/ 7, /*I*/ 6, /*J*/ 5, /*K*/ 7, /*L*/ 7, /*M*/ 7, /*N*/ 7, /*O*/ 7,
|
||||
/*@*/ 0, /*A*/ 7, /*B*/ 7, /*C*/ 7, /*D*/ 7, /*E*/ 7, /*F*/ 7, /*G*/ 7, /*H*/ 7, /*I*/ 6, /*J*/ 7, /*K*/ 7, /*L*/ 7, /*M*/ 7, /*N*/ 7, /*O*/ 7,
|
||||
/*P*/ 7, /*Q*/ 7, /*R*/ 7, /*S*/ 7, /*T*/ 7, /*U*/ 7, /*V*/ 7, /*W*/ 7, /*X*/ 7, /*Y*/ 7, /*Z*/ 7, /*[*/ 0, /*\*/ 0, /*]*/ 0, /*^*/ 6, /*_*/ 0,
|
||||
/*`*/ 0, /*a*/ 6, /*b*/ 6, /*c*/ 6, /*d*/ 6, /*e*/ 6, /*f*/ 6, /*g*/ 6, /*h*/ 6, /*i*/ 2, /*j*/ 6, /*k*/ 5, /*l*/ 3, /*m*/ 6, /*n*/ 6, /*o*/ 6,
|
||||
/*p*/ 6, /*q*/ 6, /*r*/ 6, /*s*/ 6, /*t*/ 6, /*u*/ 6, /*v*/ 6, /*w*/ 6, /*x*/ 6, /*y*/ 6, /*z*/ 6, /*{*/ 0, /*|*/ 0, /*}*/ 0, /*~*/ 7,
|
||||
@@ -58,6 +58,7 @@ void drawSmallString_impl(Gfx **dl, int x, int y, const char* string, int r, int
|
||||
|
||||
while (string[i] != '\0') {
|
||||
unsigned int cur_char = string[i];
|
||||
s32 goddamnJMeasure = string[i] == 'j' ? -1 : 0;
|
||||
|
||||
if (cur_char == '\n') {
|
||||
xPos = x;
|
||||
@@ -73,7 +74,7 @@ void drawSmallString_impl(Gfx **dl, int x, int y, const char* string, int r, int
|
||||
} else {
|
||||
if (cur_char != ' ') {
|
||||
s = computeS(cur_char);
|
||||
gSPTextureRectangle(dlHead++, (xPos + 0) << 2, (yPos + 0) << 2, (xPos + 8) << 2, (yPos + 12) << 2, 0, s << 5, 0, 1 << 10, 1 << 10);
|
||||
gSPTextureRectangle(dlHead++, (xPos + 0) << 2, (yPos + 0) << 2, (xPos + 8) << 2, (yPos + 12) << 2, 0, (s << 5) - goddamnJMeasure, 0, 1 << 10, 1 << 10);
|
||||
}
|
||||
xPos += fast_text_font_kerning[cur_char - ' '];
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user