Update Makefile

This commit is contained in:
Maximilian Mader 2019-06-29 14:26:20 +02:00
parent e2ce844d2b
commit 5c4603891c
Signed by: Max
GPG Key ID: F71D56A3151C4FB3
2 changed files with 5 additions and 48 deletions

View File

@ -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 += .. CORE_DIR += ..
VERSION := 0.11.1
export VERSION
CONF ?= debug
BIN := $(CORE_DIR)/build/wasm_bin BIN := $(CORE_DIR)/build/wasm_bin
OBJ := $(CORE_DIR)/build/wasm_obj OBJ := $(CORE_DIR)/build/wasm_obj
BOOTROMS_DIR ?= $(CORE_DIR)/build/bin/BootROMs BOOTROMS_DIR ?= $(CORE_DIR)/build/bin/BootROMs
@ -42,17 +12,6 @@ endif
CC := emcc 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 # 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 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 # Define our targets
all: bootroms $(BIN)/index.html $(WEB_OBJECTS) $(SHADERS)
bootroms: $(BOOTROMS_DIR)/agb_boot.bin \ bootroms: $(BOOTROMS_DIR)/agb_boot.bin \
$(BOOTROMS_DIR)/cgb_boot.bin \ $(BOOTROMS_DIR)/cgb_boot.bin \
$(BOOTROMS_DIR)/dmg_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) SHADERS := $(shell ls $(CORE_DIR)/Shaders/*.fsh)
wasm: bootroms $(BIN)/index.html $(WEB_OBJECTS) $(SHADERS)
all: wasm
# Automatic dependency generation # Automatic dependency generation
ifneq ($(filter-out clean %.bin, $(MAKECMDGOALS)),) ifneq ($(filter-out clean %.bin, $(MAKECMDGOALS)),)

View File

@ -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 *active_pixel_buffer = pixel_buffer_1;
static uint32_t *previous_pixel_buffer = pixel_buffer_2; static uint32_t *previous_pixel_buffer = pixel_buffer_2;
static char *battery_save_path_ptr; static char *battery_save_path_ptr;
static bool skip_audio;
struct shader_name { struct shader_name {
const char *file_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) 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)); SDL_QueueAudio(device_id, sample, sizeof(*sample));
} }
@ -206,8 +207,6 @@ static void vblank(GB_gameboy_t *gb) {
} }
handle_events(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) static uint32_t rgb_encode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)