mirror of
https://github.com/ARMSX2/ARMSX1.git
synced 2026-08-24 16:53:35 -07:00
Merge GitHub Actions work
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
name: macOS CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install SDL2 and dylibbundler
|
||||
run: |
|
||||
brew install sdl2
|
||||
brew install dylibbundler
|
||||
- name: Build and pack PSXE
|
||||
run: |
|
||||
./build.sh
|
||||
mkdir -p psxe
|
||||
mv psxe.app psxe
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: psxe-macos-latest
|
||||
path: psxe/
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Ubuntu CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install SDL2
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libsdl2-dev
|
||||
- name: make
|
||||
run: make
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: psxe-ubuntu-latest
|
||||
path: bin/psxe
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Windows CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run build-deps
|
||||
run: ./build-deps.ps1
|
||||
- name: 64-bit build
|
||||
run: |
|
||||
./build-win64.ps1
|
||||
New-Item -Path "psxe" -ItemType Directory
|
||||
Copy-Item -Recurse "bin" -Destination "psxe"
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: psxe-win64-latest
|
||||
path: psxe/
|
||||
- name: Cleanup
|
||||
run: ./build-clean
|
||||
- name: 32-bit build
|
||||
run: |
|
||||
Remove-Item -Path psxe -Recurse
|
||||
./build-win32.ps1
|
||||
New-Item -Path "psxe" -ItemType Directory
|
||||
Copy-Item -Recurse "bin" -Destination "psxe"
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: psxe-win32-latest
|
||||
path: psxe/
|
||||
+4
-1
@@ -5,9 +5,12 @@ imgui/
|
||||
res/
|
||||
sdl2/
|
||||
SDL2-2.26.5/
|
||||
sdl2-win32/
|
||||
sdl2-win64/
|
||||
test/
|
||||
*.bin
|
||||
*.dll
|
||||
*.exe
|
||||
*.out
|
||||
*.toml
|
||||
*.toml
|
||||
*.zip
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>psxe</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>psxe.app.0</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>psxe</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1-alpha</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>psxe</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.1-alpha</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -17,7 +17,8 @@ bin/psxe frontend/main.c:
|
||||
-DREP_VERSION="$(VERSION_TAG)" \
|
||||
-DREP_COMMIT_HASH="$(COMMIT_HASH)" \
|
||||
-g -DLOG_USE_COLOR -lSDL2 -lSDL2main \
|
||||
-Ofast -Wno-overflow -Wall -pedantic
|
||||
-Ofast -Wno-overflow -Wall -pedantic \
|
||||
-Wno-newline-eof
|
||||
|
||||
clean:
|
||||
rm -rf "bin"
|
||||
|
||||
+13
-5
@@ -2,11 +2,19 @@ if (Test-Path "SDL2-2.26.5") {
|
||||
Remove-Item -Recurse "SDL2-2.26.5"
|
||||
}
|
||||
|
||||
$URL = "https://github.com/libsdl-org/SDL/releases/download/release-2.26.5/SDL2-devel-2.26.5-mingw.zip"
|
||||
$SDL2_URL = "https://github.com/libsdl-org/SDL/releases/download/release-2.26.5/SDL2-devel-2.26.5-mingw.zip"
|
||||
$WIN32_URL = "https://github.com/libsdl-org/SDL/releases/download/release-2.26.5/SDL2-2.26.5-win32-x86.zip"
|
||||
$WIN64_URL = "https://github.com/libsdl-org/SDL/releases/download/release-2.26.5/SDL2-2.26.5-win32-x64.zip"
|
||||
|
||||
Invoke-WebRequest -URI $URL -OutFile "sdl2.zip"
|
||||
Expand-Archive "sdl2.zip" -DestinationPath "."
|
||||
Invoke-WebRequest -URI $SDL2_URL -OutFile "sdl2.zip"
|
||||
Expand-Archive "sdl2.zip" -DestinationPath "." -Force
|
||||
|
||||
Invoke-WebRequest -URI $WIN32_URL -OutFile "sdl2-win32.zip"
|
||||
Expand-Archive "sdl2-win32.zip" -DestinationPath "sdl2-win32" -Force
|
||||
|
||||
Invoke-WebRequest -URI $WIN64_URL -OutFile "sdl2-win64.zip"
|
||||
Expand-Archive "sdl2-win64.zip" -DestinationPath "sdl2-win64" -Force
|
||||
|
||||
Remove-Item "sdl2.zip"
|
||||
|
||||
Copy-Item -Path "SDL2-2.26.5\x86_64-w64-mingw32\bin\SDL2.dll" -Destination .
|
||||
Remove-Item "sdl2-win32.zip"
|
||||
Remove-Item "sdl2-win64.zip"
|
||||
@@ -0,0 +1,25 @@
|
||||
$VERSION_TAG = git describe --always --tags --abbrev=0
|
||||
$COMMIT_HASH = git rev-parse --short HEAD
|
||||
$OS_INFO = (Get-WMIObject win32_operatingsystem).caption + " " + (Get-WMIObject win32_operatingsystem).version + " " + (Get-WMIObject win32_operatingsystem).OSArchitecture
|
||||
|
||||
$SDL2_DIR = "SDL2-2.26.5\x86_64-w64-mingw32"
|
||||
$PSX_DIR = "."
|
||||
|
||||
mkdir -Force -Path bin > $null
|
||||
|
||||
gcc -I"`"$($PSX_DIR)`"" `
|
||||
-I"`"$($SDL2_DIR)\include`"" `
|
||||
-I"`"$($SDL2_DIR)\include\SDL2`"" `
|
||||
"psx\*.c" `
|
||||
"psx\dev\*.c" `
|
||||
"frontend\*.c" `
|
||||
-o "bin\psxe.exe" `
|
||||
-DREP_VERSION="`"$($VERSION_TAG)`"" `
|
||||
-DREP_COMMIT_HASH="`"$($COMMIT_HASH)`"" `
|
||||
-DOS_INFO="`"$($OS_INFO)`"" `
|
||||
-L"`"$($SDL2_DIR)\lib`"" `
|
||||
-lSDL2main -lSDL2 -Wno-overflow `
|
||||
-Wall -pedantic -DLOG_USE_COLOR `
|
||||
-ffast-math -Ofast
|
||||
|
||||
Copy-Item -Path "sdl2-win32/SDL2.dll" -Destination "bin"
|
||||
@@ -0,0 +1,25 @@
|
||||
$VERSION_TAG = git describe --always --tags --abbrev=0
|
||||
$COMMIT_HASH = git rev-parse --short HEAD
|
||||
$OS_INFO = (Get-WMIObject win32_operatingsystem).caption + " " + (Get-WMIObject win32_operatingsystem).version + " " + (Get-WMIObject win32_operatingsystem).OSArchitecture
|
||||
|
||||
$SDL2_DIR = "SDL2-2.26.5\x86_64-w64-mingw32"
|
||||
$PSX_DIR = "."
|
||||
|
||||
mkdir -Force -Path bin > $null
|
||||
|
||||
gcc -I"`"$($PSX_DIR)`"" `
|
||||
-I"`"$($SDL2_DIR)\include`"" `
|
||||
-I"`"$($SDL2_DIR)\include\SDL2`"" `
|
||||
"psx\*.c" `
|
||||
"psx\dev\*.c" `
|
||||
"frontend\*.c" `
|
||||
-o "bin\psxe.exe" `
|
||||
-DREP_VERSION="`"$($VERSION_TAG)`"" `
|
||||
-DREP_COMMIT_HASH="`"$($COMMIT_HASH)`"" `
|
||||
-DOS_INFO="`"$($OS_INFO)`"" `
|
||||
-L"`"$($SDL2_DIR)\lib`"" `
|
||||
-m64 -lSDL2main -lSDL2 -Wno-overflow `
|
||||
-Wall -pedantic -DLOG_USE_COLOR `
|
||||
-ffast-math -Ofast
|
||||
|
||||
Copy-Item -Path "sdl2-win64/SDL2.dll" -Destination "bin"
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Build emulator
|
||||
make clean && make
|
||||
|
||||
# Create bundle filesystem
|
||||
mkdir -p psxe.app/Contents/MacOS/Libraries
|
||||
|
||||
# Move executable to folder
|
||||
mv bin/psxe psxe.app/Contents/MacOS
|
||||
|
||||
# Make executable
|
||||
chmod 777 psxe.app/Contents/MacOS/psxe
|
||||
|
||||
# Bundle required dylibs
|
||||
dylibbundler -b -x ./psxe.app/Contents/MacOS/psxe -d ./psxe.app/Contents/Libraries/ -p @executable_path/../Libraries/ -cd
|
||||
|
||||
# Move plist to Contents folder
|
||||
mv Info.plist psxe.app/Contents/Info.plist
|
||||
+17
-1
@@ -21,9 +21,13 @@ void psxe_screen_init(psxe_screen_t* screen, psx_t* psx) {
|
||||
screen->psx = psx;
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
||||
|
||||
SDL_SetHint("SDL_HINT_RENDER_SCALE_QUALITY", "2");
|
||||
}
|
||||
|
||||
void psxe_screen_reload(psxe_screen_t* screen) {
|
||||
SDL_SetHint("SDL_HINT_RENDER_SCALE_QUALITY", "2");
|
||||
|
||||
if (screen->texture) SDL_DestroyTexture(screen->texture);
|
||||
if (screen->renderer) SDL_DestroyRenderer(screen->renderer);
|
||||
if (screen->window) SDL_DestroyWindow(screen->window);
|
||||
@@ -33,7 +37,7 @@ void psxe_screen_reload(psxe_screen_t* screen) {
|
||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
screen->width * screen->scale,
|
||||
screen->height * screen->scale,
|
||||
SDL_WINDOW_OPENGL
|
||||
SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI
|
||||
);
|
||||
|
||||
screen->renderer = SDL_CreateRenderer(
|
||||
@@ -49,6 +53,18 @@ void psxe_screen_reload(psxe_screen_t* screen) {
|
||||
PSX_GPU_FB_WIDTH, PSX_GPU_FB_HEIGHT
|
||||
);
|
||||
|
||||
// Check for retina displays
|
||||
int width = 0, height = 0;
|
||||
|
||||
SDL_GetRendererOutputSize(screen->renderer, &width, &height);
|
||||
|
||||
if (width != (screen->width * screen->scale)) {
|
||||
float width_scale = (float)width / (float)(screen->width * screen->scale);
|
||||
float height_scale = (float)height / (float)(screen->height * screen->scale);
|
||||
|
||||
SDL_RenderSetScale(screen->renderer, width_scale, height_scale);
|
||||
}
|
||||
|
||||
screen->open = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user