Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/macos-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
$MAKE -C samples/notify
$MAKE -C samples/notify_debug
$MAKE -C samples/ps
$MAKE -C samples/sdk_ver
$CMAKE -S samples/hello_cmake -B samples/hello_cmake/build
$CMAKE --build samples/hello_cmake/build
$MESON setup samples/hello_meson samples/hello_meson/build
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ubuntu-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
$MAKE -C samples/notify
$MAKE -C samples/notify_debug
$MAKE -C samples/ps
$MAKE -C samples/sdk_ver
$CMAKE -S samples/hello_cmake -B samples/hello_cmake/build
$CMAKE --build samples/hello_cmake/build
$MESON setup samples/hello_meson samples/hello_meson/build
Expand All @@ -76,6 +77,13 @@ jobs:
path: ./ps5-payload-sdk.zip
if-no-files-found: error

- name: Upload Samples
uses: actions/upload-artifact@v4
with:
name: Samples
include-hidden-files: true
path: ./samples

release:
needs: build
permissions:
Expand Down
4 changes: 4 additions & 0 deletions samples/sdk_ver/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.elf
*.o
*~

48 changes: 48 additions & 0 deletions samples/sdk_ver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (C) 2023 John Törnblom
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not see
# <http://www.gnu.org/licenses/>.

PS5_HOST ?= ps5
PS5_PORT ?= 9021

ifdef PS5_PAYLOAD_SDK
include $(PS5_PAYLOAD_SDK)/toolchain/prospero.mk
else
$(error PS5_PAYLOAD_SDK is undefined)
endif

ELF := sdk_ver.elf

CFLAGS := -Wall -Werror -g

all: $(ELF)

$(ELF): main.c
$(CC) $(CFLAGS) -o $@ $^

clean:
rm -f $(ELF)

test: $(ELF)
$(PS5_DEPLOY) -h $(PS5_HOST) -p $(PS5_PORT) $^

debug: $(ELF)
gdb-multiarch \
-ex "set architecture i386:x86-64" \
-ex "target extended-remote $(PS5_HOST):2159" \
-ex "file $(ELF)" \
-ex "remote put $(ELF) /data/$(ELF)" \
-ex "set remote exec-file /data/$(ELF)" \
-ex "start"
40 changes: 40 additions & 0 deletions samples/sdk_ver/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* Copyright (C) 2023 John Törnblom

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>. */

#include <stdio.h>
#include <string.h>
#include <ps5/kernel.h>

// exclude null terminator
#define sizeof_1(a) (sizeof(a) - 1)

typedef struct notify_request {
char useless1[45];
char message[1024];
char useless2[2051];
} notify_request_t;

int sceKernelSendNotificationRequest(int, notify_request_t*, size_t, int);

int
main() {
notify_request_t req;
bzero(&req, sizeof(req));
const uint32_t sdk = kernel_get_fw_version();
snprintf(req.message, sizeof_1(req.message), "SDK Version: 0x%08x", sdk);

return sceKernelSendNotificationRequest(0, &req, sizeof req, 0);
}
Loading