Unverified Commit fad1dd15 authored by Zach Bacon's avatar Zach Bacon Committed by GitHub
Browse files

Merge pull request #262 from retro-wertz/libretro

Libretro
parents 50e91f79 9c859917
......@@ -164,13 +164,20 @@ void flashSaveDecide(uint32_t address, uint8_t byte)
if (saveType == 1)
return;
// log("Deciding save type %08x\n", address);
if (address == 0x0e005555) {
saveType = 3;
cpuSaveGameFunc = flashWrite;
} else {
saveType = 2;
cpuSaveGameFunc = sramWrite;
if (cpuSramEnabled && cpuFlashEnabled) {
// log("Deciding save type %08x\n", address);
if (address == 0x0e005555) {
saveType = 3;
cpuSramEnabled = false;
cpuSaveGameFunc = flashWrite;
} else {
saveType = 2;
cpuFlashEnabled = false;
cpuSaveGameFunc = sramWrite;
}
log("%s emulation is enabled by writing to: $%08x : %02x\n",
cpuSramEnabled ? "SRAM" : "FLASH", address, byte);
}
(*cpuSaveGameFunc)(address, byte);
......
......@@ -67,6 +67,11 @@ extern uint8_t biosProtected[4];
extern void (*cpuSaveGameFunc)(uint32_t, uint8_t);
extern bool cpuSramEnabled;
extern bool cpuFlashEnabled;
extern bool cpuEEPROMEnabled;
extern bool cpuEEPROMSensorEnabled;
#ifdef BKPT_SUPPORT
extern uint8_t freezeWorkRAM[0x40000];
extern uint8_t freezeInternalRAM[0x8000];
......
......@@ -243,7 +243,7 @@ bool rtcWrite(uint32_t address, uint16_t value)
} break;
default:
#ifndef __LIBRETRO__
#ifdef GBA_LOGGING
log(N_("Unknown RTC command %02x"), rtcClockData.command);
#endif
rtcClockData.state = IDLE;
......
......@@ -225,9 +225,14 @@ include Makefile.common
OBJS := $(SOURCES_CXX:.cpp=.o)
VBA_DEFINES += -D__LIBRETRO__ -DFINAL_VERSION -DC_CORE -DUSE_GBA_ONLY -DNO_LINK
VBA_DEFINES += -D__LIBRETRO__ -DFINAL_VERSION -DC_CORE -DNO_LINK -DNO_DEBUGGER
VBA_DEFINES += -DFRONTEND_SUPPORTS_RGB565
ifneq ($(SANITIZER),)
CFLAGS += -fsanitize=$(SANITIZER)
LDFLAGS += -fsanitize=$(SANITIZER)
endif
ifeq ($(DEBUG), 1)
CFLAGS += -g
CXXFLAGS += -g
......
......@@ -10,15 +10,10 @@ SOURCES_CXX := $(CORE_DIR)/gba/GBA-thumb.cpp \
$(CORE_DIR)/gba/Mode4.cpp \
$(CORE_DIR)/gba/Mode3.cpp \
$(CORE_DIR)/gba/Mode5.cpp \
$(CORE_DIR)/gba/GBALink.cpp \
$(CORE_DIR)/gba/Mode2.cpp \
$(CORE_DIR)/gba/GBASockClient.cpp \
$(CORE_DIR)/gba/elf.cpp \
$(CORE_DIR)/gba/ereader.cpp \
$(CORE_DIR)/gba/GBA-arm.cpp \
$(CORE_DIR)/gba/bios.cpp \
$(CORE_DIR)/gba/gbafilter.cpp \
$(CORE_DIR)/gba/remote.cpp \
$(CORE_DIR)/gba/Mode0.cpp \
$(CORE_DIR)/gba/Flash.cpp \
$(CORE_DIR)/gba/GBAGfx.cpp \
......@@ -27,13 +22,11 @@ SOURCES_CXX := $(CORE_DIR)/gba/GBA-thumb.cpp \
$(CORE_DIR)/gba/EEprom.cpp \
$(CORE_DIR)/gba/RTC.cpp \
$(CORE_DIR)/gba/Sram.cpp \
$(CORE_DIR)/apu/Effects_Buffer.cpp \
$(CORE_DIR)/apu/Gb_Oscs.cpp \
$(CORE_DIR)/apu/Gb_Apu_State.cpp \
$(CORE_DIR)/apu/Blip_Buffer.cpp \
$(CORE_DIR)/apu/Multi_Buffer.cpp \
$(CORE_DIR)/apu/Gb_Apu.cpp \
$(CORE_DIR)/common/Patch.cpp \
$(CORE_DIR)/libretro/libretro.cpp \
$(CORE_DIR)/libretro/UtilRetro.cpp \
$(CORE_DIR)/libretro/SoundRetro.cpp \
......
......@@ -238,16 +238,12 @@ void utilUpdateSystemColorMaps(bool lcd)
for (int i = 0; i < 0x10000; i++) {
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd)
gbafilter_pal(systemColorMap16, 0x10000);
} break;
case 24:
case 32: {
for (int i = 0; i < 0x10000; i++) {
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd)
gbafilter_pal32(systemColorMap32, 0x10000);
} break;
}
}
......
......@@ -1042,3 +1042,15 @@ SoundDriver* systemSoundInit()
soundShutdown();
return new SoundRetro();
}
void log(const char* defaultMsg, ...)
{
va_list valist;
char buf[2048];
va_start(valist, defaultMsg);
vsnprintf(buf, 2048, defaultMsg, valist);
va_end(valist);
if (log_cb)
log_cb(RETRO_LOG_INFO, "%s", buf);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment