Permalink
Browse files

video: initial port of libretro glide64

  • Loading branch information...
fzurita committed Feb 6, 2016
1 parent 7c49534 commit 0d934245f62029c0f9586f566277fec9814b9367
Showing with 24,071 additions and 70 deletions.
  1. +12 −0 assets/mupen64plus_data/profiles/emulation.cfg
  2. +17 −4 jni/mupen64plus-video-glide2gl.mk
  3. +19 −23 jni/mupen64plus-video-glide2gl/src/Glide64/Glide64_Ini.c
  4. +3 −3 jni/mupen64plus-video-glide2gl/src/Glide64/Glide64_UCode.c
  5. +6 −6 jni/mupen64plus-video-glide2gl/src/Glide64/glide64_3dmath.c
  6. +5 −5 jni/mupen64plus-video-glide2gl/src/Glide64/glide64_rdp.c
  7. +8 −4 jni/mupen64plus-video-glide2gl/src/Glide64/glidemain.c
  8. +1 −1 jni/mupen64plus-video-glide2gl/src/Glide64/rdp.h
  9. +9 −11 jni/mupen64plus-video-glide2gl/src/Glitch64/geometry.c
  10. +1 −1 jni/mupen64plus-video-glide2gl/src/Glitch64/glide.h
  11. +4 −5 jni/mupen64plus-video-glide2gl/src/Glitch64/glitch64_combiner.c
  12. +1 −0 jni/mupen64plus-video-glide2gl/src/Glitch64/glitch64_textures.c
  13. +1 −1 jni/mupen64plus-video-glide2gl/src/Glitch64/glitchmain.c
  14. +0 −3 jni/mupen64plus-video-glide2gl/src/Glitch64/glitchmain.h
  15. +31 −0 jni/mupen64plus-video-glide2gl/src/libretro/SDL.h
  16. 0 jni/mupen64plus-video-glide2gl/src/libretro/SDL_config.h
  17. +9 −0 jni/mupen64plus-video-glide2gl/src/libretro/SDL_mutex.h
  18. +32 −0 jni/mupen64plus-video-glide2gl/src/libretro/SDL_opengl.h
  19. +32 −0 jni/mupen64plus-video-glide2gl/src/libretro/SDL_opengles.h
  20. +32 −0 jni/mupen64plus-video-glide2gl/src/libretro/SDL_opengles2.h
  21. +33 −0 jni/mupen64plus-video-glide2gl/src/libretro/boolean.h
  22. +287 −0 jni/mupen64plus-video-glide2gl/src/libretro/brumme_crc.c
  23. +436 −0 jni/mupen64plus-video-glide2gl/src/libretro/gdp.c
  24. +356 −0 jni/mupen64plus-video-glide2gl/src/libretro/gdp.h
  25. +12,745 −0 jni/mupen64plus-video-glide2gl/src/libretro/glext.h
  26. +12 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/README.md
  27. +139 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/glgen.py
  28. +37 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/glsym.h
  29. +87 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/glsym_es2.c
  30. +145 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/glsym_es2.h
  31. +2,083 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/glsym_gl.c
  32. +3,140 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/glsym_gl.h
  33. +43 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/rglgen.c
  34. +49 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/rglgen.h
  35. +132 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/rglgen.py
  36. +80 −0 jni/mupen64plus-video-glide2gl/src/libretro/glsym/rglgen_headers.h
  37. +34 −0 jni/mupen64plus-video-glide2gl/src/libretro/libco.h
  38. +297 −0 jni/mupen64plus-video-glide2gl/src/libretro/libretro.c
  39. +1,933 −0 jni/mupen64plus-video-glide2gl/src/libretro/libretro.h
  40. +59 −0 jni/mupen64plus-video-glide2gl/src/libretro/libretro_crc.c
  41. +16 −0 jni/mupen64plus-video-glide2gl/src/libretro/libretro_memory.h
  42. +26 −0 jni/mupen64plus-video-glide2gl/src/libretro/libretro_perf.h
  43. +5 −0 jni/mupen64plus-video-glide2gl/src/libretro/link.T
  44. +738 −0 jni/mupen64plus-video-glide2gl/src/libretro/opengl_state_machine.c
  45. +203 −0 jni/mupen64plus-video-glide2gl/src/libretro/opengl_state_machine.h
  46. +30 −0 jni/mupen64plus-video-glide2gl/src/osal/dynamiclib.h
  47. +35 −0 jni/mupen64plus-video-glide2gl/src/osal/dynamiclib_unix.c
  48. +35 −0 jni/mupen64plus-video-glide2gl/src/osal/dynamiclib_win32.c
  49. +61 −0 jni/mupen64plus-video-glide2gl/src/osal/files.h
  50. +277 −0 jni/mupen64plus-video-glide2gl/src/osal/files_unix.c
  51. +207 −0 jni/mupen64plus-video-glide2gl/src/osal/files_win32.c
  52. +58 −0 jni/mupen64plus-video-glide2gl/src/osal/preproc.h
  53. +22 −0 jni/mupen64plus-video-glide2gl/src/video_api_export.ver
  54. +2 −0 res/values/arrays.xml
  55. +1 −0 res/values/strings.xml
  56. +1 −1 src/paulscode/android/mupen64plusae/SplashActivity.java
  57. +2 −1 src/paulscode/android/mupen64plusae/persistent/GamePrefs.java
  58. +2 −1 src/paulscode/android/mupen64plusae/profile/EmulationProfileActivity.java
