-
Notifications
You must be signed in to change notification settings - Fork 13
Linux sdl port #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zeroz41
wants to merge
2
commits into
elliotttate:main
Choose a base branch
from
zeroz41:linux-sdl-port
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+323
−13
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [[ "$(uname -s)" != "Linux" ]]; then | ||
| echo "error: build_linux.sh must run on Linux" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| repo_dir="$(cd "$(dirname "$0")" && pwd)" | ||
| build_dir="$repo_dir/build/linux" | ||
| rom_path="${1:-${DKC1_ROM:-}}" | ||
|
|
||
| for tool in cc cmake ninja sdl2-config python3; do | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When private sources are absent and no prebuilt analyzer exists, first-time generation requires Cargo, but this dependency check omits it. Check Cargo or the prebuilt analyzer before generation and include the missing prerequisite in the error guidance. Prompt for AI agents |
||
| if ! command -v "$tool" >/dev/null 2>&1; then | ||
| echo "error: missing required tool: $tool" >&2 | ||
| echo "Install a C compiler, CMake, Ninja, Python 3, and SDL2 development files." >&2 | ||
| exit 2 | ||
| fi | ||
| done | ||
|
|
||
| if [[ ! -f "$repo_dir/snesrecomp/runner/runner.cmake" ]]; then | ||
| echo "error: snesrecomp is not initialized" >&2 | ||
| echo "run: git submodule update --init --recursive" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| if ! compgen -G "$repo_dir/generated/snesrecomp/*.c" >/dev/null; then | ||
| if [[ -z "$rom_path" ]]; then | ||
| echo "error: private generated sources are missing" >&2 | ||
| echo "usage: ./build_linux.sh '/path/to/Donkey Kong Country (USA).sfc'" >&2 | ||
| exit 2 | ||
| fi | ||
| python3 "$repo_dir/scripts/generate_snesrecomp.py" --rom "$rom_path" | ||
| fi | ||
|
|
||
| cmake -S "$repo_dir" -B "$build_dir" -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DSNESRECOMP_SDL_BACKEND=SDL2 \ | ||
| -DCMAKE_PREFIX_PATH="$(sdl2-config --prefix)" | ||
| cmake --build "$build_dir" \ | ||
| --target dkc1_snesrecomp_sdl dkc1_snesrecomp_headless --parallel | ||
|
|
||
| echo "LINUX_BUILD_OK" | ||
| echo "$build_dir/DKC1Recomp" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| #include "macos_file_picker.h" | ||
| #include "macos_metal_presenter.h" | ||
|
|
||
| #include <stddef.h> | ||
|
|
||
| /* The SDL frontend is shared with macOS, where these entry points provide | ||
| * native menus, file pickers, preferences, and display-linked Metal output. | ||
| * Linux deliberately keeps the command-line/environment configuration and | ||
| * ordinary SDL renderer path, so its platform adapters are inert. */ | ||
|
|
||
| char *Dkc1MacChooseRom(void) { return NULL; } | ||
| char *Dkc1MacChooseBabyKongRom(void) { return NULL; } | ||
| char *Dkc1MacSavedBabyKongRom(void) { return NULL; } | ||
| void Dkc1MacSetBabyKongRom(const char *path) { (void)path; } | ||
| int Dkc1MacSavedBabyKongEnabled(void) { return 0; } | ||
| void Dkc1MacSetBabyKongEnabled(int enabled) { (void)enabled; } | ||
|
|
||
| char *Dkc1MacChooseMsu1(void) { return NULL; } | ||
| char *Dkc1MacSavedMsu1(void) { return NULL; } | ||
| void Dkc1MacClearMsu1(void) {} | ||
|
|
||
| Dkc1MacFullscreenScaling Dkc1MacSavedFullscreenScaling(void) { | ||
| return kDkc1MacFullscreenSharpBilinear; | ||
| } | ||
|
|
||
| void Dkc1MacSetFullscreenScaling(Dkc1MacFullscreenScaling scaling) { | ||
| (void)scaling; | ||
| } | ||
|
|
||
| Dkc1EdgePolicy Dkc1MacSavedWidescreenEdge(void) { | ||
| return kDkc1EdgeGlide; | ||
| } | ||
|
|
||
| void Dkc1MacSetWidescreenEdge(Dkc1EdgePolicy policy) { (void)policy; } | ||
|
|
||
| void Dkc1MacInstallMenu(void) {} | ||
|
|
||
| void Dkc1MacUpdateMenuState(int paused, int fullscreen, | ||
| Dkc1MacFullscreenScaling fullscreen_scaling, | ||
| Dkc1VideoAspect aspect, Dkc1EdgePolicy edge, | ||
| unsigned char layer_mask, int provenance, | ||
| int replacement_music, int baby_kong_enabled, | ||
| int baby_kong_ready) { | ||
| (void)paused; | ||
| (void)fullscreen; | ||
| (void)fullscreen_scaling; | ||
| (void)aspect; | ||
| (void)edge; | ||
| (void)layer_mask; | ||
| (void)provenance; | ||
| (void)replacement_music; | ||
| (void)baby_kong_enabled; | ||
| (void)baby_kong_ready; | ||
| } | ||
|
|
||
| int Dkc1MacDisplayLinkStart(void *native_window, double preferred_fps) { | ||
| (void)native_window; | ||
| (void)preferred_fps; | ||
| return 0; | ||
| } | ||
|
|
||
| int Dkc1MacDisplayLinkWait(unsigned long long after_callback_number, | ||
| double timeout_seconds, double *timestamp, | ||
| double *target_timestamp, double *duration, | ||
| unsigned long long *callback_number) { | ||
| (void)after_callback_number; | ||
| (void)timeout_seconds; | ||
| (void)timestamp; | ||
| (void)target_timestamp; | ||
| (void)duration; | ||
| (void)callback_number; | ||
| return 0; | ||
| } | ||
|
|
||
| void Dkc1MacDisplayLinkStop(void) {} | ||
|
|
||
| int Dkc1MacMetalPresenterStart(void *native_window, double preferred_hz, | ||
| Dkc1MacFullscreenScaling scaling, | ||
| int fullscreen) { | ||
| (void)native_window; | ||
| (void)preferred_hz; | ||
| (void)scaling; | ||
| (void)fullscreen; | ||
| return 0; | ||
| } | ||
|
|
||
| void Dkc1MacMetalPresenterQueueFrame( | ||
| const uint32_t *pixels, int width, int height, int presentation_width, | ||
| const Dkc1MacPresentationFrameInfo *info) { | ||
| (void)pixels; | ||
| (void)width; | ||
| (void)height; | ||
| (void)presentation_width; | ||
| (void)info; | ||
| } | ||
|
|
||
| void Dkc1MacMetalPresenterSetGeometry(int presentation_width, | ||
| int fullscreen) { | ||
| (void)presentation_width; | ||
| (void)fullscreen; | ||
| } | ||
|
|
||
| void Dkc1MacMetalPresenterSetScaling(Dkc1MacFullscreenScaling scaling) { | ||
| (void)scaling; | ||
| } | ||
|
|
||
| void Dkc1MacMetalPresenterSetActive(int active) { (void)active; } | ||
| void Dkc1MacMetalPresenterStop(void) {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The documented Linux build-and-run sequence exits immediately because the executable has no ROM path. Pass the ROM path to the executable as well, or set
DKC1_ROMfor the run command.Prompt for AI agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed