Xbox: try to increase deadzone, and fix sprites always being drawn solidly

This commit is contained in:
UnknownShadow200 2025-08-15 17:57:57 +10:00
parent ef1decc6ad
commit 725b5d5973
3 changed files with 15 additions and 7 deletions

View File

@ -21,10 +21,8 @@ jobs:
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78DBA3BC47EF2265
apt-get update
apt-get -y install curl
apt-get --allow-unauthenticated update
apt-get --allow-unauthenticated -y install curl
- name: Compile Saturn build
id: compile

View File

@ -5,6 +5,8 @@
#include <pbkit/pbkit.h>
#define _NV_ALPHAKILL_EN (1 << 4)
#define MAX_RAM_ADDR 0x03FFAFFF
#define MASK(mask, val) (((val) << (__builtin_ffs(mask)-1)) & (mask))
@ -267,7 +269,8 @@ void Gfx_BindTexture(GfxResourceID texId) {
MASK(NV097_SET_TEXTURE_FORMAT_BASE_SIZE_V, log_v) |
MASK(NV097_SET_TEXTURE_FORMAT_BASE_SIZE_P, 0)); // log2(1) slice = 0
p = pb_push1(p, NV097_SET_TEXTURE_CONTROL0,
NV097_SET_TEXTURE_CONTROL0_ENABLE |
NV097_SET_TEXTURE_CONTROL0_ENABLE |
(gfx_alphaTest ? _NV_ALPHAKILL_EN : 0) |
MASK(NV097_SET_TEXTURE_CONTROL0_MIN_LOD_CLAMP, 0) |
MASK(NV097_SET_TEXTURE_CONTROL0_MAX_LOD_CLAMP, 1));
p = pb_push1(p, NV097_SET_TEXTURE_ADDRESS,
@ -309,6 +312,13 @@ static void SetAlphaBlend(cc_bool enabled) {
static void SetAlphaTest(cc_bool enabled) {
uint32_t* p = pb_begin();
p = pb_push1(p, NV097_SET_ALPHA_TEST_ENABLE, enabled);
// TODO not duplicate with Gfx_BindTexture
p = pb_push1(p, NV097_SET_TEXTURE_CONTROL0,
NV097_SET_TEXTURE_CONTROL0_ENABLE |
(gfx_alphaTest ? _NV_ALPHAKILL_EN : 0) |
MASK(NV097_SET_TEXTURE_CONTROL0_MIN_LOD_CLAMP, 0) |
MASK(NV097_SET_TEXTURE_CONTROL0_MAX_LOD_CLAMP, 1));
pb_end(p);
}

View File

@ -170,8 +170,8 @@ static void HandleButtons(int port, xid_gamepad_in* gp) {
#define AXIS_SCALE 8192.0f
static void HandleJoystick(int port, int axis, int x, int y, float delta) {
if (Math_AbsI(x) <= 4096) x = 0;
if (Math_AbsI(y) <= 4096) y = 0;
if (Math_AbsI(x) <= 6144) x = 0;
if (Math_AbsI(y) <= 6144) y = 0;
Gamepad_SetAxis(port, axis, x / AXIS_SCALE, -y / AXIS_SCALE, delta);
}