@@ -10,6 +10,18 @@ r4300Emulator=2
videoPlugin=libmupen64plus-video-glide64mk2.so
glide64Frameskip=-5
+[libretro-Glide64-Accurate]
+comment=glide64 video with recommended settings for quality
+r4300Emulator=2
+videoPlugin=libmupen64plus-video-glide2gl.so
+glide64Frameskip=0
+
+[libretro-Glide64-Fast]
+comment=glide64 video with recommended settings for speed
+r4300Emulator=2
+videoPlugin=libmupen64plus-video-glide2gl.so
+glide64Frameskip=-5
+
[GlideN64-GLES-2.0]
comment=gliden64 video with recommended settings for most older devices
r4300Emulator=2
@@ -11,7 +11,10 @@ LOCAL_STATIC_LIBRARIES := png
LOCAL_ARM_MODE := arm
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/$(SRCDIR)/Glitch64/inc \
+ $(LOCAL_PATH)/$(SRCDIR)/Glitch64 \
+ $(LOCAL_PATH)/$(SRCDIR)/Glide64 \
+ $(LOCAL_PATH)/$(SRCDIR)/libretro \
+ $(LOCAL_PATH)/$(SRCDIR) \
$(M64P_API_INCLUDES) \
$(PNG_INCLUDES) \
$(SDL_INCLUDES) \
@@ -21,8 +24,8 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/Glitch64/glitch64_combiner.c \
$(SRCDIR)/Glitch64/glitch64_textures.c \
$(SRCDIR)/Glitch64/glitchmain.c \
- $(SRCDIR)/Glide64/osal_dynamiclib_unix.c \
$(SRCDIR)/Glide64/Combine.c \
+ $(SRCDIR)/Glide64/DepthBufferRender.c \
$(SRCDIR)/Glide64/FBtoScreen.c \
$(SRCDIR)/Glide64/glide64_3dmath.c \
$(SRCDIR)/Glide64/Glide64_Ini.c \
@@ -33,6 +36,15 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/Glide64/MiClWr.c \
$(SRCDIR)/Glide64/TexCache.c \
$(SRCDIR)/Glide64/TexLoad.c \
+ $(SRCDIR)/libretro/gdp.c \
+ $(SRCDIR)/libretro/opengl_state_machine.c \
+ $(SRCDIR)/libretro/libretro.c \
+ $(SRCDIR)/libretro/libretro_crc.c \
+ $(SRCDIR)/libretro/glsym/rglgen.c \
+ $(SRCDIR)/libretro/glsym/glsym_es2.c \
+
+
+
LOCAL_CFLAGS := \
$(COMMON_CFLAGS) \
@@ -56,7 +68,8 @@ LOCAL_LDLIBS := \
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
# Use for ARM7a:
- LOCAL_CFLAGS += -mfpu=vfp
+ LOCAL_CFLAGS += -D__ARM_NEON__
+ LOCAL_CFLAGS += -mfpu=neon
LOCAL_CFLAGS += -mfloat-abi=softfp
else ifeq ($(TARGET_ARCH_ABI), x86)
@@ -67,6 +80,6 @@ else
endif
-LOCAL_CFLAGS += -DM64P_CORE_PROTOTYPES -D_ENDUSER_RELEASE -DM64P_PLUGIN_API -D__LIBRETRO__ -DINLINE="inline" -DSDL_VIDEO_OPENGL_ES2=1 -DANDROID -DSINC_LOWER_QUALITY -DHAVE_LOGGER -DHAVE_COMBINE_EXT -fexceptions $(GLFLAGS) -DGLES
+LOCAL_CFLAGS += -DM64P_CORE_PROTOTYPES -D_ENDUSER_RELEASE -DM64P_PLUGIN_API -D__LIBRETRO__ -DINLINE="inline" -DSDL_VIDEO_OPENGL_ES2=1 -DANDROID -DSINC_LOWER_QUALITY -DHAVE_LOGGER -DHAVE_COMBINE_EXT -fexceptions -DGLES -DHAVE_OPENGLES2 -DDISABLE_3POINT -DUSE_GLES
include $(BUILD_SHARED_LIBRARY)
@@ -4,8 +4,8 @@
#include "rdp.h"
#include "DepthBufferRender.h"
-#include "api/libretro.h"
-#include "../../libretro/SDL.h"
+#include "libretro/libretro.h"
+#include "libretro/SDL.h"
extern bool no_audio;
extern uint8_t microcode[4096];
@@ -178,7 +178,7 @@ void ReadSpecialSettings (const char * name)
//depthmode = 0
}
// ;Bakushou Jinsei 64 - Mezease! Resort Ou.
- else if (strstr(name, (const char *)"ÊÞ¸¼®³¼Þݾ²64"))
+ else if (strstr(name, (const char *)"ÊÞ¸¼®³¼Þ�¾²64"))
{
//fb_info_disable = 1
//depthmode = 0
@@ -484,7 +484,7 @@ void ReadSpecialSettings (const char * name)
hires = 1;
#endif
}
- else if (strstr(name, (const char *)"´¸½ÄØ°ÑG2"))
+ else if (strstr(name, (const char *)"´¸½ÄØ°ÑG2"))
{
//depthmode = 0
smart_read = 0;
@@ -526,7 +526,7 @@ void ReadSpecialSettings (const char * name)
hires = 1;
#endif
}
- else if (strstr(name, (const char *)"´²º³É¾ÝıÝÄÞØ­°½"))
+ else if (strstr(name, (const char *)"´²º³É¾�ı�ÄÞØ­°½"))
{
//;Eikou no Saint Andrew
settings.correct_viewport = 1;
@@ -604,7 +604,7 @@ void ReadSpecialSettings (const char * name)
cpu_write_hack = 1;
//depthmode = 0
}
- else if (strstr(name, (const char*)"ÄÞ×´ÓÝ3 ÉËÞÀÉÏÁSOS!"))
+ else if (strstr(name, (const char*)"ÄÞ×´Ó�3 ÉËÞÀÉ��SOS!"))
{
//;Doraemon 3 - Nobita no Machi SOS! (J)
settings.clip_zmin = 1;
@@ -645,7 +645,7 @@ void ReadSpecialSettings (const char * name)
//depthmode = 0
settings.buff_clear = 0;
}
- else if (strstr(name, (const char*)"F3 ̳ײɼÚÝ2"))
+ else if (strstr(name, (const char*)"F3 ̳ײɼ�2"))
{
//;Fushigi no Dungeon - Furai no Shiren 2 (J)
settings.decrease_fillrect_edge = 1;
@@ -706,7 +706,7 @@ void ReadSpecialSettings (const char * name)
settings.swapmode = 0;
}
else if (strstr(name, (const char*)"GANBAKE GOEMON")
- //|| strstr(name, (const char*)"¶ÞÝÊÞÚ\ ºÞ´ÓÝ") */ TODO: illegal characters - find by ucode CRC */
+ //|| strstr(name, (const char*)"¶Þ�ÊÞÚ\ ºÞ´Ó�") */ TODO: illegal characters - find by ucode CRC */
|| strstr(name, (const char*)"MYSTICAL NINJA")
|| strstr(name, (const char*)"MYSTICAL NINJA2 SG")
)
@@ -753,14 +753,14 @@ void ReadSpecialSettings (const char * name)
settings.filtering = 1;
//depthmode = 1
}
- else if (strstr(name, (const char*)"ÊѽÀ°ÓɶÞÀØ64")
+ else if (strstr(name, (const char*)"ÊѽÀ°ÓɶÞÀØ64")
)
{
settings.force_microcheck = 1;
//depthmode = 0
}
else if (strstr(name, (const char*)"HARVESTMOON64")
- || strstr(name, (const char*)"ÎÞ¸¼Þ®³ÓɶÞÀØ2")
+ || strstr(name, (const char*)"ÎÞ¸¼Þ®³ÓɶÞÀØ2")
)
{
settings.zmode_compare_less = 1;
@@ -819,7 +819,7 @@ void ReadSpecialSettings (const char * name)
//depthmode = 0
settings.buff_clear = 0;
}
- else if (strstr(name, (const char*)"ÓØÀ¼®³·Þ64"))
+ else if (strstr(name, (const char*)"ÓØÀ¼®³·Þ64"))
{
//;Morita Shogi 64
settings.correct_viewport = 1;
@@ -911,7 +911,7 @@ void ReadSpecialSettings (const char * name)
hires = 1;
#endif
}
- else if (strstr(name, (const char*)"ÄÞ×´ÓÝ Ð¯Âɾ²Ú²¾·"))
+ else if (strstr(name, (const char*)"ÄÞ×´Ó� �¯Âɾ²Ú²¾·"))
{
//;Doraemon - Mittsu no Seireiseki (J)
read_back_to_screen = 1;
@@ -921,7 +921,7 @@ void ReadSpecialSettings (const char * name)
hires = 1;
#endif
}
- else if (strstr(name, (const char*)"HEIWA ÊßÁݺ Ü°ÙÄÞ64"))
+ else if (strstr(name, (const char*)"HEIWA Êß��º Ü°ÙÄÞ64"))
{
//; Heiwa Pachinko World
//depthmode = 0
@@ -932,13 +932,13 @@ void ReadSpecialSettings (const char * name)
hires = 1;
#endif
}
- else if (strstr(name, (const char*)"·×¯Ä¶²¹Â 64ÀÝòÀÞÝ"))
+ else if (strstr(name, (const char*)"·×¯Ä¶²¹Â 64À�òÀÞ�"))
{
settings.filtering = 1;
//depthmode = 0
settings.buff_clear = 0;
}
- else if (strstr(name, (const char*)"½°Êß°ÛÎÞ¯ÄÀ²¾Ý64"))
+ else if (strstr(name, (const char*)"½°Êß°ÛÎÞ¯ÄÀ²¾�64"))
{
//;Super Robot Taisen 64 (J)
smart_read = 1;
@@ -957,18 +957,14 @@ void ReadSpecialSettings (const char * name)
//depthmode = 0
settings.buff_clear = 0;
}
- else if (strstr(name, (const char*)"TOP GEAR RALLY"))
- {
- no_audio = true;
- }
- else if (strstr(name, (const char*)"½½Ò!À²¾ÝÊß½ÞÙÀÞÏ"))
+ else if (strstr(name, (const char*)"½½Ò!À²¾�Êß½ÞÙÀÞ�"))
{
settings.force_microcheck = 1;
//depthmode = 1
settings.fog = 0;
settings.swapmode = 0;
}
- else if (strstr(name, (const char*)"ÐÝÅÃÞÀϺޯÁÜ°ÙÄÞ"))
+ else if (strstr(name, (const char*)"��ÅÃÞÀ�ºÞ¯�Ü°ÙÄÞ"))
{
//;Tamagotchi World 64 (J)
//depthmode = 0
@@ -1025,7 +1021,7 @@ void ReadSpecialSettings (const char * name)
#if 0
// TODO: illegal characters - will have to find this game by ucode CRC
// later
- else if (strstr(name, (const char*)"JØ°¸Þ\ ²ÚÌÞÝËÞ°Ä1997"))
+ else if (strstr(name, (const char*)"JØ°¸Þ\ ²ÚÌÞ�ËÞ°Ä1997"))
{
//;J.League Eleven Beat 1997
smart_read = 1;
@@ -1062,7 +1058,7 @@ void ReadSpecialSettings (const char * name)
{
settings.buff_clear = 0;
}
- else if (strstr(name, (const char*)"ǼÂÞØ64"))
+ else if (strstr(name, (const char*)"ǼÂÞØ64"))
{
//; Nushi Zuri 64
settings.force_microcheck = 1;
@@ -1,7 +1,7 @@
#include <stdint.h>
#include "Glide64_UCode.h"
#include "rdp.h"
-#include "api/libretro.h"
+#include "libretro/libretro.h"
extern uint8_t microcode[4096];
extern uint32_t uc_crc;
@@ -182,8 +182,8 @@ void microcheck(void)
)
{
settings.ucode = 2;
- if (log_cb)
- log_cb(RETRO_LOG_INFO, "Microcode 2 - F3DEX 2.XX (The Legend of Zelda: Ocarina of Time)\n");
+ //if (log_cb)
+ // log_cb(RETRO_LOG_INFO, "Microcode 2 - F3DEX 2.XX (The Legend of Zelda: Ocarina of Time)\n");
}
else if (
uc_crc == UCODE_WAVERACE_64
@@ -38,7 +38,7 @@
//****************************************************************
#include "Gfx_1.3.h"
-#include "../../libretro/SDL.h"
+#include "libretro/SDL.h"
#include <math.h>
#include "3dmath.h"
@@ -208,17 +208,17 @@ void math_init(void)
{
unsigned cpu = 0;
- if (perf_get_cpu_features_cb)
- cpu = perf_get_cpu_features_cb();
+ //if (perf_get_cpu_features_cb)
+ // cpu = perf_get_cpu_features_cb();
#if defined(__ARM_NEON__)
- if (cpu & RETRO_SIMD_NEON)
+ if (/*cpu & */RETRO_SIMD_NEON)
{
glide64NormalizeVector = NormalizeVectorNeon;
glide64MulMatrices = MulMatricesNeon;
glide64DotProduct = DotProductNeon;
- if (log_cb)
- log_cb(RETRO_LOG_INFO, "NEON detected, using (some) optimized math functions.\n");
+ //if (log_cb)
+ // log_cb(RETRO_LOG_INFO, "NEON detected, using (some) optimized math functions.\n");
}
#endif
}
@@ -47,7 +47,7 @@
#include "CRC.h"
#include "GBI.h"
#include "Glide64_UCode.h"
-#include "../../libretro/SDL.h"
+#include "libretro/SDL.h"
#ifdef __LIBRETRO__ // Prefix API
#define VIDEO_TAG(X) glide64##X
@@ -226,8 +226,8 @@ void rdp_new(void)
rdp.cur_cache[i] = 0;
}
- if (perf_get_cpu_features_cb)
- cpu = perf_get_cpu_features_cb();
+ //if (perf_get_cpu_features_cb)
+ // cpu = perf_get_cpu_features_cb();
_gSPVertex = gSPVertex_G64;
}
@@ -236,8 +236,8 @@ void rdp_setfuncs(void)
{
if (settings.hacks & hack_Makers)
{
- if (log_cb)
- log_cb(RETRO_LOG_INFO, "Applying Mischief Makers function pointer table tweak...\n");
+ //if (log_cb)
+ // log_cb(RETRO_LOG_INFO, "Applying Mischief Makers function pointer table tweak...\n");
gfx_instruction[0][191] = uc0_tri1_mischief;
}
}
@@ -46,10 +46,10 @@
#include "FBtoScreen.h"
#include "DepthBufferRender.h"
#include "Glide64_Ini.h"
-#include "api/libretro.h"
+#include "libretro/libretro.h"
+#include <android/log.h>
extern void CRC_BuildTable();
-extern retro_log_printf_t log_cb;
extern uint32_t screen_aspectmodehint;
#if defined(__GNUC__)
@@ -96,6 +96,8 @@ extern uint32_t screen_aspectmodehint;
void (*_gSPVertex)(uint32_t addr, uint32_t n, uint32_t v0);
+GFX_INFO gfx_info;
+
int romopen = false;
int exception = false;
@@ -491,6 +493,8 @@ EXPORT int CALL InitiateGFX (GFX_INFO Gfx_Info)
rdp_new();
+ gfx_info = Gfx_Info;
+
// Assume scale of 1 for debug purposes
rdp.scale_x = 1.0f;
rdp.scale_y = 1.0f;
@@ -544,8 +548,8 @@ static void CheckDRAMSize(void)
else
BMASK = 0x3FFFFF;
- if (log_cb)
- log_cb(RETRO_LOG_INFO, "Detected RDRAM size: %08lx\n", BMASK);
+
+ __android_log_print(ANDROID_LOG_ERROR, "glide2gl","Detected RDRAM size: %08lx\n", BMASK);
}
/******************************************************************
@@ -40,7 +40,7 @@
#ifndef RDP_H
#define RDP_H
-#include "rdp_common/gdp.h"
+#include "gdp.h"
#include "Gfx_1.3.h"
extern uint32_t frame_count; // frame counter
Oops, something went wrong.

0 comments on commit 0d93424

Please sign in to comment.