Increased sprite limit per pixel to 10

this fixes the sprite ordering issue in zelda
This commit is contained in:
2025-05-23 10:06:21 -06:00
parent b4b83d45e2
commit fb15f89776
3 changed files with 15 additions and 14 deletions

View File

@ -35,7 +35,7 @@ typedef struct {
u8 pushed_x; u8 pushed_x;
u8 fetch_x; u8 fetch_x;
u8 bgw_fetch_data[3]; u8 bgw_fetch_data[3];
u8 fetch_entry_data[6]; //oam data u8 fetch_entry_data[20]; //oam data
u8 map_y; u8 map_y;
u8 map_x; u8 map_x;
u8 tile_y; u8 tile_y;
@ -70,7 +70,7 @@ typedef struct {
oam_line_entry line_entry_array[10]; //memory to use for list oam_line_entry line_entry_array[10]; //memory to use for list
u8 fetched_entry_count; u8 fetched_entry_count;
oam_entry fetched_entries[3]; //entries fetched during pipeline oam_entry fetched_entries[10]; //entries fetched during pipeline
u8 window_line; u8 window_line;
pixel_fifo_context pfc; pixel_fifo_context pfc;

View File

@ -104,7 +104,7 @@ bool pipeline_fifo_add() {
color = lcd_get_context()->bg_colors[0]; color = lcd_get_context()->bg_colors[0];
} }
if(LCDC_OBJ_ENABLE) { if(LCDC_OBJ_ENABLE && !ppu_get_context()->debug) {
color = fetch_sprite_pixels(bit, color, hi | lo); color = fetch_sprite_pixels(bit, color, hi | lo);
} }
@ -130,8 +130,8 @@ void pipeline_load_sprite_tile() {
le = le->next; le = le->next;
if (!le || ppu_get_context()->fetched_entry_count >= 3) { if (!le || ppu_get_context()->fetched_entry_count >= 10) {
//max checking 3 sprites on pixels //max checking 10 sprites on pixels
break; break;
} }
} }
@ -287,7 +287,7 @@ void pipeline_push_pixel() {
} }
if(ppu_get_context()->rendering_window) { if(ppu_get_context()->rendering_window) {
ppu_get_context()->video_buffer[ppu_get_context()->pfc.pushed_x + ppu_get_context()->video_buffer[ppu_get_context()->pfc.pushed_x +
(lcd_get_context()->ly * XRES)] = ppu_get_context()->debug ? 0xFF0000 : pixel_data;//interpolate(ppu_get_context()->video_buffer[ppu_get_context()->pfc.pushed_x + (lcd_get_context()->ly * XRES)] = pixel_data;//interpolate(ppu_get_context()->video_buffer[ppu_get_context()->pfc.pushed_x +
//(lcd_get_context()->ly * XRES)], pixel_data); //(lcd_get_context()->ly * XRES)], pixel_data);
ppu_get_context()->pfc.pushed_x++; ppu_get_context()->pfc.pushed_x++;

View File

@ -23,6 +23,7 @@ SDL_Window *sdlDebugWindow;
SDL_Renderer *sdlDebugRenderer; SDL_Renderer *sdlDebugRenderer;
SDL_Texture *sdlDebugTexture; SDL_Texture *sdlDebugTexture;
SDL_Surface *debugScreen; SDL_Surface *debugScreen;
TTF_Font *sans;
static int scale = 4; static int scale = 4;
@ -32,6 +33,14 @@ void ui_init(){
TTF_Init(); TTF_Init();
printf("TTF INIT\n"); printf("TTF INIT\n");
char buffer[1024];
strcpy(buffer, emu_get_context()->app_path);
*strrchr(buffer, '\\') = 0;
strcat(buffer,"/Sans.ttf");
sans = TTF_OpenFont(buffer, 24);
if ( !sans ) {
printf("Failed to load font: %s\n", TTF_GetError());
}
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0, &sdlWindow, &sdlRenderer); SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0, &sdlWindow, &sdlRenderer);
screen = SDL_CreateRGBSurface(0, SCREEN_WIDTH, screen = SDL_CreateRGBSurface(0, SCREEN_WIDTH,
@ -138,14 +147,6 @@ void ui_update() {
SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch); SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch);
SDL_RenderClear(sdlRenderer); SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL); SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
char buffer[1024];
strcpy(buffer, emu_get_context()->app_path);
*strrchr(buffer, '\\') = 0;
strcat(buffer,"/Sans.ttf");
TTF_Font* sans = TTF_OpenFont(buffer, 24);
if ( !sans ) {
printf("Failed to load font: %s\n", TTF_GetError());
}
SDL_Color text_color = {255,255,255}; SDL_Color text_color = {255,255,255};
int yOffset = 50; int yOffset = 50;
int lastY = (yOffset) - (audio_get_context()->sq1_history[audio_get_context()->sq1_index] * 50); int lastY = (yOffset) - (audio_get_context()->sq1_history[audio_get_context()->sq1_index] * 50);