ref: b33d776451632990b42b5ab3b43888427685eef3
parent: 23948daf66d70fd666f2b0da138f3dfec25a92e4
author: allkern <aurealinbox@gmail.com>
date: Thu May 9 20:29:13 EDT 2024
FIxed slowdown Fixed CUE loading error on older Unix systems Fixed build for older SDL installations
--- a/frontend/screen.c
+++ b/frontend/screen.c
@@ -2,6 +2,8 @@
#include "input/sda.h"
+#include "SDL2/SDL_version.h"
+
uint32_t screen_get_button(SDL_Keycode k) {
if (k == SDLK_x ) return PSXI_SW_SDA_CROSS;
if (k == SDLK_a ) return PSXI_SW_SDA_SQUARE;
@@ -130,7 +132,9 @@
screen->texture_width, screen->texture_height
);
+#if SDL_VERSION_ATLEAST(2, 0, 12)
SDL_SetTextureScaleMode(screen->texture, screen->bilinear);
+#endif
// Check for retina displays
int width = 0, height = 0;
@@ -473,7 +477,9 @@
screen->texture_width, screen->texture_height
);
+#if SDL_VERSION_ATLEAST(2, 0, 12)
SDL_SetTextureScaleMode(screen->texture, screen->bilinear);
+#endif
SDL_SetWindowSize(screen->window, screen->width, screen->height);
}
--- a/psx/dev/gpu.c
+++ b/psx/dev/gpu.c
@@ -49,7 +49,12 @@
gpu->io_size = PSX_GPU_SIZE;
gpu->vram = (uint16_t*)malloc(PSX_GPU_VRAM_SIZE);
+ gpu->empty = malloc(PSX_GPU_VRAM_SIZE);
+
+ memset(gpu->empty, 0, PSX_GPU_VRAM_SIZE);
+
gpu->state = GPU_STATE_RECV_CMD;
+ gpu->gpustat |= 0x800000;
// Default window size, this is not normally needed
gpu->display_mode = 1;
@@ -211,6 +216,9 @@
int xmax = max3(a.x, b.x, c.x);
int ymax = max3(a.y, b.y, c.y);
+ if (((xmax - xmin) > 2048) || ((ymax - ymin) > 1024))
+ return;
+
float area = EDGE(a, b, c);
for (int y = ymin; y < ymax; y++) {
@@ -1510,6 +1518,7 @@
for (uint32_t y = gpu->v0.y; y < (gpu->v0.y + gpu->ysiz); y++) {
for (uint32_t x = gpu->v0.x; x < (gpu->v0.x + gpu->xsiz); x++) {
+ // This shouldn't be needed
int bc = (x >= gpu->draw_x1) && (x <= gpu->draw_x2) &&
(y >= gpu->draw_y1) && (y <= gpu->draw_y2);
@@ -1686,6 +1695,11 @@
uint8_t cmd = value >> 24;
switch (cmd) {
+ // Display enable
+ case 0x03: {
+ gpu->gpustat &= ~0x00800000;
+ gpu->gpustat |= (value << 23) & 0x00800000;
+ } break;
case 0x04: {
} break;
case 0x05: {
@@ -1816,6 +1830,9 @@
}
void* psx_gpu_get_display_buffer(psx_gpu_t* gpu) {
+ if (gpu->gpustat & 0x800000)
+ return gpu->empty;
+
return gpu->vram + (gpu->disp_x + (gpu->disp_y * 1024));
}
--- a/psx/dev/gpu.h
+++ b/psx/dev/gpu.h
@@ -93,6 +93,8 @@
void* udata[4];
uint16_t* vram;
+ uint16_t* empty;
+ int display_enable;
// State data
uint32_t buf[16];
--- a/psx/disc/cue.c
+++ b/psx/disc/cue.c
@@ -305,7 +305,7 @@
if (ptr == path) {
dir = malloc(3);
- strcpy(dir, ".\\");
+ strcpy(dir, "./");
return dir;
}
--
⑨