libretro: Fix GB games that uses serial (WIP)

Allow serial emulation without having the need to run link-related
communication stuff (NO_LINK define). Some games need this e.g. RC Pro-AM
racing. Dummy funcs/vars are added as placeholders.

Currently work-in-progress and might need to disable some more NO_LINK
sections.
This commit is contained in:
retro-wertz 2019-01-14 22:50:54 +08:00 committed by Rafael Kitover
parent af3fe01822
commit f9efb79a7d
2 changed files with 49 additions and 1 deletions

View File

@ -1,6 +1,7 @@
TILED_RENDERING=0
STATIC_LINKING=0
FRONTEND_SUPPORTS_RGB565=1
NO_LINK=0
SPACE :=
SPACE := $(SPACE) $(SPACE)
@ -259,12 +260,16 @@ include Makefile.common
OBJS := $(SOURCES_CXX:.cpp=.o)
VBA_DEFINES += -D__LIBRETRO__ -DFINAL_VERSION -DC_CORE -DNO_LINK -DNO_DEBUGGER
VBA_DEFINES += -D__LIBRETRO__ -DFINAL_VERSION -DC_CORE -DNO_DEBUGGER
ifeq ($(FRONTEND_SUPPORTS_RGB565),1)
VBA_DEFINES += -DFRONTEND_SUPPORTS_RGB565
endif
ifeq ($(NO_LINK),1)
VBA_DEFINES += -DNO_LINK
endif
ifneq ($(SANITIZER),)
CFLAGS += -fsanitize=$(SANITIZER)
CXXFLAGS += -fsanitize=$(SANITIZER)

View File

@ -80,6 +80,49 @@ int emulating = 0;
void (*dbgOutput)(const char* s, uint32_t addr);
void (*dbgSignal)(int sig, int number);
// Dummy vars/funcs for serial io emulation without LINK communication related stuff
#ifndef NO_LINK
#include "../gba/GBALink.h"
uint8_t gbSIO_SC;
bool LinkIsWaiting;
bool LinkFirstTime;
bool EmuReseted;
int winGbPrinterEnabled;
bool gba_joybus_active = false;
LinkMode GetLinkMode()
{
return LINK_DISCONNECTED;
}
void StartGPLink(uint16_t value)
{
}
void LinkUpdate(int ticks)
{
}
void StartLink(uint16_t siocnt)
{
}
void CheckLinkConnection()
{
}
void gbInitLink()
{
LinkIsWaiting = false;
LinkFirstTime = true;
}
uint16_t gbLinkUpdate(uint8_t b, int gbSerialOn) //used on external clock
{
return (b << 8);
}
#endif
#define GS555(x) (x | (x << 5) | (x << 10))
uint16_t systemGbPalette[24] = {
GS555(0x1f), GS555(0x15), GS555(0x0c), 0,