Add libpl submodule (#753)

* Add libpl submodule

* Clone libpl submodule automatically while building (if enabled)
This commit is contained in:
Gregory Heskett authored and GitHub committed 2024-02-02 22:08:34 -05:00
1 parent 5064fcfb69
commit b9ba17a4d6
7 files changed
+54 -1

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
[submodule "lib/libpl"]
path = lib/libpl
url = https://gitlab.com/parallel-launcher/libpl.git
+1
View File
@@ -27,6 +27,7 @@
"F3DEX_GBI_2=1", "F3DEX_GBI_2=1",
"F3DZEX_NON_GBI_2=1", "F3DZEX_NON_GBI_2=1",
"F3DEX_GBI_SHARED=1" "F3DEX_GBI_SHARED=1"
"LIBPL=1",
], ],
"compilerPath": "/usr/bin/mips-linux-gnu-gcc", "compilerPath": "/usr/bin/mips-linux-gnu-gcc",
"cStandard": "gnu17", "cStandard": "gnu17",
+24
View File
@@ -253,6 +253,18 @@ ifeq ($(HVQM),1)
SRC_DIRS += src/hvqm SRC_DIRS += src/hvqm
endif endif
# LIBPL - whether to include libpl library for interfacing with Parallel Launcher
# (library will be pulled into repo after building with this enabled for the first time)
# 1 - includes code in ROM
# 0 - does not
LIBPL ?= 0
LIBPL_DIR := lib/libpl
$(eval $(call validate-option,LIBPL,0 1))
ifeq ($(LIBPL),1)
DEFINES += LIBPL=1
SRC_DIRS += $(LIBPL_DIR)
endif
BUILD_DIR_BASE := build BUILD_DIR_BASE := build
# BUILD_DIR is the location where all build artifacts are placed # BUILD_DIR is the location where all build artifacts are placed
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_$(CONSOLE) BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_$(CONSOLE)
@@ -335,6 +347,18 @@ ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),)
ifeq ($(DUMMY),FAIL) ifeq ($(DUMMY),FAIL)
$(error Failed to build tools) $(error Failed to build tools)
endif endif
# Clone any needed submodules
ifeq ($(LIBPL),1)
ifeq ($(wildcard $(LIBPL_DIR)),)
$(info Cloning libpl submodule...)
DUMMY != git submodule update --init $(LIBPL_DIR) > /dev/null || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to clone libpl submodule)
endif
endif
endif
$(info Building ROM...) $(info Building ROM...)
endif endif
Submodule
+1
Submodule lib/libpl added at d6b3a90d09.
+12
View File
@@ -171,6 +171,9 @@ SECTIONS
BUILD_DIR/src/audio*.o(.text*); BUILD_DIR/src/audio*.o(.text*);
#ifdef S2DEX_TEXT_ENGINE #ifdef S2DEX_TEXT_ENGINE
BUILD_DIR/src/s2d_engine*.o(.text*); BUILD_DIR/src/s2d_engine*.o(.text*);
#endif
#ifdef LIBPL
BUILD_DIR/lib/libpl*.o(.text*);
#endif #endif
*/ULTRALIB.a:*.o(.text*); */ULTRALIB.a:*.o(.text*);
*/libnustd.a:*.o(.text*); */libnustd.a:*.o(.text*);
@@ -191,6 +194,9 @@ SECTIONS
BUILD_DIR/src/audio*.o(.*data*); BUILD_DIR/src/audio*.o(.*data*);
#ifdef S2DEX_TEXT_ENGINE #ifdef S2DEX_TEXT_ENGINE
BUILD_DIR/src/s2d_engine*.o(.*data*); BUILD_DIR/src/s2d_engine*.o(.*data*);
#endif
#ifdef LIBPL
BUILD_DIR/lib/libpl*.o(.*data*);
#endif #endif
*/ULTRALIB.a:*.o(.data*); */ULTRALIB.a:*.o(.data*);
*/libhvqm2.a:*.o(.data*); */libhvqm2.a:*.o(.data*);
@@ -207,6 +213,9 @@ SECTIONS
BUILD_DIR/src/audio*.o(.rodata*); BUILD_DIR/src/audio*.o(.rodata*);
#ifdef S2DEX_TEXT_ENGINE #ifdef S2DEX_TEXT_ENGINE
BUILD_DIR/src/s2d_engine*.o(.rodata*); BUILD_DIR/src/s2d_engine*.o(.rodata*);
#endif
#ifdef LIBPL
BUILD_DIR/lib/libpl*.o(.rodata*);
#endif #endif
*/ULTRALIB.a:*.o(.rodata*); */ULTRALIB.a:*.o(.rodata*);
*/libgcc.a:*.o(.rodata*); */libgcc.a:*.o(.rodata*);
@@ -224,6 +233,9 @@ SECTIONS
BUILD_DIR/src/audio*.o(.*bss*); BUILD_DIR/src/audio*.o(.*bss*);
#ifdef S2DEX_TEXT_ENGINE #ifdef S2DEX_TEXT_ENGINE
BUILD_DIR/src/s2d_engine*.o(.*bss*); BUILD_DIR/src/s2d_engine*.o(.*bss*);
#endif
#ifdef LIBPL
BUILD_DIR/lib/libpl*.o(.*bss*);
#endif #endif
*/ULTRALIB.a:*.o(COMMON); */ULTRALIB.a:*.o(COMMON);
*/ULTRALIB.a:*.o(.scommon); */ULTRALIB.a:*.o(.scommon);
+8 -1
View File
@@ -9,7 +9,10 @@
#include <string.h> #include <string.h>
#include "emutest_vc.h" #include "emutest_vc.h"
#include "float.h" #include "float.h"
#include "types.h"
#ifdef LIBPL
#include "lib/libpl/libpl-emu.h"
#endif
extern OSMesgQueue gSIEventMesgQueue; extern OSMesgQueue gSIEventMesgQueue;
extern u8 __osContPifRam[]; extern u8 __osContPifRam[];
@@ -20,6 +23,7 @@ extern void __osPiGetAccess(void);
extern void __osPiRelAccess(void); extern void __osPiRelAccess(void);
enum Emulator gEmulator = EMU_CONSOLE; enum Emulator gEmulator = EMU_CONSOLE;
u8 gSupportsLibpl = FALSE;
u32 pj64_get_count_factor_asm(void); // defined in asm/pj64_get_count_factor_asm.s u32 pj64_get_count_factor_asm(void); // defined in asm/pj64_get_count_factor_asm.s
u32 emux_detect(void); // defined in asm/emux.s u32 emux_detect(void); // defined in asm/emux.s
@@ -140,6 +144,9 @@ void detect_emulator() {
if (magic == 0x00500000u) { if (magic == 0x00500000u) {
// libpl is supported. Must be ParallelN64 // libpl is supported. Must be ParallelN64
gEmulator = EMU_PARALLELN64; gEmulator = EMU_PARALLELN64;
#ifdef LIBPL
gSupportsLibpl = libpl_is_supported(LPL_ABI_VERSION_CURRENT);
#endif
return; return;
} }
+5
View File
@@ -1,6 +1,8 @@
#ifndef EMUTEST_H #ifndef EMUTEST_H
#define EMUTEST_H #define EMUTEST_H
#include "types.h"
enum Emulator { enum Emulator {
EMU_WIIVC = 0x0001, EMU_WIIVC = 0x0001,
EMU_PROJECT64_ANY = 0x001E, EMU_PROJECT64_ANY = 0x001E,
@@ -37,6 +39,9 @@ extern void detect_emulator();
*/ */
extern enum Emulator gEmulator; extern enum Emulator gEmulator;
// determines whether libpl is safe to use
extern u8 gSupportsLibpl;
// Included for backwards compatibility when upgrading from HackerSM64 2.0 // Included for backwards compatibility when upgrading from HackerSM64 2.0
#define gIsConsole ((gEmulator & EMU_CONSOLE) != 0) #define gIsConsole ((gEmulator & EMU_CONSOLE) != 0)