mirror of
https://github.com/mihawk-99/PS5_RetroArch.git
synced 2026-10-23 09:02:33 -05:00
Sets up this project as the native pipeline's scaffolding plus RetroArch's
sources, so RetroArch is compiled for the title pipeline rather than converted
into it.
- tools/scaffold-native.sh builds the scaffold from
../ps5-native-app-boilerplate-main: tooling, runtime (digest verified),
Makefile and its tools, merged into this repository's tools/ rather than
replacing them. An earlier version replaced tools/ wholesale and deleted this
project's own scripts; the copy is now additive and the reason is in the file.
- tools/fetch-retroarch.sh clones the pinned upstream tag into vendor/ and
records the revision, so "built from RetroArch 1.22.2" is checkable.
- src/display.{hpp,cpp} owns the console's display: VideoOut, direct memory, two
registered buffers, present-and-wait. The sequence and its two load-bearing
details come from the sibling application that proved it on hardware.
- src/main.cpp draws a moving bar: the cheapest thing that proves build, title
format, launcher, VideoOut and the direct-memory path together.
- sce_sys/param.json is this project's identity, PPSA99169.
Evidence: src/display.cpp compiles through the pipeline's compiler
(tooling/prospero-clang18 with PS5_CLANG=/usr/bin/clang, -std=c++20), and a
RetroArch source file compiles the same way with its include paths.
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
/*
|
|
* ps5-native-app-boilerplate - Native application startup.
|
|
* Copyright (C) 2026 BlackBearReloaded
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*
|
|
* Initializes the platform runtime, runs static constructors and main, and
|
|
* hands normal process termination back to the platform runtime.
|
|
*/
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
using Destructor = void (*)();
|
|
using Initializer = void (*)();
|
|
|
|
extern "C"
|
|
{
|
|
void _init_env(void *process_parameters);
|
|
int atexit(Destructor callback);
|
|
[[noreturn]] void exit(int status);
|
|
int application_main(int argc, char **argv, char **envp) __asm__("main");
|
|
|
|
extern Initializer __preinit_array_start[] __attribute__((weak));
|
|
extern Initializer __preinit_array_end[] __attribute__((weak));
|
|
extern Initializer __init_array_start[] __attribute__((weak));
|
|
extern Initializer __init_array_end[] __attribute__((weak));
|
|
extern Initializer __fini_array_start[] __attribute__((weak));
|
|
extern Initializer __fini_array_end[] __attribute__((weak));
|
|
}
|
|
|
|
namespace
|
|
{
|
|
void run_forward(Initializer *first, Initializer *last) noexcept
|
|
{
|
|
if (first == nullptr || last == nullptr)
|
|
return;
|
|
while (first != last)
|
|
(*first++)();
|
|
}
|
|
|
|
void run_reverse(Initializer *first, Initializer *last) noexcept
|
|
{
|
|
if (first == nullptr || last == nullptr)
|
|
return;
|
|
while (last != first)
|
|
(*--last)();
|
|
}
|
|
} // namespace
|
|
|
|
extern "C" __attribute__((weak)) void catchReturnFromMain(int status)
|
|
{
|
|
(void)status;
|
|
}
|
|
|
|
extern "C" void _init()
|
|
{
|
|
run_forward(__preinit_array_start, __preinit_array_end);
|
|
run_forward(__init_array_start, __init_array_end);
|
|
}
|
|
|
|
extern "C" void _fini()
|
|
{
|
|
run_reverse(__fini_array_start, __fini_array_end);
|
|
}
|
|
|
|
extern "C" [[noreturn]] __attribute__((visibility("default"))) void
|
|
_start(void *process_parameters, Destructor loader_teardown)
|
|
{
|
|
const int argc = *static_cast<const int *>(process_parameters);
|
|
auto *parameters = static_cast<std::uint8_t *>(process_parameters);
|
|
auto **argv = reinterpret_cast<char **>(parameters + sizeof(std::uint64_t));
|
|
|
|
_init_env(process_parameters);
|
|
if (loader_teardown != nullptr)
|
|
(void)atexit(loader_teardown);
|
|
(void)atexit(_fini);
|
|
_init();
|
|
const int status = application_main(argc, argv, nullptr);
|
|
catchReturnFromMain(status);
|
|
exit(status);
|
|
}
|