Stop rendering uninitialized memory
This commit is contained in:
		
							parent
							
								
									f4b4aa099b
								
							
						
					
					
						commit
						486ab96ab2
					
				| 
						 | 
				
			
			@ -41,6 +41,10 @@ void emuReset(EmulationContext *emu) {
 | 
			
		|||
    vbReset(emu->sim);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool emuIsGameLoaded(EmulationContext *emu) {
 | 
			
		||||
    return vbGetCartROM(emu->sim, NULL) != NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define MAX_STEP_CLOCKS 20000000
 | 
			
		||||
void emuTick(EmulationContext *emu) {
 | 
			
		||||
    uint32_t clocks = MAX_STEP_CLOCKS;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ int emuInit(EmulationContext *emu);
 | 
			
		|||
void emuDestroy(EmulationContext *emu);
 | 
			
		||||
void emuLoadGame(EmulationContext *emu, uint8_t *rom, uint32_t romSize);
 | 
			
		||||
void emuReset(EmulationContext *emu);
 | 
			
		||||
bool emuIsGameLoaded(EmulationContext *emu);
 | 
			
		||||
 | 
			
		||||
void emuTick(EmulationContext *emu);
 | 
			
		||||
bool emuReadPixels(EmulationContext *emu, uint8_t *left, uint8_t *right);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										7
									
								
								ui.c
								
								
								
								
							
							
						
						
									
										7
									
								
								ui.c
								
								
								
								
							| 
						 | 
				
			
			@ -106,9 +106,10 @@ typedef enum status_t {
 | 
			
		|||
} status_t;
 | 
			
		||||
 | 
			
		||||
int uiRun(UIContext *ui, bool running) {
 | 
			
		||||
    static uint8_t leftEye[384*224];
 | 
			
		||||
    static uint8_t rightEye[384*224];
 | 
			
		||||
    static uint8_t leftEye[384*224] = {0};
 | 
			
		||||
    static uint8_t rightEye[384*224] = {0};
 | 
			
		||||
    status_t status = running ? status_running : status_paused;
 | 
			
		||||
    windowUpdate(&ui->win, leftEye, rightEye);
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
        struct nk_context *ctx;
 | 
			
		||||
| 
						 | 
				
			
			@ -163,7 +164,7 @@ int uiRun(UIContext *ui, bool running) {
 | 
			
		|||
                }
 | 
			
		||||
                if (nk_menu_item_label(ctx, "Reset", NK_TEXT_ALIGN_LEFT)) {
 | 
			
		||||
                    emuReset(&ui->emu);
 | 
			
		||||
                    status = status_running;
 | 
			
		||||
                    status = emuIsGameLoaded(&ui->emu) ? status_running : status_paused;
 | 
			
		||||
                }
 | 
			
		||||
                nk_menu_end(ctx);
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue