diff --git a/Core/cheats.c b/Core/cheats.c index 451dddb..8defc6c 100644 --- a/Core/cheats.c +++ b/Core/cheats.c @@ -200,7 +200,7 @@ void GB_update_cheat(GB_gameboy_t *gb, const GB_cheat_t *_cheat, const char *des GB_cheat_hash_t **hash = &gb->cheat_hash[hash_addr(cheat->address)]; for (unsigned i = 0; i < (*hash)->size; i++) { if ((*hash)->cheats[i] == cheat) { - (*hash)->cheats[i] = (*hash)->cheats[(*hash)->size--]; + (*hash)->cheats[i] = (*hash)->cheats[--(*hash)->size]; if ((*hash)->size == 0) { free(*hash); *hash = NULL; diff --git a/Core/timing.c b/Core/timing.c index 18cf571..1da82a3 100644 --- a/Core/timing.c +++ b/Core/timing.c @@ -69,7 +69,7 @@ void GB_timing_sync(GB_gameboy_t *gb) gb->last_sync += target_nanoseconds; } else { - if (-time_to_sleep < LCDC_PERIOD * 1200000000LL / GB_get_clock_rate(gb)) { + if (time_to_sleep < 0 && -time_to_sleep < LCDC_PERIOD * 1200000000LL / GB_get_clock_rate(gb)) { // We're running a bit too slow, but the difference is small enough, // just skip this sync and let it even out return; diff --git a/Makefile b/Makefile index 5724e50..fcaae75 100644 --- a/Makefile +++ b/Makefile @@ -439,9 +439,9 @@ ICON_SIZES := 16x16 32x32 64x64 128x128 256x256 512x512 ICONS := $(foreach name,$(ICON_NAMES), $(foreach size,$(ICON_SIZES),$(DESTDIR)$(PREFIX)/share/icons/hicolor/$(size)/$(name).png)) install: sdl $(DESTDIR)$(PREFIX)/share/mime/packages/sameboy.xml $(ICONS) FreeDesktop/sameboy.desktop -@$(MKDIR) -p $(dir $(DESTDIR)$(PREFIX)) - mkdir -p $(DESTDIR)$(PREFIX)/share/sameboy/ $(DESTDIR)$(PREFIX)/bin/ - cp -rf $(BIN)/SDL/* $(DESTDIR)$(PREFIX)/share/sameboy/ - mv $(DESTDIR)$(PREFIX)/share/sameboy/sameboy $(DESTDIR)$(PREFIX)/bin/sameboy + mkdir -p $(DESTDIR)$(DATA_DIR)/ $(DESTDIR)$(PREFIX)/bin/ + cp -rf $(BIN)/SDL/* $(DESTDIR)$(DATA_DIR)/ + mv $(DESTDIR)$(DATA_DIR)/sameboy $(DESTDIR)$(PREFIX)/bin/sameboy ifeq ($(DESTDIR),) -update-mime-database -n $(PREFIX)/share/mime -xdg-desktop-menu install --novendor --mode system FreeDesktop/sameboy.desktop