Skip to content
2 changes: 1 addition & 1 deletion workspace/tg5040/cores/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fbneo_REPO = https://github.com/libretro/FBNeo
fbneo_CORE = fbneo_libretro.so
fbneo_BUILD_PATH = fbneo/src/burner/libretro
fbneo_MAKE = make
fbneo_HASH = 6a5cc250c2db8d874a06ee86e302a2a78918b4c1
fbneo_HASH = e2e14514ebda6a88a1df90db7f37a0862e8baa8c

mednafen_pce_fast_REPO = https://github.com/libretro/beetle-pce-fast-libretro
mednafen_vb_REPO = https://github.com/libretro/beetle-vb-libretro
Expand Down
100 changes: 53 additions & 47 deletions workspace/tg5040/cores/patches/fbneo.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
diff --git a/src/burner/libretro/Makefile b/src/burner/libretro/Makefile
old mode 100644
new mode 100755
index 0b7d646c7..2784aa150
index 0f097afd7..a70405dd3
--- a/src/burner/libretro/Makefile
+++ b/src/burner/libretro/Makefile
@@ -346,6 +346,22 @@ else ifeq ($(platform), classic_armv7_a7)
@@ -359,6 +359,22 @@ else ifeq ($(platform), classic_armv7_a7)
CFLAGS += $(PLATFORM_FLAGS)
CXXFLAGS += $(PLATFORM_FLAGS)

Expand All @@ -23,15 +23,15 @@ index 0b7d646c7..2784aa150
+ LDFLAGS += -lstdc++ -static-libgcc -static-libstdc++ -lpthread -lm -flto
+ CFLAGS += $(PLATFORM_FLAGS)
+ CXXFLAGS += $(PLATFORM_FLAGS)
+
+
# (armv8 a35, hard point, neon based) ###
# Playstation Classic
else ifeq ($(platform), classic_armv8_a35)
diff --git a/src/burner/libretro/libretro.cpp b/src/burner/libretro/libretro.cpp
index 3726ec60f..30a6c8cd6 100644
index 6cf17df9f..59ba0cb05 100644
--- a/src/burner/libretro/libretro.cpp
+++ b/src/burner/libretro/libretro.cpp
@@ -78,7 +78,7 @@ INT32 nAudSegLen = 0;
@@ -71,7 +71,7 @@ INT32 nAudSegLen = 0;

static UINT8* pVidImage = NULL;
static bool bVidImageNeedRealloc = false;
Expand All @@ -40,69 +40,75 @@ index 3726ec60f..30a6c8cd6 100644
static int16_t *pAudBuffer = NULL;
static char text_missing_files[2048] = "";

@@ -1550,8 +1550,46 @@ void retro_run()
// current frame will be corrupted, let's dupe instead
@@ -1579,7 +1579,52 @@ void retro_run()
pBurnDraw = NULL;
}
+ // get flags
+ UINT32 flags = BurnDrvGetFlags();

- video_cb(pBurnDraw, nGameWidth, nGameHeight, nBurnPitch);
+ // get flags
+ UINT32 flags = BurnDrvGetFlags();
+
+ if (pBurnDraw && flags & BDF_ORIENTATION_VERTICAL) {
+ int y=0;
+ if (pBurnDraw && flags & BDF_ORIENTATION_VERTICAL)
+ {
+ int y = 0;
+
+ UINT8 *pTMP = (UINT8*)malloc(nGameWidth * nGameHeight * nBurnBpp);
+ memcpy(pTMP, pBurnDraw, nGameWidth * nGameHeight * nBurnBpp);
+ UINT8 *pTMP = (UINT8 *)malloc(nGameWidth * nGameHeight * nBurnBpp);
+ memcpy(pTMP, pBurnDraw, nGameWidth * nGameHeight * nBurnBpp);
+
+ int newGameWidth = nGameHeight;
+ int newGameHeight = nGameWidth;
+ int newBurnPitch = newGameWidth * nBurnBpp;
+ int newGameWidth = nGameHeight;
+ int newGameHeight = nGameWidth;
+ int newBurnPitch = newGameWidth * nBurnBpp;
+
+ if ((BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL))
+ while (y < newGameHeight) {
+ int x = 0;
+ while (y < newGameHeight)
+ {
+ int x = 0;
+
+ if ( flags & BDF_ORIENTATION_FLIPPED ) {
+ while (x < newGameWidth)
+ {
+ for (int i = 0; i < nBurnBpp; i++)
+ pBurnDraw[x * nBurnBpp + y * newBurnPitch + i] = pTMP[(nGameHeight - x - 1) * nBurnPitch + y * nBurnBpp + i];
+ x++;
+ }
+ } else {
+ while (x < newGameWidth)
+ {
+ for (int i = 0; i < nBurnBpp; i++)
+ pBurnDraw[x * nBurnBpp + y * newBurnPitch + i] = pTMP[x * nBurnPitch + (nGameWidth - y - 1) * nBurnBpp + i];
+ x++;
+ }
+ }
+ y++;
+ }
+ free(pTMP);
+ video_cb(pBurnDraw, newGameWidth, newGameHeight, newBurnPitch);
+ } else {
+ video_cb(pBurnDraw, nGameWidth, nGameHeight, nBurnPitch);
+ }

- video_cb(pBurnDraw, nGameWidth, nGameHeight, nBurnPitch);
+ if (flags & BDF_ORIENTATION_FLIPPED)
+ {
+ while (x < newGameWidth)
+ {
+ for (int i = 0; i < nBurnBpp; i++)
+ pBurnDraw[x * nBurnBpp + y * newBurnPitch + i] = pTMP[(nGameHeight - x - 1) * nBurnPitch + y * nBurnBpp + i];
+ x++;
+ }
+ }
+ else
+ {
+ while (x < newGameWidth)
+ {
+ for (int i = 0; i < nBurnBpp; i++)
+ pBurnDraw[x * nBurnBpp + y * newBurnPitch + i] = pTMP[x * nBurnPitch + (nGameWidth - y - 1) * nBurnBpp + i];
+ x++;
+ }
+ }
+ y++;
+ }
+ free(pTMP);
+ video_cb(pBurnDraw, newGameWidth, newGameHeight, newBurnPitch);
+ }
+ else
+ {
+ video_cb(pBurnDraw, nGameWidth, nGameHeight, nBurnPitch);
+ }

bool updated = false;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
@@ -1567,7 +1605,7 @@ void retro_run()
@@ -1597,7 +1642,7 @@ void retro_run()
// change orientation/geometry if vertical mode was toggled on/off
if (old_nVerticalMode != nVerticalMode)
{
- SetRotation();
+ //SetRotation();
+ // SetRotation();
struct retro_system_av_info av_info;
retro_get_system_av_info(&av_info);
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info);
@@ -2184,7 +2222,7 @@ static bool retro_load_game_common()
@@ -2227,7 +2272,7 @@ static bool retro_load_game_common()

// Initializing display, autorotate if needed
BurnDrvGetFullSize(&nGameWidth, &nGameHeight);
- SetRotation();
+ //SetRotation();
+ // SetRotation();
BurnSetResolution(nNewWidth, nNewHeight);
SetColorDepth();

VideoBufferInit();