no message
This commit is contained in:
		@@ -83,7 +83,11 @@ typedef struct
 | 
			
		||||
	} music;
 | 
			
		||||
 | 
			
		||||
	tic_scanline scanline;
 | 
			
		||||
 | 
			
		||||
	tic_overlap overlap;
 | 
			
		||||
	void (*pixel)(tic_mem* memory, s32 x, s32 y, u8 color);
 | 
			
		||||
	u32 overlapPalette[TIC_PALETTE_SIZE];
 | 
			
		||||
 | 
			
		||||
	bool initialized;
 | 
			
		||||
} MachineState;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								src/studio.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								src/studio.c
									
									
									
									
									
								
							@@ -1448,29 +1448,23 @@ static void setCoverImage()
 | 
			
		||||
	if(studio.mode == TIC_RUN_MODE)
 | 
			
		||||
	{
 | 
			
		||||
		enum {Pitch = TIC80_FULLWIDTH*sizeof(u32)};
 | 
			
		||||
		u32* pixels = SDL_malloc(Pitch * TIC80_FULLHEIGHT);
 | 
			
		||||
 | 
			
		||||
		if(pixels)
 | 
			
		||||
		tic->api.blit(tic, tic->api.scanline, tic->api.overlap);
 | 
			
		||||
 | 
			
		||||
		u32* buffer = SDL_malloc(TIC80_WIDTH * TIC80_HEIGHT * sizeof(u32));
 | 
			
		||||
 | 
			
		||||
		if(buffer)
 | 
			
		||||
		{
 | 
			
		||||
			tic->api.blit(tic, pixels, tic->api.scanline, tic->api.overlap);
 | 
			
		||||
			SDL_Rect rect = {OFFSET_LEFT, OFFSET_TOP, TIC80_WIDTH, TIC80_HEIGHT};
 | 
			
		||||
 | 
			
		||||
			u32* buffer = SDL_malloc(TIC80_WIDTH * TIC80_HEIGHT * sizeof(u32));
 | 
			
		||||
			screen2buffer(buffer, tic->screen, rect);
 | 
			
		||||
 | 
			
		||||
			if(buffer)
 | 
			
		||||
			{
 | 
			
		||||
				SDL_Rect rect = {OFFSET_LEFT, OFFSET_TOP, TIC80_WIDTH, TIC80_HEIGHT};
 | 
			
		||||
			gif_write_animation(studio.tic->cart.cover.data, &studio.tic->cart.cover.size,
 | 
			
		||||
				TIC80_WIDTH, TIC80_HEIGHT, (const u8*)buffer, 1, TIC_FRAMERATE, 1);
 | 
			
		||||
 | 
			
		||||
				screen2buffer(buffer, pixels, rect);
 | 
			
		||||
			SDL_free(buffer);
 | 
			
		||||
 | 
			
		||||
				gif_write_animation(studio.tic->cart.cover.data, &studio.tic->cart.cover.size,
 | 
			
		||||
					TIC80_WIDTH, TIC80_HEIGHT, (const u8*)buffer, 1, TIC_FRAMERATE, 1);
 | 
			
		||||
 | 
			
		||||
				SDL_free(buffer);
 | 
			
		||||
 | 
			
		||||
				showPopupMessage("COVER IMAGE SAVED :)");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			SDL_free(pixels);
 | 
			
		||||
			showPopupMessage("COVER IMAGE SAVED :)");
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1950,7 +1944,8 @@ static void blitTexture()
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tic->api.blit(tic, pixels, scanline, overlap);
 | 
			
		||||
	tic->api.blit(tic, scanline, overlap);
 | 
			
		||||
	SDL_memcpy(pixels, tic->screen, sizeof tic->screen);
 | 
			
		||||
 | 
			
		||||
	recordFrame(pixels);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								src/tic.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/tic.c
									
									
									
									
									
								
							@@ -149,11 +149,26 @@ static void resetPalette(tic_mem* memory)
 | 
			
		||||
	memory->ram.vram.vars.mask.data = TIC_GAMEPAD_MASK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
 | 
			
		||||
static void dmaPixel(tic_mem* tic, s32 x, s32 y, u8 color)
 | 
			
		||||
{
 | 
			
		||||
	tic_tool_poke4(tic->ram.vram.screen.data, y * TIC80_WIDTH + x, tic_tool_peek4(tic->ram.vram.mapping, color & 0xf));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void overlapPixel(tic_mem* tic, s32 x, s32 y, u8 color)
 | 
			
		||||
{
 | 
			
		||||
	tic_machine* machine = (tic_machine*)tic;
 | 
			
		||||
	
 | 
			
		||||
	enum {Top = (TIC80_FULLHEIGHT-TIC80_HEIGHT)/2, Bottom = Top};
 | 
			
		||||
	enum {Left = (TIC80_FULLWIDTH-TIC80_WIDTH)/2, Right = Left};
 | 
			
		||||
 | 
			
		||||
	tic->screen[x + Left + (y + Top) * TIC80_FULLWIDTH] = machine->state.overlapPalette[tic_tool_peek4(tic->ram.vram.mapping, color & 0xf)];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
 | 
			
		||||
{
 | 
			
		||||
	if(x < machine->state.clip.l || y < machine->state.clip.t || x >= machine->state.clip.r || y >= machine->state.clip.b) return;
 | 
			
		||||
 | 
			
		||||
	tic_tool_poke4(machine->memory.ram.vram.screen.data, y * TIC80_WIDTH + x, tic_tool_peek4(machine->memory.ram.vram.mapping, color & 0xf));
 | 
			
		||||
	machine->state.pixel(&machine->memory, x, y, color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static u8 getPixel(tic_machine* machine, s32 x, s32 y)
 | 
			
		||||
@@ -432,6 +447,8 @@ static void api_reset(tic_mem* memory)
 | 
			
		||||
	machine->state.scanline = NULL;
 | 
			
		||||
	machine->state.overlap = NULL;
 | 
			
		||||
 | 
			
		||||
	machine->state.pixel = dmaPixel;
 | 
			
		||||
 | 
			
		||||
	updateSaveid(memory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1655,8 +1672,9 @@ static u32* paletteBlit(tic_mem* tic)
 | 
			
		||||
	return pal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void api_blit(tic_mem* tic, u32* out, tic_scanline scanline, tic_overlap overlap)
 | 
			
		||||
static void api_blit(tic_mem* tic, tic_scanline scanline, tic_overlap overlap)
 | 
			
		||||
{
 | 
			
		||||
	u32* out = tic->screen;
 | 
			
		||||
	const u32* pal = paletteBlit(tic);
 | 
			
		||||
 | 
			
		||||
	if(scanline)
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,8 @@ TIC80_API void tic80_load(tic80* tic, void* cart, s32 size)
 | 
			
		||||
	tic80->tic.sound.count = tic80->memory->samples.size/sizeof(s16);
 | 
			
		||||
	tic80->tic.sound.samples = tic80->memory->samples.buffer;
 | 
			
		||||
 | 
			
		||||
	tic80->tic.screen = tic80->memory->screen;
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		tic80->tickData.error = onError;
 | 
			
		||||
		tic80->tickData.trace = onTrace;
 | 
			
		||||
@@ -121,7 +123,7 @@ TIC80_API void tic80_tick(tic80* tic, tic80_input input)
 | 
			
		||||
	tic80->memory->api.tick(tic80->memory, &tic80->tickData);
 | 
			
		||||
	tic80->memory->api.tick_end(tic80->memory);
 | 
			
		||||
 | 
			
		||||
	tic80->memory->api.blit(tic80->memory, tic->screen, tic80->memory->api.scanline, tic80->memory->api.overlap);
 | 
			
		||||
	tic80->memory->api.blit(tic80->memory, tic80->memory->api.scanline, tic80->memory->api.overlap);
 | 
			
		||||
 | 
			
		||||
	TickCounter++;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -109,7 +109,7 @@ typedef struct
 | 
			
		||||
 | 
			
		||||
	void (*tick_start)			(tic_mem* memory, const tic_sound* src);
 | 
			
		||||
	void (*tick_end)			(tic_mem* memory);
 | 
			
		||||
	void (*blit)				(tic_mem* tic, u32* out, tic_scanline scanline, tic_overlap overlap);
 | 
			
		||||
	void (*blit)				(tic_mem* tic, tic_scanline scanline, tic_overlap overlap);
 | 
			
		||||
 | 
			
		||||
	tic_script_lang (*get_script)(tic_mem* memory);
 | 
			
		||||
} tic_api;
 | 
			
		||||
@@ -131,6 +131,8 @@ struct tic_mem
 | 
			
		||||
		s16* buffer;
 | 
			
		||||
		s32 size;
 | 
			
		||||
	} samples;
 | 
			
		||||
 | 
			
		||||
	u32 screen[TIC80_FULLWIDTH * TIC80_FULLHEIGHT];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
tic_mem* tic_create(s32 samplerate);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user