Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions framework/files/runtime/include/gpu_ws_hud_scale.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ static inline int32_t psx_ws_hud_thirds_centre(int32_t x, int32_t w, int32_t str
return w == strip && 3 * centre > 4 * screen_w && 3 * x <= 2 * screen_w ? screen_w : centre;
}

/* The column a held weapon's sprite [x, x + w) is squashed about. In the middle third of the screen that is the
* screen's centre, as for any sprite there. In an outer third it slides toward that edge and is on it when the sprite
* touches it: a picture the screen crops stays cropped by the screen, and nothing jumps as the sprite crosses a third.
* A sprite too wide to slide inside an outer third, one over five twelfths of the screen, slides from the centre on. */
static inline int32_t psx_ws_hud_held_pivot(int32_t x, int32_t w, int32_t screen_w) {
int64_t centre, start, reach, gone;
int mirrored;
if (w <= 0 || screen_w <= 0 || w >= screen_w) return screen_w / 2;
centre = 2 * (int64_t)x + w;
mirrored = centre < screen_w;
if (mirrored) centre = 2 * (int64_t)screen_w - centre;
start = 12 * (int64_t)w <= 5 * (int64_t)screen_w ? 4 * (int64_t)screen_w : 3 * (int64_t)screen_w; /* in sixths of a pixel */
gone = 3 * centre - start;
if (gone <= 0) return screen_w / 2;
reach = 3 * (2 * (int64_t)screen_w - w) - start;
if (gone > reach) gone = reach;
centre = ((int64_t)screen_w * (reach + gone) + reach) / (2 * reach);
return (int32_t)(mirrored ? screen_w - centre : centre);
}

/* Shrinks a screen-space widget toward the edge or corner of the screen it
* sits at: thirds of the width and of the height pick the pivot, as the stock
* horizontal squash does. A counter whose pieces all centre in one third keeps
Expand Down
16 changes: 10 additions & 6 deletions framework/patches/runtime/include/gpu.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/runtime/include/gpu.h b/runtime/include/gpu.h
index 11b29fe121b12ffe7b453fde551c274d99425a1e..fad42ec530bb44fb305f34317c46958e1d126ace 100644
index 11b29fe121b12ffe7b453fde551c274d99425a1e..a90850743edafc6c5e0e66809b6a03cc8e1dc44e 100644
--- a/runtime/include/gpu.h
+++ b/runtime/include/gpu.h
@@ -1,4 +1,4 @@
Expand Down Expand Up @@ -144,7 +144,7 @@ index 11b29fe121b12ffe7b453fde551c274d99425a1e..fad42ec530bb44fb305f34317c46958e
/* Widescreen proportion correction (active only when aspect != 4:3 and the
* game's [widescreen] block opts in — see config_loader.h). Tagged
* character/billboard prims are re-squashed around their projected anchor;
@@ -126,6 +255,39 @@
@@ -126,6 +255,43 @@
* (render the wider FOV into a wider frame, present 1:1; GTE not squashed). */
void gpu_ws_configure(int aspect_num, int aspect_den,
uint32_t sprite_anchor_addr, int hud_sprt_squash, int mode);
Expand Down Expand Up @@ -181,10 +181,14 @@ index 11b29fe121b12ffe7b453fde551c274d99425a1e..fad42ec530bb44fb305f34317c46958e
+void gpu_ws_set_hud_widgets(uint32_t table_pointer, int layers, const int32_t *boxes, int count);
+/* A game whose text printer draws a line as one picture `wide` across, the words from its left end. */
+void gpu_ws_set_hud_text_strip(int wide);
+/* The texture page, by its two indices, on which a game keeps the picture of the weapon in the player's hands. A sprite
+ * of that page in a HUD layer is the weapon: it keeps its size whatever the HUD size, and all of it in one list is
+ * squashed about one column, psx_ws_hud_held_pivot of its first sprite. A negative index names none. */
+void gpu_ws_set_hud_held_page(int page_x, int page_y);
/* [widescreen] full_2d: opt a pure-2D sprite game into the widescreen present
* path (treat every in-game frame as gameplay, since it never tags 3D prims). */
void gpu_ws_set_full_2d(int on);
@@ -186,6 +348,13 @@
@@ -186,6 +352,13 @@
* full-2D menu/title screen), so the squash is suppressed and content drawn
* pixel-native. The present path uses the same predicate to pillarbox. */
int gpu_ws_present_native_43(void);
Expand All @@ -198,7 +202,7 @@ index 11b29fe121b12ffe7b453fde551c274d99425a1e..fad42ec530bb44fb305f34317c46958e
/* Per-side X cull-margin (screen/world units) emitted into the game's draw-
* cull immediates by the recompiler ([widescreen.cull]); 0 unless stretching. */
int psx_ws_x_margin(void);
@@ -240,6 +409,8 @@
@@ -240,6 +413,8 @@
int psx_ws_cull_keep_site(uint32_t pc, uint32_t instr, uint32_t vanilla,
uint32_t *out);
uint32_t psx_ws_angle_widen(uint32_t vanilla);
Expand All @@ -207,7 +211,7 @@ index 11b29fe121b12ffe7b453fde551c274d99425a1e..fad42ec530bb44fb305f34317c46958e
int psx_ws_angle_site(uint32_t pc, uint32_t instr, uint32_t *out);
uint32_t psx_ws_aspect_cone_result(uint32_t site, uint32_t vanilla,
uint32_t object, int32_t x, int32_t z,
@@ -263,6 +434,9 @@
@@ -263,6 +438,9 @@
* widen for the paired `bltz maxSX` reject. Identity at 4:3. */
int psx_ws_cull_slti(uint32_t sx, uint32_t imm);
int psx_ws_cull_slti_lower(uint32_t sx, uint32_t imm);
Expand All @@ -217,7 +221,7 @@ index 11b29fe121b12ffe7b453fde551c274d99425a1e..fad42ec530bb44fb305f34317c46958e
int psx_ws_cull_bltz(uint32_t v);
int psx_ws_cull_vxrange(uint32_t x, uint32_t imm);
/* True if a run of instruction words carries the screen-extent reject signature
@@ -318,6 +492,10 @@
@@ -318,6 +496,10 @@
* final screenX store to squash it around the screen centre (identity at 4:3).
* Pulls far backdrop pieces in from past the 320px edge to cover the 16:9 FOV. */
int psx_ws_backdrop_x(int x);
Expand Down
Loading
Loading