From 5c4603891c0e0baf3d48fa7b7103e5a2feeae6d1 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sat, 29 Jun 2019 14:26:20 +0200 Subject: [PATCH] Update Makefile --- wasm/Makefile | 46 ++-------------------------------------------- wasm/main.c | 7 +++---- 2 files changed, 5 insertions(+), 48 deletions(-) diff --git a/wasm/Makefile b/wasm/Makefile index 7131388..10fa593 100644 --- a/wasm/Makefile +++ b/wasm/Makefile @@ -1,35 +1,5 @@ -# Make hacks -.INTERMEDIATE: - -# Set target, configuration, version and destination folders - -PLATFORM := $(shell uname -s) -ifneq ($(findstring MINGW,$(PLATFORM)),) -PLATFORM := windows32 -USE_WINDRES := true -endif - -ifneq ($(findstring MSYS,$(PLATFORM)),) -PLATFORM := windows32 -endif - -ifeq ($(PLATFORM),windows32) -_ := $(shell chcp 65001) -endif - -DEFAULT := wasm -default: $(DEFAULT) - -ifeq ($(MAKECMDGOALS),) -MAKECMDGOALS := $(DEFAULT) -endif - CORE_DIR += .. -VERSION := 0.11.1 -export VERSION -CONF ?= debug - BIN := $(CORE_DIR)/build/wasm_bin OBJ := $(CORE_DIR)/build/wasm_obj BOOTROMS_DIR ?= $(CORE_DIR)/build/bin/BootROMs @@ -42,17 +12,6 @@ endif CC := emcc -ifeq ($(PLATFORM),windows32) -# To force use of the Unix version instead of the Windows version -MKDIR := $(shell which mkdir) -else -MKDIR := mkdir -endif - -ifeq ($(CONF),native_release) -override CONF := release -endif - # Set compilation and linkage flags based on target, platform and configuration CFLAGS += -Werror -Wall -Wno-strict-aliasing -Wno-unknown-warning -Wno-unknown-warning-option -Wno-multichar -Wno-int-in-bool-context -std=gnu11 -D_GNU_SOURCE -DVERSION="$(VERSION)" -I. -D_USE_MATH_DEFINES @@ -78,6 +37,8 @@ endif # Define our targets +all: bootroms $(BIN)/index.html $(WEB_OBJECTS) $(SHADERS) + bootroms: $(BOOTROMS_DIR)/agb_boot.bin \ $(BOOTROMS_DIR)/cgb_boot.bin \ $(BOOTROMS_DIR)/dmg_boot.bin \ @@ -98,9 +59,6 @@ WEB_OBJECTS := $(patsubst %,$(BIN)/ressources/%,$(WEB_SOURCES)) SHADERS := $(shell ls $(CORE_DIR)/Shaders/*.fsh) -wasm: bootroms $(BIN)/index.html $(WEB_OBJECTS) $(SHADERS) -all: wasm - # Automatic dependency generation ifneq ($(filter-out clean %.bin, $(MAKECMDGOALS)),) diff --git a/wasm/main.c b/wasm/main.c index b931cbb..99e3f8e 100644 --- a/wasm/main.c +++ b/wasm/main.c @@ -28,7 +28,6 @@ static uint32_t pixel_buffer_1[256 * 224], pixel_buffer_2[256 * 224]; static uint32_t *active_pixel_buffer = pixel_buffer_1; static uint32_t *previous_pixel_buffer = pixel_buffer_2; static char *battery_save_path_ptr; -static bool skip_audio; struct shader_name { const char *file_name; @@ -121,7 +120,9 @@ unsigned query_sample_rate_of_audiocontexts() { static void gb_audio_callback(GB_gameboy_t *gb, GB_sample_t *sample) { - if (skip_audio) return; + if ((SDL_GetQueuedAudioSize(device_id) / sizeof(GB_sample_t)) > have_aspec.freq / 12) { + return; + } SDL_QueueAudio(device_id, sample, sizeof(*sample)); } @@ -206,8 +207,6 @@ static void vblank(GB_gameboy_t *gb) { } handle_events(gb); - - skip_audio = (SDL_GetQueuedAudioSize(device_id) / sizeof(GB_sample_t)) > have_aspec.freq / 20; } static uint32_t rgb_encode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)