N64: Minorly simplify RSP texture size multiply

This commit is contained in:
UnknownShadow200 2025-07-15 21:12:33 +10:00
parent 157c538a08
commit abbfe4181b
3 changed files with 10 additions and 13 deletions

View File

@ -196,8 +196,8 @@ upload_vertex:
slv vtex, SCREEN_VTX_S_T, vtx
# 32-bit right shift by 5, to keep the clip space coordinates unscaled
vmudm vcspos_i, vcspos_i, vshift8.e4
vmadl vcspos_f, vcspos_f, vshift8.e4
vmudm vcspos_i, vcspos_i, K2048
vmadl vcspos_f, vcspos_f, K2048
addi vcount, -1
addi src_ptr, 16
@ -405,13 +405,11 @@ GL_TnL:
#vmadh vst, vtexoffset, K1
#vmudl vst, vst, vtexsize
vmudh v___, vst, vtexsize
vsar vst_i, COP2_ACC_HI
vsar vst_f, COP2_ACC_MD
vmudn vst_f, vst, vtexsize # ACC = vst * vtexsize, VST_F = ACC & 0xFFFF
vmadh vst_i, vzero, vzero # ACC += zero * zero, VST_I = ACC >> 16
vmudl vst_f, vst_f, K8192
vmadm vst_i, vst_i, K8192
vmadn vst, vzero, vzero
vmudm v___, vst_i, K8192 # ACC = (vst_i * 8192)
vmadl vst, vst_f, K8192 # ACC += (vst_f * 8192) >> 16, VST = ACC & 0xFFFF
#undef vst_i
#undef vst_f

View File

@ -24,11 +24,6 @@
#include <sys/fcntl.h>
#include "_PlatformConsole.h"
// These functions are private in libdragon. FatFs functions are instead recommanded.
int open( const char *file, int flags, ... );
int stat( const char *file, struct stat *st );
int mkdir( const char * path, mode_t mode );
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
const cc_result ReturnCode_FileNotFound = ENOENT;
const cc_result ReturnCode_DirectoryExists = EEXIST;
@ -95,6 +90,7 @@ static cc_string root_path_rom = String_FromConst("rom:/");
void Platform_EncodePath(cc_filepath* dst, const cc_string* path) {
char* str = dst->buffer;
cc_string path_ = *path;
if (Platform_ReadonlyFilesystem) { // read from rom root
int idx = String_IndexOf(path, '/');
if (idx >= 0) path_ = String_UNSAFE_SubstringAt(&path_, idx + 1);
@ -297,6 +293,7 @@ void Platform_Init(void) {
dfs_init(DFS_DEFAULT_LOCATION);
timer_init();
rtc_init();
if (!debug_init_sdfs("sd:/", -1)) {
String_Copy(&root_path, &root_path_rom);
Platform_ReadonlyFilesystem = true;

View File

@ -157,6 +157,8 @@ static void VirtualKeyboard_Draw(struct Context2D* ctx) {
w = kb_tileWidth * KB_GetCellWidth(i);
h = kb_tileHeight;
/* Note: Make sure that the virtual keyboard ends up using 16 colours or less, so that */
/* some console graphics backends can allocate the rendered texture as a 4bpp texture */
Gradient_Noise(ctx, i == selected ? KB_SELECTED_COLOR : KB_NORMAL_COLOR, 2, x, y, w, h);
LWidget_DrawBorder(ctx, KB_BACKGROUND_COLOR, 1, 1, x, y, w, h);