Skip to content

Commit

Permalink
libretro: Fix GB games that uses serial (WIP)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
retro-wertz authored and rkitover committed Jan 14, 2019
1 parent af3fe01 commit f9efb79
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libretro/Makefile
@@ -1,6 +1,7 @@
TILED_RENDERING=0
STATIC_LINKING=0
FRONTEND_SUPPORTS_RGB565=1
NO_LINK=0

SPACE :=
SPACE := $(SPACE) $(SPACE)
Expand Down Expand Up @@ -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)
Expand Down
43 changes: 43 additions & 0 deletions src/libretro/libretro.cpp
Expand Up @@ -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,
Expand Down

0 comments on commit f9efb79

Please sign in to comment.