diff options
| author | John "Lameguy" Wilbert Villamor <lameguy64@gmail.com> | 2021-10-25 08:18:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-25 08:18:23 +0800 |
| commit | 8d17a5abe3c600b603f1910239d5df0fff9f4eed (patch) | |
| tree | 20d3110363ab468e99502337c0a46852662bb365 /examples | |
| parent | 0a7f59de1eb079930e7c25ad35adc39c9946958c (diff) | |
| parent | 4e0d5bceb24042a6d31c76958ce2c6157369ac68 (diff) | |
| download | psn00bsdk-8d17a5abe3c600b603f1910239d5df0fff9f4eed.tar.gz | |
Merge pull request #41 from spicyjpeg/cmake
CMake fixes, Windows build instructions
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/sound/vagsample/CMakeLists.txt | 22 | ||||
| -rw-r--r-- | examples/sound/vagsample/makefile | 65 | ||||
| -rw-r--r-- | examples/system/dynlink/main.c | 10 |
3 files changed, 28 insertions, 69 deletions
diff --git a/examples/sound/vagsample/CMakeLists.txt b/examples/sound/vagsample/CMakeLists.txt new file mode 100644 index 0000000..1f42608 --- /dev/null +++ b/examples/sound/vagsample/CMakeLists.txt @@ -0,0 +1,22 @@ +# PSn00bSDK example CMake script +# (C) 2021 spicyjpeg - MPL licensed + +cmake_minimum_required(VERSION 3.21) + +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS}) + set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake) +endif() + +project( + vagsample + LANGUAGES C + VERSION 1.0.0 + DESCRIPTION "PSn00bSDK SPU sound playback example" + HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" +) + +file(GLOB _sources *.c) +psn00bsdk_add_executable(vagsample STATIC ${_sources}) +#psn00bsdk_add_cd_image(vagsample_iso vagsample iso.xml DEPENDS vagsample) + +install(FILES ${PROJECT_BINARY_DIR}/vagsample.exe DESTINATION .) diff --git a/examples/sound/vagsample/makefile b/examples/sound/vagsample/makefile deleted file mode 100644 index acbaaad..0000000 --- a/examples/sound/vagsample/makefile +++ /dev/null @@ -1,65 +0,0 @@ -# PSn00bSDK makefile template -# Part of the PSn00bSDK Project -# 2019 - 2021 Lameguy64 / Meido-Tek Productions - -## Settings - -PSN00BSDK_LIBS ?= ../../../libpsn00b - -# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's -# root folder (it only depends on environment variables). -include ../../../psn00bsdk-setup.mk - -# Project target name -TARGET = vagsample - -## Files - -# Searches for C, C++ and S (assembler) files in local directory -CFILES = $(notdir $(wildcard *.c)) -CPPFILES= $(notdir $(wildcard *.cpp)) -AFILES = $(notdir $(wildcard *.s)) - -# Create names for object files -OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ - $(addprefix build/,$(CPPFILES:.cpp=.o)) \ - $(addprefix build/,$(AFILES:.s=.o)) - -# Project specific includes and libraries -# (use -I for include dirs, -L for library dirs, -l for static libraries) -INCLUDE += -LIBDIRS += -LIBS += - -## Build rules - -#all: iso -all: build/$(TARGET) - -iso: build/$(TARGET) resources - $(MKPSXISO) -y -q iso.xml - -resources: - # Add commands to build/convert your assets here - #$(LZPACK) data.xml - -build/$(TARGET): $(OFILES) - @mkdir -p $(dir $@) - $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@ - $(NM) -f posix -l -n $@ >$@.map - $(ELF2X) -q $@ $@.exe - -build/%.o: %.c - @mkdir -p $(dir $@) - $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@ - -build/%.o: %.cpp - @mkdir -p $(dir $@) - $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@ - -build/%.o: %.s - @mkdir -p $(dir $@) - $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@ - -clean: - rm -rf build diff --git a/examples/system/dynlink/main.c b/examples/system/dynlink/main.c index 70314da..33f6f44 100644 --- a/examples/system/dynlink/main.c +++ b/examples/system/dynlink/main.c @@ -62,7 +62,9 @@ const void *const DO_NOT_STRIP[] __attribute__((section(".dummy"))) = { &InitGeom, &RotMatrix, &TransMatrix, - &MulMatrix0 + &MulMatrix0, + &GetTimInfo, + &LoadImage }; static const char *const DLL_FILENAMES[] = { @@ -141,7 +143,7 @@ void load_dll(const char *filename) { dll = dlopen(filename, RTLD_LAZY); if (!dll) - SHOW_ERROR("FAILED TO LOAD %s\n%s\n", filename, dlerror()); + SHOW_ERROR("FAILED TO LOAD %s\nERROR=%d\n", filename, (int32_t) dlerror()); dll_api.init = dlsym(dll, "init"); dll_api.render = dlsym(dll, "render"); @@ -168,12 +170,12 @@ int main(int argc, const char* argv[]) { SHOW_STATUS("LOADING SYMBOL MAP\n"); if (!DL_LoadSymbolMap("cdrom:MAIN.MAP;1")) - SHOW_ERROR("FAILED TO LOAD SYMBOL MAP\n%s\n", dlerror()); + SHOW_ERROR("FAILED TO LOAD SYMBOL MAP\nERROR=%d\n", (int32_t) dlerror()); // Try to obtain a reference to a local function. void (*_display)() = DL_GetSymbolByName("display"); if (!_display) - SHOW_ERROR("FAILED TO LOOK UP LOCAL FUNCTION\n%s\n", dlerror()); + SHOW_ERROR("FAILED TO LOOK UP LOCAL FUNCTION\nERROR=%d\n", (int32_t) dlerror()); printf("Symbol map test, display() @ %08x\n", _display); |
