From f486f74dcf62513b80b6768a6b77f4fccdf20fdf Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 14 Jun 2024 20:47:13 +1000 Subject: [PATCH] PS2: Fix textures appearing slightly offset --- src/Graphics_PS2.c | 14 ++++++++------ src/Window_PS2.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Graphics_PS2.c b/src/Graphics_PS2.c index c1b75fd19..b3b617964 100644 --- a/src/Graphics_PS2.c +++ b/src/Graphics_PS2.c @@ -152,7 +152,7 @@ void Gfx_Free(void) { typedef struct CCTexture_ { cc_uint32 width, height; cc_uint32 log2_width, log2_height; - cc_uint32 pad[(64 - 4)/4]; + cc_uint32 pad[(64 - 16)/4]; cc_uint32 pixels[]; // aligned to 64 bytes (only need 16?) } CCTexture; @@ -165,6 +165,9 @@ static GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 tex->log2_width = draw_log2(bmp->width); tex->log2_height = draw_log2(bmp->height); + cc_uintptr addr = (cc_uintptr)tex->pixels; + Platform_Log1("ADDR: %x", &addr); + CopyTextureData(tex->pixels, bmp->width * 4, bmp, rowWidth << 2); return tex; } @@ -621,24 +624,23 @@ void Gfx_BeginFrame(void) { } void Gfx_EndFrame(void) { - Platform_LogConst("--- EF1 ---"); + //Platform_LogConst("--- EF1 ---"); q = draw_finish(q); - Platform_LogConst("--- EF2 ---"); // Fill out and then send DMA chain DMATAG_END(dma_tag, (q - current->data) - 1, 0, 0, 0); dma_wait_fast(); dma_channel_send_chain(DMA_CHANNEL_GIF, current->data, q - current->data, 0, 0); - Platform_LogConst("--- EF3 ---"); + //Platform_LogConst("--- EF2 ---"); draw_wait_finish(); - Platform_LogConst("--- EF4 ---"); + //Platform_LogConst("--- EF3 ---"); if (gfx_vsync) graph_wait_vsync(); if (gfx_minFrameMs) LimitFPS(); FlipContext(); - Platform_LogConst("--- EF5 ---"); + //Platform_LogConst("--- EF4 ---"); } void Gfx_SetFpsLimit(cc_bool vsync, float minFrameMs) { diff --git a/src/Window_PS2.c b/src/Window_PS2.c index 6105d8397..79fb421f2 100644 --- a/src/Window_PS2.c +++ b/src/Window_PS2.c @@ -120,10 +120,10 @@ static void ProcessMouseInput(float delta) { mouse_data mData = { 0 }; if (PS2MouseRead(&mData) < 0) return; - //Platform_Log3("MOUSE: %i, %i, %i", &mData.x, &mData.y, &mData.buttons); Input_SetNonRepeatable(CCMOUSE_L, mData.buttons & PS2MOUSE_BTN1); Input_SetNonRepeatable(CCMOUSE_R, mData.buttons & PS2MOUSE_BTN2); Input_SetNonRepeatable(CCMOUSE_M, mData.buttons & PS2MOUSE_BTN3); + Mouse_ScrollVWheel(mData.wheel); if (!Input.RawMode) return; float scale = (delta * 60.0) / 2.0f;