Replace React Native frontend with FSUI integration

This commit is contained in:
moonpower
2026-04-04 22:08:46 +02:00
parent 4d520d1ccd
commit 01a308dd44
68 changed files with 3753 additions and 40832 deletions
Vendored
BIN
View File
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

+3 -3
View File
@@ -1,6 +1,6 @@
[submodule "third_party/imgui"]
path = third_party/imgui
url = https://github.com/ocornut/imgui
[submodule "third_party/SDL"]
path = third_party/SDL
url = https://github.com/libsdl-org/SDL.git
[submodule "third_party/fsui-lib"]
path = third_party/fsui-lib
url = https://git.nanodata.cloud/moonpower/fsui-lib.git
+73 -29
View File
@@ -9,7 +9,7 @@ SDL_STATIC := 0
SDL_CFLAGS := -sUSE_SDL=2
SDL_LIBS_DYNAMIC :=
SDL_LIBS_STATIC :=
WASM_LDFLAGS := -sUSE_SDL=2 -sALLOW_MEMORY_GROWTH=1 -sASSERTIONS=1 -sFORCE_FILESYSTEM=1 -sEXPORTED_RUNTIME_METHODS='["FS","ccall","cwrap"]' -sEXPORTED_FUNCTIONS='["_main","_psxe_run","_external_main","_psxe_wasm_on_file"]'
WASM_LDFLAGS := -sUSE_SDL=2 -sALLOW_MEMORY_GROWTH=1 -sASSERTIONS=1 -sFORCE_FILESYSTEM=1 -sFULL_ES3=1 -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sNO_EXIT_RUNTIME=0 -sEXPORTED_RUNTIME_METHODS='["FS","ccall","cwrap"]' -sEXPORTED_FUNCTIONS='["_main","_psxe_run","_external_main","_psxe_wasm_on_file"]'
endif
SDL_CONFIG ?= sdl2-config
@@ -30,11 +30,16 @@ endif
IOS_TARGET ?= 0
IOS_SDK ?= iphoneos
IOS_DEPLOYMENT_TARGET ?= 14.0
MACOS_DEPLOYMENT_TARGET ?= 10.15
WINDOWS_TARGET ?= 0
UWP_TARGET ?= 0
IOS_SDL_FRAMEWORK ?= $(CURDIR)/ios/Frameworks/SDL2.xcframework/ios-arm64/SDL2.framework
IOS_SDL_FRAMEWORK_PARENT := $(dir $(IOS_SDL_FRAMEWORK))
SDKROOT ?=
IMGUI_FRONTEND ?= 0
CONTROLLER_GENERIC ?= 0
FSUI_DIR := third_party/fsui-lib
FSUI_BUILD_DIR ?= build/fsui/native
WASM_HTML_POSTPROCESS := $(FSUI_DIR)/cmake/postprocess_web_html.cmake
ifeq ($(IOS_TARGET),1)
SDKROOT ?= $(shell xcrun --sdk $(IOS_SDK) --show-sdk-path)
@@ -53,13 +58,30 @@ endif
BASE_CFLAGS = -g -DLOG_USE_COLOR -I"." -I"psx" $(SDL_CFLAGS)
BASE_CFLAGS += -O3 -ffast-math -Wno-overflow -Wall -pedantic -Wno-address-of-packed-member -flto
BASE_CXXFLAGS = -std=c++17 $(BASE_CFLAGS)
FSUI_INCLUDE_FLAGS = \
-I$(FSUI_DIR)/include \
-I$(FSUI_DIR)/third_party/imgui \
-I$(FSUI_DIR)/third_party/imgui/backends \
-I$(FSUI_DIR)/third_party/stb
ifneq ($(WASM_TARGET),wasm)
FSUI_INCLUDE_FLAGS += -I$(FSUI_BUILD_DIR)/gladsources/fsui_glad/include
endif
FSUI_COMPILE_DEFS = -DIMGUI_FRONTEND -DFSUI_HAS_SDL2_PLATFORM -DFSUI_HAS_SDL2SURFACE_RENDERER -DFSUI_HAS_SDL2RENDERER_RENDERER -DSDL_MAIN_HANDLED
BASE_CXXFLAGS = -std=c++20 $(BASE_CFLAGS) $(FSUI_INCLUDE_FLAGS) $(FSUI_COMPILE_DEFS)
ifeq ($(CONTROLLER_GENERIC),1)
BASE_CFLAGS += -DCONTROLLER_GENERIC
BASE_CXXFLAGS += -DCONTROLLER_GENERIC
endif
ifeq ($(UWP_TARGET),1)
BASE_CFLAGS += -DUWP_TARGET
BASE_CXXFLAGS += -DUWP_TARGET
endif
ifeq ($(WASM_TARGET),wasm)
BASE_CFLAGS := $(filter-out -flto,$(BASE_CFLAGS))
BASE_CXXFLAGS := $(filter-out -flto,$(BASE_CXXFLAGS))
@@ -70,17 +92,6 @@ ifeq ($(IOS_TARGET),1)
BASE_CXXFLAGS += -fembed-bitcode
endif
ifeq ($(IMGUI_FRONTEND),1)
ifneq ($(IOS_TARGET),1)
ifneq ($(filter shared,$(MAKECMDGOALS)),)
$(warning IMGUI_FRONTEND is disabled for shared builds)
else
BASE_CFLAGS += -DIMGUI_FRONTEND
BASE_CXXFLAGS += -DIMGUI_FRONTEND
endif
endif
endif
ifeq ($(WASM_TARGET),wasm)
OS_INFO := Emscripten
else ifneq ($(IOS_TARGET),1)
@@ -91,7 +102,8 @@ endif
ifeq ($(PLATFORM),Darwin)
ifneq ($(IOS_TARGET),1)
BASE_CFLAGS += -mmacosx-version-min=10.9 -Wno-newline-eof
BASE_CFLAGS += -mmacosx-version-min=$(MACOS_DEPLOYMENT_TARGET) -Wno-newline-eof
BASE_CXXFLAGS += -mmacosx-version-min=$(MACOS_DEPLOYMENT_TARGET)
endif
endif
@@ -103,6 +115,8 @@ SHARED_CXXFLAGS := $(BASE_CXXFLAGS) -D__DLL_BUILD -fPIC
ifeq ($(PLATFORM),Darwin)
SHARED_EXT := .dylib
SHARED_LDFLAGS := -dynamiclib
else ifeq ($(WINDOWS_TARGET),1)
SHARED_EXT := .dll
endif
ifeq ($(IOS_TARGET),1)
@@ -123,26 +137,55 @@ OBJ_DIR := $(BIN_DIR)/obj
BIN := $(BIN_DIR)/armsx
ifeq ($(WASM_TARGET),wasm)
BIN := $(BIN_DIR)/armsx.html
else ifeq ($(WINDOWS_TARGET),1)
BIN := $(BIN_DIR)/armsx.exe
endif
SHARED_BIN := $(BIN_DIR)/libarmsx$(SHARED_EXT)
IMGUI_DIR := third_party/imgui
C_SOURCES := $(wildcard psx/*.c) \
$(wildcard psx/dev/*.c) \
$(wildcard psx/dev/cdrom/*.c) \
$(wildcard psx/input/*.c) \
$(wildcard psx/disc/*.c) \
$(wildcard frontend/*.c)
frontend/argparse.c \
frontend/config.c \
frontend/toml.c
C_SOURCES_SHARED := $(C_SOURCES)
CPP_SOURCES := frontend/imgui_layer.cpp \
$(IMGUI_DIR)/imgui.cpp \
$(IMGUI_DIR)/imgui_draw.cpp \
$(IMGUI_DIR)/imgui_tables.cpp \
$(IMGUI_DIR)/imgui_widgets.cpp \
$(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp \
$(IMGUI_DIR)/backends/imgui_impl_sdlrenderer2.cpp
CPP_SOURCES := frontend/main.cpp
FSUI_LIBS := \
$(FSUI_BUILD_DIR)/libfsui-donor.a \
$(FSUI_BUILD_DIR)/libfsui-backend-sdl.a \
$(FSUI_BUILD_DIR)/libfsui-platform-sdl2.a \
$(FSUI_BUILD_DIR)/libfsui-renderer-sdl2.a \
$(FSUI_BUILD_DIR)/libfsui-renderer-sdl2surface.a \
$(FSUI_BUILD_DIR)/libfsui-renderer-opengl.a \
$(FSUI_BUILD_DIR)/libfsui-core.a \
$(FSUI_BUILD_DIR)/libfsui_imgui.a \
$(FSUI_BUILD_DIR)/libfsui_resources.a
ifneq ($(WASM_TARGET),wasm)
FSUI_LIBS += \
$(FSUI_BUILD_DIR)/libfsui_glad.a
endif
PLATFORM_EXTRA_LDFLAGS :=
PLATFORM_EXTRA_LIBS :=
ifeq ($(PLATFORM),Darwin)
FSUI_LIBS += $(FSUI_BUILD_DIR)/libfsui-renderer-metal.a
ifeq ($(IOS_TARGET),1)
PLATFORM_EXTRA_LIBS += -framework Foundation -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit
else
PLATFORM_EXTRA_LDFLAGS += -mmacosx-version-min=$(MACOS_DEPLOYMENT_TARGET)
PLATFORM_EXTRA_LIBS += -framework Cocoa -framework Foundation -framework IOKit -framework Metal -framework OpenGL -framework QuartzCore
endif
else ifeq ($(WINDOWS_TARGET),1)
PLATFORM_EXTRA_LIBS += -lsetupapi -limm32 -lversion -lwinmm -lgdi32 -lole32 -loleaut32 -lshell32 -luuid -lopengl32
else ifneq ($(WASM_TARGET),wasm)
PLATFORM_EXTRA_LIBS += -ldl -lGL
endif
C_OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(C_SOURCES))
C_OBJS_SHARED := $(patsubst %.c,$(OBJ_DIR)/%.o,$(C_SOURCES_SHARED))
@@ -189,17 +232,18 @@ $(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
$(OBJ_DIR)/%.o: %.cpp | $(OBJ_DIR)
mkdir -p $(dir $@)
$(CXX) -c $< -o $@ $(BASE_CXXFLAGS) \
-I$(IMGUI_DIR) \
-I$(IMGUI_DIR)/backends \
-DOS_INFO="$(OS_INFO)" \
-DREP_VERSION="$(VERSION_TAG)" \
-DREP_COMMIT_HASH="$(COMMIT_HASH)"
$(BIN): $(ALL_OBJS) | $(BIN_DIR)
$(CXX) $(ALL_OBJS) -o $(BIN) $(SDL_LIBS) $(WASM_LDFLAGS)
$(CXX) $(ALL_OBJS) $(FSUI_LIBS) -o $(BIN) $(SDL_LIBS) $(PLATFORM_EXTRA_LDFLAGS) $(PLATFORM_EXTRA_LIBS) $(WASM_LDFLAGS)
ifeq ($(WASM_TARGET),wasm)
cmake -DINPUT_FILE="$(BIN)" -P "$(WASM_HTML_POSTPROCESS)"
endif
$(SHARED_BIN): $(ALL_OBJS_SHARED) | $(BIN_DIR)
$(CXX) $(SHARED_LDFLAGS) $(ALL_OBJS_SHARED) -o $(SHARED_BIN) $(SDL_LIBS_SHARED)
$(CXX) $(SHARED_LDFLAGS) $(ALL_OBJS_SHARED) $(FSUI_LIBS) -o $(SHARED_BIN) $(SDL_LIBS_SHARED) $(PLATFORM_EXTRA_LDFLAGS) $(PLATFORM_EXTRA_LIBS)
clean:
rm -rf "$(BIN_DIR)"
+1 -1
View File
@@ -22,7 +22,7 @@ Most BIOS versions are confirmed to work.
Use the `-b` or `--bios` setting to configure the BIOS file.
## Progress
All components have been implemented, Memory card support is temporarily disabled.
All major components have been implemented, including memory card support.
<img src="https://github.com/allkern/psxe/assets/15825466/199c20e4-4e7e-4d0a-a033-eda347034ed5" width="12" height="12"/> CPU </br>
<img src="https://github.com/allkern/psxe/assets/15825466/199c20e4-4e7e-4d0a-a033-eda347034ed5" width="12" height="12"/> DMA </br>
+3 -4
View File
@@ -1,10 +1,9 @@
- restore memory card
- add WASM target
- add Android target
- add full screen ui imgui with IMGUI_TV_FRONTEND optimized for controllers (heavily inspired by PCSX2 Full Screen UI)
- finish RN/SwiftUI/appkit/xml for mobile devices with on screen controls (Probably RN brownfield at version 0.76 for android and ios)
- polish the FSUI donor shell controller-first flows across platforms
- add touch-first FSUI interactions for mobile devices without reintroducing a separate native UI stack
- add save states
- finish the imgui frontend on PCs
- finish the FSUI donor frontend on PCs
- finish the UWP target
- finish the vita target
- add the switch target
-24
View File
@@ -2,15 +2,6 @@ plugins {
id 'com.android.application'
}
apply from: file('../react-native-plugin.gradle')
ext {
hermesEnabled = true
react = [
enableHermes: true
]
}
android {
namespace 'com.nanodata.armsx'
compileSdk rootProject.ext.compileSdkVersion
@@ -70,23 +61,8 @@ android {
}
}
react {
root = file('..')
reactNativeDir = file('../node_modules/react-native')
cliFile = file('../node_modules/react-native/cli.js')
entryFile = file('../mobile/index.js')
}
def nativeModulesAppGradle = file('../node_modules/@react-native-community/cli-platform-android/native_modules.gradle')
if (nativeModulesAppGradle.isFile()) {
apply from: nativeModulesAppGradle
applyNativeModulesAppBuildGradle(project)
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.facebook.react:react-android:0.76.0'
implementation 'com.facebook.react:hermes-android:0.76.0'
}
def repoRootDir = rootProject.projectDir.parentFile
+5 -16
View File
@@ -1,36 +1,25 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nanodata.armsx">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="android.app.Application"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity
android:name=".OverlayActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:name=".EmulatorActivity"
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
android:screenOrientation="sensorLandscape"
android:resizeableActivity="false"
android:theme="@style/AppTheme.NoOverlay">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EmulatorActivity"
android:exported="false"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:screenOrientation="sensorLandscape"
android:resizeableActivity="false"
android:theme="@style/AppTheme.NoOverlay" />
</application>
</manifest>
@@ -1,75 +0,0 @@
package com.nanodata.armsx;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import java.util.ArrayList;
import java.util.List;
public class ARMSXModule extends ReactContextBaseJavaModule {
public static final String NAME = "ARMSXModule";
public ARMSXModule(ReactApplicationContext reactContext) {
super(reactContext);
}
@NonNull
@Override
public String getName() {
return NAME;
}
@ReactMethod
public void loadEmu(@Nullable ReadableArray args, Promise promise) {
Activity host = getCurrentActivity();
if (host == null) {
promise.reject("no_activity", "Activity not available");
return;
}
forceLandscapeInternal(host);
Intent intent = new Intent(host, EmulatorActivity.class);
intent.putExtra(EmulatorActivity.EXTRA_NATIVE_ARGS, readableArrayToStrings(args));
host.startActivity(intent);
promise.resolve(true);
}
@ReactMethod
public void forceLandscape(Promise promise) {
Activity host = getCurrentActivity();
if (host == null) {
promise.reject("no_activity", "Activity not available");
return;
}
forceLandscapeInternal(host);
promise.resolve(true);
}
private void forceLandscapeInternal(@NonNull Activity host) {
host.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
private @Nullable String[] readableArrayToStrings(@Nullable ReadableArray array) {
if (array == null) {
return null;
}
List<String> values = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
if (!array.isNull(i)) {
values.add(array.getString(i));
}
}
return values.isEmpty() ? null : values.toArray(new String[0]);
}
}
@@ -1,28 +0,0 @@
package com.nanodata.armsx;
import androidx.annotation.NonNull;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ARMSXPackage implements ReactPackage {
@NonNull
@Override
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new ARMSXModule(reactContext));
return modules;
}
@NonNull
@Override
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
@@ -1,135 +0,0 @@
package com.nanodata.armsx;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactInstanceManagerBuilder;
import com.facebook.react.ReactPackage;
import com.facebook.react.ReactRootView;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.shell.MainReactPackage;
import java.util.ArrayList;
import java.util.List;
public class OverlayActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
private ReactRootView reactRootView;
private ReactInstanceManager reactInstanceManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mountReactSurface();
}
private void mountReactSurface() {
if (reactRootView != null && reactInstanceManager != null) {
setContentView(reactRootView);
return;
}
try {
reactRootView = new ReactRootView(this);
ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
.setApplication(getApplication())
.setCurrentActivity(this)
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED);
List<ReactPackage> packages = new ArrayList<>();
packages.add(new MainReactPackage());
packages.add(new ARMSXPackage());
for (ReactPackage reactPackage : packages) {
builder.addPackage(reactPackage);
}
if (BuildConfig.DEBUG) {
builder.setJSMainModulePath("mobile/index");
} else {
builder.setBundleAssetName("index.android.bundle");
}
reactInstanceManager = builder.build();
reactRootView.startReactApplication(reactInstanceManager, "ARMSXOverlay", null);
setContentView(reactRootView);
} catch (Throwable throwable) {
TextView fallback = new TextView(this);
fallback.setGravity(Gravity.CENTER);
fallback.setText("React Native failed to load. Connect Metro and reload.");
setContentView(fallback);
}
}
@Override
protected void onResume() {
super.onResume();
if (reactInstanceManager != null) {
reactInstanceManager.onHostResume(this, this);
}
}
@Override
protected void onPause() {
super.onPause();
if (reactInstanceManager != null) {
reactInstanceManager.onHostPause(this);
}
}
@Override
protected void onStop() {
super.onStop();
if (!isChangingConfigurations()) {
teardownReact();
}
}
@Override
protected void onDestroy() {
teardownReact();
super.onDestroy();
}
private void teardownReact() {
if (reactRootView != null) {
reactRootView.unmountReactApplication();
reactRootView = null;
}
if (reactInstanceManager != null) {
reactInstanceManager.onHostDestroy(this);
reactInstanceManager.destroy();
reactInstanceManager = null;
}
}
@Override
public void invokeDefaultOnBackPressed() {
teardownReact();
finish();
}
@Override
public void onBackPressed() {
if (reactInstanceManager != null) {
reactInstanceManager.onBackPressed();
} else {
super.onBackPressed();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (reactInstanceManager != null) {
reactInstanceManager.onActivityResult(this, requestCode, resultCode, data);
}
}
}
-3
View File
@@ -14,8 +14,6 @@ plugins {
id 'com.android.library' version '8.5.2' apply false
}
apply plugin: 'com.facebook.react.rootproject'
ext {
minSdkVersion = 26
targetSdkVersion = 34
@@ -28,7 +26,6 @@ allprojects { project ->
repositories {
google()
mavenCentral()
maven { url "$rootDir/../node_modules/react-native/android" }
}
configurations.all { config ->
-1
View File
@@ -1 +0,0 @@
apply plugin: "com.facebook.react"
-8
View File
@@ -4,7 +4,6 @@ pluginManagement {
google()
mavenCentral()
}
includeBuild("../node_modules/@react-native/gradle-plugin")
}
dependencyResolutionManagement {
@@ -12,15 +11,8 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url("$rootDir/../node_modules/react-native/android") }
}
}
rootProject.name = "ARMSX"
include(":app")
def nativeModulesSettingsFile = file('../node_modules/@react-native-community/cli-platform-android/native_modules.gradle')
if (nativeModulesSettingsFile.isFile()) {
apply from: nativeModulesSettingsFile
applyNativeModulesSettingsGradle(settings)
}
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
+81
View File
@@ -0,0 +1,81 @@
param(
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Debug",
[ValidateSet("x64", "x86")]
[string]$Platform = "x64"
)
$ErrorActionPreference = "Stop"
$RepoRoot = (Resolve-Path $PSScriptRoot).Path
Set-Location $RepoRoot
switch ($Platform) {
"x64" {
$SDL2Dir = "SDL2-2.30.3\x86_64-w64-mingw32"
$FsuiBuildDir = Join-Path $RepoRoot "build\fsui\uwp-x64"
}
"x86" {
$SDL2Dir = "SDL2-2.30.3\i686-w64-mingw32"
$FsuiBuildDir = Join-Path $RepoRoot "build\fsui\uwp-x86"
}
default {
throw "Unsupported UWP platform '$Platform'."
}
}
$SDL2Root = Join-Path $RepoRoot $SDL2Dir
$SDL2Include = Join-Path $SDL2Root "include\SDL2"
$SDL2Lib = Join-Path $SDL2Root "lib"
$SDL2Dll = Join-Path $SDL2Root "bin\SDL2.dll"
$NativeStageDir = Join-Path $RepoRoot "uwp\deps\bin"
$UwpOutputDir = Join-Path $RepoRoot ("uwp\ARMSX\bin\{0}\{1}" -f $Platform, $Configuration)
$SolutionPath = Join-Path $RepoRoot "uwp\ARMSX.sln"
if (!(Test-Path $SDL2Root)) {
throw "SDL2 dependency directory not found at $SDL2Root. Reuse the existing MinGW SDL package or override the script."
}
$MakeCommand = Get-Command "mingw32-make" -ErrorAction SilentlyContinue
if (-not $MakeCommand) {
$MakeCommand = Get-Command "make" -ErrorAction SilentlyContinue
}
if (-not $MakeCommand) {
throw "Unable to locate mingw32-make or make in PATH."
}
$MsBuildCommand = Get-Command "MSBuild.exe" -ErrorAction SilentlyContinue
if (-not $MsBuildCommand) {
$MsBuildCommand = Get-Command "msbuild" -ErrorAction SilentlyContinue
}
if (-not $MsBuildCommand) {
throw "Unable to locate MSBuild in PATH."
}
New-Item -ItemType Directory -Force -Path bin, $NativeStageDir, $UwpOutputDir | Out-Null
cmake -S third_party/fsui-lib -B $FsuiBuildDir -G "MinGW Makefiles" `
-DFSUI_BUILD_SAMPLES=OFF `
-DFSUI_PLATFORM_BACKEND=SDL2 `
-DFSUI_USE_SYSTEM_SDL2=ON `
-DCMAKE_PREFIX_PATH="$SDL2Root"
cmake --build $FsuiBuildDir -j4
& $MakeCommand.Source clean
& $MakeCommand.Source shared `
WINDOWS_TARGET=1 `
UWP_TARGET=1 `
SDL_STATIC=0 `
FSUI_BUILD_DIR="$FsuiBuildDir" `
SDL_CFLAGS="-I$SDL2Include" `
SDL_LIBS_DYNAMIC="-L$SDL2Lib -lSDL2"
Copy-Item -Path $SDL2Dll -Destination $NativeStageDir -Force
Copy-Item -Path (Join-Path $RepoRoot "bin\libarmsx.dll") -Destination $UwpOutputDir -Force
Copy-Item -Path $SDL2Dll -Destination $UwpOutputDir -Force
& $MsBuildCommand.Source $SolutionPath `
/m `
/p:Configuration=$Configuration `
/p:Platform=$Platform
+23 -20
View File
@@ -6,28 +6,31 @@ $OS_INFO = (Get-WMIObject win32_operatingsystem).caption + " " + `
(Get-WMIObject win32_operatingsystem).version + " " + `
(Get-WMIObject win32_operatingsystem).OSArchitecture
$RepoRoot = (Resolve-Path ".").Path
$SDL2_DIR = "SDL2-2.30.3\i686-w64-mingw32"
$PSX_DIR = "."
$FSUI_BUILD_DIR = Join-Path $RepoRoot "build\fsui\win32"
$SDL2_ROOT = Join-Path $RepoRoot $SDL2_DIR
$SDL2_INCLUDE = Join-Path $SDL2_ROOT "include\SDL2"
$SDL2_LIB = Join-Path $SDL2_ROOT "lib"
if (!(Test-Path $SDL2_ROOT)) {
throw "SDL2 dependency directory not found at $SDL2_ROOT. Run .\build-deps.ps1 first."
}
mkdir -Force -Path bin > $null
gcc -I"$($PSX_DIR)" `
-I"$($PSX_DIR)\psx" `
-I"$($SDL2_DIR)\include\SDL2" `
"psx\*.c" `
"psx\dev\*.c" `
"psx\input\*.c" `
"psx\disc\*.c" `
"frontend\*.c" `
-DIMGUI_FRONTEND `
-o "bin\armsx.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 `
-Wno-address-of-packed-member `
-ffast-math -Ofast -g -flto
cmake -S third_party/fsui-lib -B $FSUI_BUILD_DIR -G "MinGW Makefiles" `
-DFSUI_BUILD_SAMPLES=OFF `
-DFSUI_PLATFORM_BACKEND=SDL2 `
-DFSUI_USE_SYSTEM_SDL2=ON `
-DCMAKE_PREFIX_PATH="$SDL2_ROOT"
cmake --build $FSUI_BUILD_DIR -j4
Copy-Item -Path "$($SDL2_DIR)\bin\SDL2.dll" -Destination "bin"
mingw32-make clean
mingw32-make `
SDL_STATIC=0 `
FSUI_BUILD_DIR="$FSUI_BUILD_DIR" `
SDL_CFLAGS="-I$SDL2_INCLUDE" `
SDL_LIBS_DYNAMIC="-L$SDL2_LIB -lSDL2 -lsetupapi -limm32 -lversion -lwinmm -lgdi32 -lole32 -loleaut32 -lshell32 -luuid -lopengl32"
Copy-Item -Path "$($SDL2_DIR)\bin\SDL2.dll" -Destination "bin"

Some files were not shown because too many files have changed in this diff Show More