This commit is contained in:
Jochen Sch„fer 2024-09-11 16:26:50 +02:00
commit bce034185b
654 changed files with 150489 additions and 16463 deletions

99
.github/workflows/build_android.yml vendored Normal file
View File

@ -0,0 +1,99 @@
name: Build latest (Android2)
on: [push]
concurrency:
group: ${{ github.ref }}-android
cancel-in-progress: true
jobs:
build:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-20.04
container:
image: ghcr.io/saschpe/android-ndk:34-jdk17.0.8_7-ndk25.2.9519653-cmake3.22.1
steps:
- uses: actions/checkout@v3
- name: Compile android builds
shell: bash
id: compile
env:
COMMON_FLAGS: "-O1 -s -fno-stack-protector -fno-math-errno -Qn"
DROID_FLAGS: "-fPIC -shared -s -O1 -fvisibility=hidden -rdynamic -funwind-tables"
DROID_LIBS: "-lGLESv2 -lEGL -lm -landroid -llog"
run: |
LATEST_FLAG=-DCC_COMMIT_SHA=\"${GITHUB_SHA::9}\"
DROID_FLAGS="-fPIC -shared -s -O1 -fvisibility=hidden -rdynamic -funwind-tables"
DROID_LIBS="-lGLESv2 -lEGL -lm -landroid -llog"
ROOT_DIR=$PWD
NDK_ROOT="/opt/android-sdk-linux/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin"
TOOLS_ROOT=$ROOT_DIR/build-tools
SDK_ROOT="/opt/android-sdk-linux/platforms/android-34"
mkdir build-tools
wget https://github.com/ClassiCube/rpi-compiling-stuff/raw/main/build-tools.zip
unzip build-tools.zip -d build-tools
chmod +x build-tools/aapt
chmod +x build-tools/dx
chmod +x build-tools/zipalign
cd $ROOT_DIR/src
$NDK_ROOT/armv7a-linux-androideabi19-clang *.c $DROID_FLAGS -march=armv5 $DROID_LIBS $LATEST_FLAG -o cc-droid-arm_16
$NDK_ROOT/armv7a-linux-androideabi19-clang *.c $DROID_FLAGS $DROID_LIBS $LATEST_FLAG -o cc-droid-arm_32
$NDK_ROOT/aarch64-linux-android21-clang *.c $DROID_FLAGS $DROID_LIBS $LATEST_FLAG -o cc-droid-arm_64
$NDK_ROOT/i686-linux-android21-clang *.c $DROID_FLAGS $DROID_LIBS $LATEST_FLAG -o cc-droid-x86_32
$NDK_ROOT/x86_64-linux-android21-clang *.c $DROID_FLAGS $DROID_LIBS $LATEST_FLAG -o cc-droid-x86_64
cd $ROOT_DIR/android/app/src/main
# copy required native libraries
mkdir lib lib/armeabi lib/armeabi-v7a lib/arm64-v8a lib/x86 lib/x86_64
cp $ROOT_DIR/src/cc-droid-arm_16 lib/armeabi/libclassicube.so
cp $ROOT_DIR/src/cc-droid-arm_32 lib/armeabi-v7a/libclassicube.so
cp $ROOT_DIR/src/cc-droid-arm_64 lib/arm64-v8a/libclassicube.so
cp $ROOT_DIR/src/cc-droid-x86_32 lib/x86/libclassicube.so
cp $ROOT_DIR/src/cc-droid-x86_64 lib/x86_64/libclassicube.so
# The following commands are for manually building an .apk, see
# https://spin.atomicobject.com/2011/08/22/building-android-application-bundles-apks-by-hand/
# https://github.com/cnlohr/rawdrawandroid/blob/master/Makefile
# https://stackoverflow.com/questions/41132753/how-can-i-build-an-android-apk-without-gradle-on-the-command-line
# https://github.com/skanti/Android-Manual-Build-Command-Line/blob/master/hello-jni/Makefile
# https://github.com/skanti/Android-Manual-Build-Command-Line/blob/master/hello-jni/CMakeLists.txt
# compile java files into multiple .class files
cd $ROOT_DIR/android/app/src/main/java/com/classicube
javac *.java -d $ROOT_DIR/android/app/src/main/obj -classpath $SDK_ROOT/android.jar --release 8
cd $ROOT_DIR/android/app/src/main
# get debug signing key
echo -n "${{ secrets.ANDROID_SIGNING_KEY_BASE64 }}" | base64 --decode > debug.keystore
# compile the multiple .class files into one .dex file
$TOOLS_ROOT/dx --dex --output=obj/classes.dex ./obj
# create initial .apk with packaged version of resources
$TOOLS_ROOT/aapt package -f -M AndroidManifest.xml -S res -F obj/cc-unsigned.apk -I $SDK_ROOT/android.jar
# and add all the required files
cp obj/classes.dex classes.dex
$TOOLS_ROOT/aapt add -f obj/cc-unsigned.apk classes.dex lib/armeabi/libclassicube.so lib/armeabi-v7a/libclassicube.so lib/arm64-v8a/libclassicube.so lib/x86/libclassicube.so lib/x86_64/libclassicube.so
# sign the apk with debug key (https://stackoverflow.com/questions/16711233/)
cp obj/cc-unsigned.apk obj/cc-signed.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore debug.keystore -storepass android -keypass android obj/cc-signed.apk androiddebugkey
# jarsigner -verbose
# create aligned .apk file
$TOOLS_ROOT/zipalign -f 4 obj/cc-signed.apk $ROOT_DIR/src/cc.apk
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile android build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'src/cc.apk'
DEST_NAME: 'ClassiCube.apk'

View File

@ -15,14 +15,18 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: kazade/dreamcast-sdk
image: ghcr.io/kos-builds/kos-dc:sha-656a397-14.1.0
steps:
- uses: actions/checkout@v4
- name: Compile Dreamcast build
id: compile
shell: bash
run: |
source /opt/toolchains/dc/kos/environ.sh
export PATH=/opt/toolchains/dc/kos/utils/img4dc/build/cdi4dc/:$PATH
apt-get update
apt-get -y install genisoimage
wget https://github.com/ClassiCube/rpi-compiling-stuff/raw/main/cdi4dc -O /opt/toolchains/dc/kos/utils/cdi4dc
chmod +x /opt/toolchains/dc/kos/utils/cdi4dc
export PATH=/opt/toolchains/dc/kos/utils/:$PATH
make dreamcast
@ -50,4 +54,4 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'dreamcast'
WORKFLOW_NAME: 'dreamcast'

View File

@ -13,7 +13,7 @@ concurrency:
jobs:
build:
runs-on: macOS-11
runs-on: macOS-12
steps:
- uses: actions/checkout@v3
- name: Compile iOS build
@ -43,4 +43,4 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'ios'
WORKFLOW_NAME: 'ios'

View File

@ -6,6 +6,7 @@ on:
- main
- master
- ModernLighting
- AngledLighting
workflow_dispatch:
concurrency:
@ -119,4 +120,4 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'linux64'
WORKFLOW_NAME: 'linux64'

View File

@ -34,6 +34,20 @@ jobs:
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-gl1 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -lgcc_s.1
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -o cc-mac32-gl2 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -lgcc_s.1
- name: Compile 32 bit macOS builds (PowerPC)
shell: bash
id: compile_ppc
env:
COMMON_FLAGS: "-O1 -s -fno-stack-protector -fno-math-errno -Qn -fvisibility=hidden -static-libgcc -Wl,-no_compact_unwind -DCC_BUILD_ICON -isystem /usr/local/compiler/ppc/target/SDK/MacOSX10.5.sdk -Wl,-syslibroot /usr/local/compiler/ppc/target/SDK/MacOSX10.5.sdk"
run: |
LATEST_FLAG=-DCC_COMMIT_SHA=\"${GITHUB_SHA::9}\"
mkdir -p /home/minty/repos/osxcross-ppc-test/target/bin
ln -s /usr/local/compiler/ppc/target/bin/powerpc64-apple-darwin9-as /home/minty/repos/osxcross-ppc-test/target/bin/powerpc64-apple-darwin9-as
cd src
PATH=$PATH:/usr/local/compiler/ppc/target/bin
powerpc-apple-darwin9-base-gcc *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-ppc -mmacosx-version-min=10.2.0 -m32 -framework Cocoa -framework OpenGL -framework IOKit -lobjc
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
@ -46,10 +60,23 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'src/cc-mac32-gl1'
DEST_NAME: 'ClassiCube-mac32-Intel'
DEST_NAME: 'ClassiCube-mac32-OpenGL'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'src/cc-mac32-gl2'
DEST_NAME: 'ClassiCube-mac32-Intel-ModernGL'
DEST_NAME: 'ClassiCube-mac32-ModernGL'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_ppc.outcome == 'success' }}
with:
SOURCE_FILE: 'src/cc-mac32-ppc'
DEST_NAME: 'ClassiCube-mac32-PPC'
- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'mac32'

View File

@ -5,6 +5,7 @@ on:
branches:
- main
- master
- AngledLighting
workflow_dispatch:
@ -45,7 +46,7 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'src/cc-mac64-gl1'
DEST_NAME: 'ClassiCube-mac64'
DEST_NAME: 'ClassiCube-mac64-OpenGL'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
@ -58,3 +59,10 @@ jobs:
with:
SOURCE_FILE: 'src/cc-mac-arm64'
DEST_NAME: 'ClassiCube-mac-ARM64'
- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'mac64'

View File

@ -25,6 +25,8 @@ jobs:
export BLOCKSDS=/opt/blocksds/core
export BLOCKSDSEXT=/opt/blocksds/external
make ds
export BUILD_DSI=1
make ds
- uses: ./.github/actions/notify_failure
@ -37,14 +39,20 @@ jobs:
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube.nds'
DEST_NAME: 'ClassiCube.nds'
SOURCE_FILE: 'ClassiCube-nds.nds'
DEST_NAME: 'ClassiCube-nds.nds'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'build-nds/ClassiCube.elf'
DEST_NAME: 'ClassiCube-nds.elf'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-dsi.nds'
DEST_NAME: 'ClassiCube-dsi.nds'
- uses: ./.github/actions/notify_success

View File

@ -19,7 +19,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install prerequisites
run: apt install wget unzip
run: |
apt-get update
apt-get -y install zip wget
- name: Retrieve OpenGL and X11 dev files (64 bit)
run: |
mkdir src/netbsd64

View File

@ -39,23 +39,30 @@ jobs:
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.elf'
SOURCE_FILE: 'misc/ps1/build/ClassiCube-PS1.elf'
DEST_NAME: 'ClassiCube-PS1.elf'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.exe'
SOURCE_FILE: 'misc/ps1/build/ClassiCube-PS1.exe'
DEST_NAME: 'ClassiCube-PS1.exe'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.bin'
SOURCE_FILE: 'misc/ps1/build/ClassiCube-PS1.bin'
DEST_NAME: 'ClassiCube-PS1.bin'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.cue'
SOURCE_FILE: 'misc/ps1/build/ClassiCube-PS1.cue'
DEST_NAME: 'ClassiCube-PS1.cue'
- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'ps1'

View File

@ -22,6 +22,7 @@ jobs:
id: compile
run: |
apk add curl curl-dev
export PSPSDK=$(psp-config --pspsdk-path)
make psp
@ -49,4 +50,4 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'psp'
WORKFLOW_NAME: 'psp'

View File

@ -15,7 +15,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: ijacquez/yaul
image: ijacquez/yaul:1.0.10
steps:
- uses: actions/checkout@v4
- name: Compile Saturn build
@ -48,4 +48,11 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-saturn.cue'
DEST_NAME: 'ClassiCube-saturn.cue'
DEST_NAME: 'ClassiCube-saturn.cue'
- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'saturn'

View File

@ -6,6 +6,7 @@ on:
- main
- master
- ModernLighting
- AngledLighting
workflow_dispatch:
concurrency:
@ -133,4 +134,4 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'win64'
WORKFLOW_NAME: 'win64'

16
.gitignore vendored
View File

@ -53,9 +53,10 @@ build-ps2/
build-ps3/
build-psp/
build-vita/
eboot.pbp
eboot.bin
EBOOT.PBP
PARAM.SFO
param.sfo
eboot.bin
# Build results
[Dd]ebug/
@ -95,6 +96,9 @@ fontscache.txt
# Android source files need to be included
!android/app/src/main/java/com/classicube
# Flatpak wrapper which needs to be included
!misc/linux/flatpak/ClassiCubeLauncher
# CMake files
CMakeFiles/
CMakeCache.txt
@ -123,6 +127,9 @@ dlldata.c
# Mac classic
retro68scripts/
# PS2
openvcl/
*_i.c
*_p.c
*_i.h
@ -147,6 +154,11 @@ retro68scripts/
*.pidb
*.svclog
*.scc
*.map
# Binary files
*.bin
*.elf
# Visual C++ cache files
ipch/

120
Makefile
View File

@ -1,12 +1,18 @@
SOURCE_DIR := src
BUILD_DIR := build
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
SOURCE_DIR = src
BUILD_DIR = build
C_SOURCES = $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS = $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
OBJECTS := $(C_OBJECTS)
ENAME = ClassiCube
CFLAGS = -g -pipe -fno-math-errno -Werror -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=maybe-uninitialized
OBJECTS = $(C_OBJECTS)
# Flags passed to the C compiler
CFLAGS = -pipe -fno-math-errno -Werror -Wno-error=missing-braces -Wno-error=strict-aliasing
# Flags passed to the linker
LDFLAGS = -g -rdynamic
# Name of the main executable
ENAME = ClassiCube
# Name of the final target file
# (usually this is the executable, but e.g. is app bundle on macOS)
TARGET := $(ENAME)
ifndef RM
# No prefined RM variable, try to guess OS default
@ -34,7 +40,8 @@ ifeq ($(PLAT),web)
CC = emcc
OEXT = .html
CFLAGS = -g
LDFLAGS = -s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library $(SOURCE_DIR)/interop_web.js
LDFLAGS = -g -s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library $(SOURCE_DIR)/interop_web.js
BUILD_DIR = build-web
endif
ifeq ($(PLAT),mingw)
@ -42,17 +49,20 @@ ifeq ($(PLAT),mingw)
OEXT = .exe
CFLAGS += -DUNICODE
LDFLAGS = -g
LIBS = -mwindows -lwinmm -limagehlp
LIBS = -mwindows -lwinmm
BUILD_DIR = build-win
endif
ifeq ($(PLAT),linux)
CFLAGS += -DCC_BUILD_ICON
LIBS = -lX11 -lXi -lpthread -lGL -ldl
BUILD_DIR = build-linux
endif
ifeq ($(PLAT),sunos)
CFLAGS += -DCC_BUILD_ICON
LIBS = -lsocket -lX11 -lXi -lGL
BUILD_DIR = build-solaris
endif
ifeq ($(PLAT),darwin)
@ -60,56 +70,67 @@ ifeq ($(PLAT),darwin)
CFLAGS += -DCC_BUILD_ICON
LIBS =
LDFLAGS = -rdynamic -framework Cocoa -framework OpenGL -framework IOKit -lobjc
BUILD_DIR = build-macos
TARGET = $(ENAME).app
endif
ifeq ($(PLAT),freebsd)
CFLAGS += -I /usr/local/include -DCC_BUILD_ICON
LDFLAGS = -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
BUILD_DIR = build-freebsd
endif
ifeq ($(PLAT),openbsd)
CFLAGS += -I /usr/X11R6/include -I /usr/local/include -DCC_BUILD_ICON
LDFLAGS = -L /usr/X11R6/lib -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
BUILD_DIR = build-openbsd
endif
ifeq ($(PLAT),netbsd)
CFLAGS += -I /usr/X11R7/include -I /usr/pkg/include -DCC_BUILD_ICON
LDFLAGS = -L /usr/X11R7/lib -L /usr/pkg/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
BUILD_DIR = build-netbsd
endif
ifeq ($(PLAT),dragonfly)
CFLAGS += -I /usr/local/include -DCC_BUILD_ICON
LDFLAGS = -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
BUILD_DIR = build-flybsd
endif
ifeq ($(PLAT),haiku)
OBJECTS += $(BUILD_DIR)/Platform_BeOS.o $(BUILD_DIR)/Window_BeOS.o
CFLAGS = -g -pipe -fno-math-errno
CFLAGS = -pipe -fno-math-errno
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
BUILD_DIR = build-haiku
endif
ifeq ($(PLAT),beos)
OBJECTS += $(BUILD_DIR)/Platform_BeOS.o $(BUILD_DIR)/Window_BeOS.o
CFLAGS = -g -pipe
CFLAGS = -pipe
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
BUILD_DIR = build-beos
TRACK_DEPENDENCIES=0
endif
ifeq ($(PLAT),serenityos)
LIBS = -lgl -lSDL2
BUILD_DIR = build-serenity
endif
ifeq ($(PLAT),irix)
CC = gcc
LIBS = -lGL -lX11 -lXi -lpthread -ldl
BUILD_DIR = build-irix
endif
ifdef SDL2
CFLAGS += -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL2
LIBS += -lSDL2
@ -118,49 +139,62 @@ ifdef SDL3
CFLAGS += -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3
LIBS += -lSDL3
endif
ifdef TERMINAL
CFLAGS += -DCC_WIN_BACKEND=CC_WIN_BACKEND_TERMINAL -DCC_GFX_BACKEND=CC_GFX_BACKEND_SOFTGPU
LIBS := $(subst mwindows,mconsole,$(LIBS))
endif
ifdef BEARSSL
BEARSSL_SOURCES = $(wildcard third_party/bearssl/src/*.c)
BEARSSL_OBJECTS = $(patsubst third_party/bearssl/src/%.c, $(BUILD_DIR)/%.o, $(BEARSSL_SOURCES))
OBJECTS += $(BEARSSL_OBJECTS)
CFLAGS += -Ithird_party/bearssl/inc -DCC_SSL_BACKEND=CC_SSL_BACKEND_BEARSSL -DCC_NET_BACKEND=CC_NET_BACKEND_BUILTIN
endif
ifdef RELEASE
CFLAGS += -O1
else
CFLAGS += -g
endif
default: $(PLAT)
web:
$(MAKE) $(ENAME) PLAT=web
$(MAKE) $(TARGET) PLAT=web
linux:
$(MAKE) $(ENAME) PLAT=linux
$(MAKE) $(TARGET) PLAT=linux
mingw:
$(MAKE) $(ENAME) PLAT=mingw
$(MAKE) $(TARGET) PLAT=mingw
sunos:
$(MAKE) $(ENAME) PLAT=sunos
$(MAKE) $(TARGET) PLAT=sunos
darwin:
$(MAKE) $(ENAME) PLAT=darwin
$(MAKE) $(TARGET) PLAT=darwin
freebsd:
$(MAKE) $(ENAME) PLAT=freebsd
$(MAKE) $(TARGET) PLAT=freebsd
openbsd:
$(MAKE) $(ENAME) PLAT=openbsd
$(MAKE) $(TARGET) PLAT=openbsd
netbsd:
$(MAKE) $(ENAME) PLAT=netbsd
$(MAKE) $(TARGET) PLAT=netbsd
dragonfly:
$(MAKE) $(ENAME) PLAT=dragonfly
$(MAKE) $(TARGET) PLAT=dragonfly
haiku:
$(MAKE) $(ENAME) PLAT=haiku
$(MAKE) $(TARGET) PLAT=haiku
beos:
$(MAKE) $(ENAME) PLAT=beos
$(MAKE) $(TARGET) PLAT=beos
serenityos:
$(MAKE) $(ENAME) PLAT=serenityos
$(MAKE) $(TARGET) PLAT=serenityos
irix:
$(MAKE) $(ENAME) PLAT=irix
$(MAKE) $(TARGET) PLAT=irix
# Default overrides
sdl2:
$(MAKE) $(ENAME) SDL2=1
$(MAKE) $(TARGET) SDL2=1
sdl3:
$(MAKE) $(ENAME) SDL3=1
$(MAKE) $(TARGET) SDL3=1
terminal:
$(MAKE) $(ENAME) TERMINAL=1
$(MAKE) $(TARGET) TERMINAL=1
release:
$(MAKE) $(TARGET) RELEASE=1
# Some builds require more complex handling, so are moved to
# separate makefiles to avoid having one giant messy makefile
@ -207,11 +241,19 @@ macclassic_ppc:
clean:
$(RM) $(OBJECTS)
$(ENAME): $(BUILD_DIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@$(OEXT) $(OBJECTS) $(LIBS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(ENAME): $(BUILD_DIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@$(OEXT) $(OBJECTS) $(EXTRA_LIBS) $(LIBS)
# macOS app bundle
$(ENAME).app : $(ENAME)
mkdir -p $(TARGET)/Contents/MacOS
mkdir -p $(TARGET)/Contents/Resources
cp $(ENAME) $(TARGET)/Contents/MacOS/$(ENAME)
cp misc/macOS/Info.plist $(TARGET)/Contents/Info.plist
cp misc/macOS/appicon.icns $(TARGET)/Contents/Resources/appicon.icns
# === Compiling with dependency tracking ===
@ -222,18 +264,24 @@ DEPFILES := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.d, $(C_SOURCES))
$(DEPFILES):
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c $(BUILD_DIR)/%.d
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(DEPFLAGS) -c $< -o $@
include $(wildcard $(DEPFILES))
# === Compiling WITHOUT dependency tracking ===
else
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
endif
# === Platform specific file compiling ===
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.m
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
# EXTRA_CFLAGS and EXTRA_LIBS are not defined in the makefile intentionally -
# define them on the command line as a simple way of adding CFLAGS/LIBS

View File

@ -913,6 +913,11 @@ public class MainActivity extends Activity
static byte[] readCache = new byte[8192];
public static int httpInit(String url, String method) {
// newer android versions block cleartext traffic by default
if (android.os.Build.VERSION.SDK_INT >= 26) {
url = url.replace("http://", "https://");
}
try {
conn = (HttpURLConnection)new URL(url).openConnection();
conn.setDoInput(true);

View File

@ -64,15 +64,6 @@ All plugins require this boilerplate, so feel free to copy and paste it.
---
### Writing plugins in C++
When including headers from ClassiCube, they **must** be surrounded with `extern "C"`, i.e.
```C
extern "C" {
#include "src/Chat.h"
#include "src/Game.h"
#include "src/String.h"
}
```
Otherwise you will get obscure `Undefined reference` errors when compiling.
Exported plugin functions **must** be surrounded with `extern "C"`, i.e.
```C
@ -259,4 +250,4 @@ This is somewhat tedious to do - see [here](https://github.com/ClassiCube/Classi
If you **ONLY** use code from the game (no external libraries and no C standard library functions):
* You can add `-nostartfiles -Wl,--entry=0` to the compile flags to reduce the DLL size (e.g from 11 to 4 kb)
This isn't necessary to do though, and plugin DLLs work completely fine without doing this.
This isn't necessary to do though, and plugin DLLs work completely fine without doing this.

View File

@ -13,6 +13,10 @@
9A62ADF5286D906F00E5E3DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A62ADF4286D906F00E5E3DE /* Assets.xcassets */; };
9A6C79652BFDDEF200676D27 /* FancyLighting.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C79642BFDDEF100676D27 /* FancyLighting.c */; };
9A6C79672BFDDF0700676D27 /* Queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C79662BFDDF0600676D27 /* Queue.c */; };
9A6C7DFA2C2F610C00676D27 /* LBackend_ios.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7DF92C2F610C00676D27 /* LBackend_ios.m */; };
9A6C7DFC2C41E93700676D27 /* InputHandler.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7DFB2C41E93700676D27 /* InputHandler.c */; };
9A6C7DFE2C41E95D00676D27 /* MenuOptions.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7DFD2C41E95C00676D27 /* MenuOptions.c */; };
9A6C7E002C41EED700676D27 /* Window_ios.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7DFF2C41EED700676D27 /* Window_ios.m */; };
9A7401D92B737D5C0040E575 /* Commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A7401D82B737D5B0040E575 /* Commands.c */; };
9A7401DB2B7384060040E575 /* SSL.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A7401DA2B7384060040E575 /* SSL.c */; };
9A89D4F227F802F600FF3F80 /* LWidgets.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D37827F802F500FF3F80 /* LWidgets.c */; };
@ -84,7 +88,7 @@
9A89D58A27F802F600FF3F80 /* BlockPhysics.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4DB27F802F600FF3F80 /* BlockPhysics.c */; };
9A89D58B27F802F600FF3F80 /* Launcher.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4DD27F802F600FF3F80 /* Launcher.c */; };
9A89D58D27F802F600FF3F80 /* Options.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4E327F802F600FF3F80 /* Options.c */; };
9A89D58E27F802F600FF3F80 /* Window_SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4E427F802F600FF3F80 /* Window_SDL.c */; };
9A89D58E27F802F600FF3F80 /* Window_SDL2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4E427F802F600FF3F80 /* Window_SDL2.c */; };
9A89D58F27F802F600FF3F80 /* Audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4E727F802F600FF3F80 /* Audio.c */; };
9A89D59027F802F600FF3F80 /* Stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4E827F802F600FF3F80 /* Stream.c */; };
9A89D59127F802F600FF3F80 /* Vectors.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D4E927F802F600FF3F80 /* Vectors.c */; };
@ -101,6 +105,10 @@
9A62ADF4286D906F00E5E3DE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ClassiCube/Assets.xcassets; sourceTree = "<group>"; };
9A6C79642BFDDEF100676D27 /* FancyLighting.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = FancyLighting.c; sourceTree = "<group>"; };
9A6C79662BFDDF0600676D27 /* Queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Queue.c; sourceTree = "<group>"; };
9A6C7DF92C2F610C00676D27 /* LBackend_ios.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBackend_ios.m; sourceTree = "<group>"; };
9A6C7DFB2C41E93700676D27 /* InputHandler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = InputHandler.c; sourceTree = "<group>"; };
9A6C7DFD2C41E95C00676D27 /* MenuOptions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = MenuOptions.c; sourceTree = "<group>"; };
9A6C7DFF2C41EED700676D27 /* Window_ios.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Window_ios.m; sourceTree = "<group>"; };
9A7401D82B737D5B0040E575 /* Commands.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Commands.c; sourceTree = "<group>"; };
9A7401DA2B7384060040E575 /* SSL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SSL.c; sourceTree = "<group>"; };
9A89D35727F802B100FF3F80 /* ClassiCube.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ClassiCube.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -174,7 +182,7 @@
9A89D4DB27F802F600FF3F80 /* BlockPhysics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BlockPhysics.c; sourceTree = "<group>"; };
9A89D4DD27F802F600FF3F80 /* Launcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Launcher.c; sourceTree = "<group>"; };
9A89D4E327F802F600FF3F80 /* Options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Options.c; sourceTree = "<group>"; };
9A89D4E427F802F600FF3F80 /* Window_SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Window_SDL.c; sourceTree = "<group>"; };
9A89D4E427F802F600FF3F80 /* Window_SDL2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Window_SDL2.c; sourceTree = "<group>"; };
9A89D4E727F802F600FF3F80 /* Audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Audio.c; sourceTree = "<group>"; };
9A89D4E827F802F600FF3F80 /* Stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Stream.c; sourceTree = "<group>"; };
9A89D4E927F802F600FF3F80 /* Vectors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Vectors.c; sourceTree = "<group>"; };
@ -216,6 +224,10 @@
9A89D37727F802F500FF3F80 /* src */ = {
isa = PBXGroup;
children = (
9A6C7DFF2C41EED700676D27 /* Window_ios.m */,
9A6C7DFD2C41E95C00676D27 /* MenuOptions.c */,
9A6C7DFB2C41E93700676D27 /* InputHandler.c */,
9A6C7DF92C2F610C00676D27 /* LBackend_ios.m */,
9A6C79662BFDDF0600676D27 /* Queue.c */,
9A6C79642BFDDEF100676D27 /* FancyLighting.c */,
9A4D0C632BDD168800E1695D /* TouchUI.c */,
@ -297,7 +309,7 @@
9A89D4E927F802F600FF3F80 /* Vectors.c */,
9A89D37C27F802F500FF3F80 /* Vorbis.c */,
9A89D4EE27F802F600FF3F80 /* Widgets.c */,
9A89D4E427F802F600FF3F80 /* Window_SDL.c */,
9A89D4E427F802F600FF3F80 /* Window_SDL2.c */,
9A89D48727F802F600FF3F80 /* World.c */,
9A89D47F27F802F600FF3F80 /* interop_ios.m */,
);
@ -377,12 +389,13 @@
9A89D56C27F802F600FF3F80 /* _ftinit.c in Sources */,
9A89D58F27F802F600FF3F80 /* Audio.c in Sources */,
9A89D55227F802F600FF3F80 /* Logger.c in Sources */,
9A89D58E27F802F600FF3F80 /* Window_SDL.c in Sources */,
9A89D58E27F802F600FF3F80 /* Window_SDL2.c in Sources */,
9A89D4FF27F802F600FF3F80 /* Gui.c in Sources */,
9A89D55027F802F600FF3F80 /* Entity.c in Sources */,
9A89D58327F802F600FF3F80 /* EntityComponents.c in Sources */,
9A7401D92B737D5C0040E575 /* Commands.c in Sources */,
9A89D57327F802F600FF3F80 /* Utils.c in Sources */,
9A6C7DFE2C41E95D00676D27 /* MenuOptions.c in Sources */,
9A89D58427F802F600FF3F80 /* Camera.c in Sources */,
9A89D57C27F802F600FF3F80 /* Chat.c in Sources */,
9A89D50527F802F600FF3F80 /* LScreens.c in Sources */,
@ -448,15 +461,18 @@
9A89D57427F802F600FF3F80 /* MapRenderer.c in Sources */,
9A89D57627F802F600FF3F80 /* _pshinter.c in Sources */,
9A89D56A27F802F600FF3F80 /* Physics.c in Sources */,
9A6C7DFA2C2F610C00676D27 /* LBackend_ios.m in Sources */,
9A89D58727F802F600FF3F80 /* SelectionBox.c in Sources */,
9A89D4FE27F802F600FF3F80 /* Inventory.c in Sources */,
9A89D56527F802F600FF3F80 /* Generator.c in Sources */,
9A89D57527F802F600FF3F80 /* AxisLinesRenderer.c in Sources */,
9A6C7E002C41EED700676D27 /* Window_ios.m in Sources */,
9A89D55E27F802F600FF3F80 /* World.c in Sources */,
9A89D58627F802F600FF3F80 /* Screens.c in Sources */,
9A89D4F927F802F600FF3F80 /* Http_Worker.c in Sources */,
9A89D58B27F802F600FF3F80 /* Launcher.c in Sources */,
9A89D59027F802F600FF3F80 /* Stream.c in Sources */,
9A6C7DFC2C41E93700676D27 /* InputHandler.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

131
misc/32x/32x.h Normal file
View File

@ -0,0 +1,131 @@
#ifndef __32X_H__
#define __32X_H__
/* Create a 5:5:5 RGB color */
#define COLOR(r,g,b) (((r)&0x1F)|((g)&0x1F)<<5|((b)&0x1F)<<10)
#define MARS_CRAM (*(volatile unsigned short *)0x20004200)
#define MARS_FRAMEBUFFER (*(volatile unsigned short *)0x24000000)
#define MARS_OVERWRITE_IMG (*(volatile unsigned short *)0x24020000)
#define MARS_SDRAM (*(volatile unsigned short *)0x26000000)
#define MARS_SYS_INTMSK (*(volatile unsigned short *)0x20004000)
#define MARS_SYS_DMACTR (*(volatile unsigned short *)0x20004006)
#define MARS_SYS_DMASAR (*(volatile unsigned long *)0x20004008)
#define MARS_SYS_DMADAR (*(volatile unsigned long *)0x2000400C)
#define MARS_SYS_DMALEN (*(volatile unsigned short *)0x20004010)
#define MARS_SYS_DMAFIFO (*(volatile unsigned short *)0x20004012)
#define MARS_SYS_VRESI_CLR (*(volatile unsigned short *)0x20004014)
#define MARS_SYS_VINT_CLR (*(volatile unsigned short *)0x20004016)
#define MARS_SYS_HINT_CLR (*(volatile unsigned short *)0x20004018)
#define MARS_SYS_CMDI_CLR (*(volatile unsigned short *)0x2000401A)
#define MARS_SYS_PWMI_CLR (*(volatile unsigned short *)0x2000401C)
#define MARS_SYS_COMM0 (*(volatile unsigned short *)0x20004020) /* Master SH2 communication */
#define MARS_SYS_COMM2 (*(volatile unsigned short *)0x20004022)
#define MARS_SYS_COMM4 (*(volatile unsigned short *)0x20004024) /* Slave SH2 communication */
#define MARS_SYS_COMM6 (*(volatile unsigned short *)0x20004026)
#define MARS_SYS_COMM8 (*(volatile unsigned short *)0x20004028) /* controller 1 current value */
#define MARS_SYS_COMM10 (*(volatile unsigned short *)0x2000402A) /* controller 2 current value */
#define MARS_SYS_COMM12 (*(volatile unsigned long *)0x2000402C) /* vcount current value */
#define MARS_PWM_CTRL (*(volatile unsigned short *)0x20004030)
#define MARS_PWM_CYCLE (*(volatile unsigned short *)0x20004032)
#define MARS_PWM_LEFT (*(volatile unsigned short *)0x20004034)
#define MARS_PWM_RIGHT (*(volatile unsigned short *)0x20004036)
#define MARS_PWM_MONO (*(volatile unsigned short *)0x20004038)
#define MARS_VDP_DISPMODE (*(volatile unsigned short *)0x20004100)
#define MARS_VDP_FILLEN (*(volatile unsigned short *)0x20004104)
#define MARS_VDP_FILADR (*(volatile unsigned short *)0x20004106)
#define MARS_VDP_FILDAT (*(volatile unsigned short *)0x20004108)
#define MARS_VDP_FBCTL (*(volatile unsigned short *)0x2000410A)
#define MARS_SH2_ACCESS_VDP 0x8000
#define MARS_68K_ACCESS_VDP 0x0000
#define MARS_PAL_FORMAT 0x0000
#define MARS_NTSC_FORMAT 0x8000
#define MARS_VDP_PRIO_68K 0x0000
#define MARS_VDP_PRIO_32X 0x0080
#define MARS_224_LINES 0x0000
#define MARS_240_LINES 0x0040
#define MARS_VDP_MODE_OFF 0x0000
#define MARS_VDP_MODE_256 0x0001
#define MARS_VDP_MODE_32K 0x0002
#define MARS_VDP_MODE_RLE 0x0003
#define MARS_VDP_VBLK 0x8000
#define MARS_VDP_HBLK 0x4000
#define MARS_VDP_PEN 0x2000
#define MARS_VDP_FEN 0x0002
#define MARS_VDP_FS 0x0001
#define SH2_CCTL_CP 0x10
#define SH2_CCTL_TW 0x08
#define SH2_CCTL_CE 0x01
#define SH2_FRT_TIER (*(volatile unsigned char *)0xFFFFFE10)
#define SH2_FRT_FTCSR (*(volatile unsigned char *)0xFFFFFE11)
#define SH2_FRT_FRCH (*(volatile unsigned char *)0xFFFFFE12)
#define SH2_FRT_FRCL (*(volatile unsigned char *)0xFFFFFE13)
#define SH2_FRT_OCRH (*(volatile unsigned char *)0xFFFFFE14)
#define SH2_FRT_OCRL (*(volatile unsigned char *)0xFFFFFE15)
#define SH2_FRT_TCR (*(volatile unsigned char *)0xFFFFFE16)
#define SH2_FRT_TOCR (*(volatile unsigned char *)0xFFFFFE17)
#define SH2_FRT_ICRH (*(volatile unsigned char *)0xFFFFFE18)
#define SH2_FRT_ICRL (*(volatile unsigned char *)0xFFFFFE19)
#define SH2_DMA_SAR0 (*(volatile unsigned long *)0xFFFFFF80)
#define SH2_DMA_DAR0 (*(volatile unsigned long *)0xFFFFFF84)
#define SH2_DMA_TCR0 (*(volatile unsigned long *)0xFFFFFF88)
#define SH2_DMA_CHCR0 (*(volatile unsigned long *)0xFFFFFF8C)
#define SH2_DMA_VCR0 (*(volatile unsigned long *)0xFFFFFFA0)
#define SH2_DMA_DRCR0 (*(volatile unsigned char *)0xFFFFFE71)
#define SH2_DMA_SAR1 (*(volatile unsigned long *)0xFFFFFF90)
#define SH2_DMA_DAR1 (*(volatile unsigned long *)0xFFFFFF94)
#define SH2_DMA_TCR1 (*(volatile unsigned long *)0xFFFFFF98)
#define SH2_DMA_CHCR1 (*(volatile unsigned long *)0xFFFFFF9C)
#define SH2_DMA_VCR1 (*(volatile unsigned long *)0xFFFFFFA8)
#define SH2_DMA_DRCR1 (*(volatile unsigned char *)0xFFFFFE72)
#define SH2_DMA_DMAOR (*(volatile unsigned long *)0xFFFFFFB0)
#define SH2_INT_IPRA (*(volatile unsigned short *)0xFFFFFEE2)
#define SEGA_CTRL_UP 0x0001
#define SEGA_CTRL_DOWN 0x0002
#define SEGA_CTRL_LEFT 0x0004
#define SEGA_CTRL_RIGHT 0x0008
#define SEGA_CTRL_B 0x0010
#define SEGA_CTRL_C 0x0020
#define SEGA_CTRL_A 0x0040
#define SEGA_CTRL_START 0x0080
#define SEGA_CTRL_Z 0x0100
#define SEGA_CTRL_Y 0x0200
#define SEGA_CTRL_X 0x0400
#define SEGA_CTRL_MODE 0x0800
#define SEGA_CTRL_TYPE 0xF000
#define SEGA_CTRL_THREE 0x0000
#define SEGA_CTRL_SIX 0x1000
#define SEGA_CTRL_NONE 0xF000
#ifdef __cplusplus
extern "C" {
#endif
/* global functions in sh2_crt0.s */
extern void fast_memcpy(void *dst, void *src, int len);
extern void CacheControl(int mode);
extern void CacheClearLine(void* ptr);
extern void ScreenStretch(int src, int width, int height, int interp);
#ifdef __cplusplus
}
#endif
#endif

70
misc/32x/Makefile Normal file
View File

@ -0,0 +1,70 @@
ifdef $(GENDEV)
ROOTDIR = $(GENDEV)
else
ROOTDIR = /opt/toolchains/sega
endif
LDSCRIPTSDIR = $(ROOTDIR)/ldscripts
LIBPATH = -L$(ROOTDIR)/sh-elf/lib -L$(ROOTDIR)/sh-elf/lib/gcc/sh-elf/4.6.2 -L$(ROOTDIR)/sh-elf/sh-elf/lib
INCPATH = -I. -I../include -I$(ROOTDIR)/sh-elf/include -I$(ROOTDIR)/sh-elf/sh-elf/include
SHCCFLAGS = -m2 -mb -Ofast -Wall -g -c -fomit-frame-pointer -DPLAT_32X -ffunction-sections -fdata-sections
SHHWFLAGS = -m2 -mb -O1 -Wall -g -c -fomit-frame-pointer
SHLDFLAGS = -T $(LDSCRIPTSDIR)/mars.ld -Wl,-Map=output.map -nostdlib -Wl,--gc-sections
SHASFLAGS = --big
MDLDFLAGS = -T $(LDSCRIPTSDIR)/md.ld --oformat binary
MDASFLAGS = -m68000 --register-prefix-optional
SHPREFIX = $(ROOTDIR)/sh-elf/bin/sh-elf-
SHCC = $(SHPREFIX)gcc
SHAS = $(SHPREFIX)as
SHLD = $(SHPREFIX)ld
SHOBJC = $(SHPREFIX)objcopy
MDPREFIX = $(ROOTDIR)/m68k-elf/bin/m68k-elf-
MDAS = $(MDPREFIX)as
MDLD = $(MDPREFIX)ld
DD = dd
RM = rm -f
TARGET = ClassiCube
LIBS = $(LIBPATH) -lc -lgcc -lgcc-Os-4-200 -lnosys
SOURCE_DIRS = ../../src
C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS = sh2_crt0.o main_32x.o hw_32x.o $(notdir $(C_FILES:%.c=%.o))
all: m68k_crt0.bin m68k_crt1.bin $(TARGET).bin
$(TARGET).bin: $(TARGET).elf
$(SHOBJC) -O binary $< temp.bin
$(DD) if=temp.bin of=$@ bs=64K conv=sync
$(TARGET).elf: $(OBJS)
$(SHCC) $(SHLDFLAGS) $(OBJS) $(LIBS) -o $(TARGET).elf
m68k_crt0.bin: m68k_crt0.s
$(MDAS) $(MDASFLAGS) -o m68k_crt0.o m68k_crt0.s
$(MDLD) $(MDLDFLAGS) -o m68k_crt0.bin m68k_crt0.o
m68k_crt1.bin: m68k_crt1.s
$(MDAS) $(MDASFLAGS) -o m68k_crt1.o m68k_crt1.s
$(MDLD) $(MDLDFLAGS) -o m68k_crt1.bin m68k_crt1.o
hw_32x.o: hw_32x.c
$(SHCC) $(SHHWFLAGS) $(INCPATH) $< -o $@
%.o: %.c
$(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@
%.o: ../../src/%.c
$(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@
%.o: %.s
$(SHAS) $(SHASFLAGS) $(INCPATH) $< -o $@
clean:
$(RM) *.o *.bin *.elf output.map

256
misc/32x/hw_32x.c Normal file
View File

@ -0,0 +1,256 @@
/*
* Licensed under the BSD license
*
* debug_32x.c - Debug screen functions.
*
* Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
* Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
*
* Altered for 32X by Chilly Willy
*/
#include "32x.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
static int init = 0;
static unsigned short fgc = 0, bgc = 0;
static unsigned char fgs = 0, bgs = 0;
static unsigned short currentFB = 0;
void Hw32xSetFGColor(int s, int r, int g, int b)
{
volatile unsigned short *palette = &MARS_CRAM;
fgs = s;
fgc = COLOR(r, g, b);
palette[fgs] = fgc;
}
void Hw32xSetBGColor(int s, int r, int g, int b)
{
volatile unsigned short *palette = &MARS_CRAM;
bgs = s;
bgc = COLOR(r, g, b);
palette[bgs] = bgc;
}
void Hw32xInit(int vmode, int lineskip)
{
volatile unsigned short *frameBuffer16 = &MARS_FRAMEBUFFER;
int i;
// Wait for the SH2 to gain access to the VDP
while ((MARS_SYS_INTMSK & MARS_SH2_ACCESS_VDP) == 0) ;
if (vmode == MARS_VDP_MODE_32K)
{
// Set 16-bit direct mode, 224 lines
MARS_VDP_DISPMODE = MARS_224_LINES | MARS_VDP_MODE_32K;
// init both framebuffers
// Flip the framebuffer selection bit and wait for it to take effect
MARS_VDP_FBCTL = currentFB ^ 1;
while ((MARS_VDP_FBCTL & MARS_VDP_FS) == currentFB) ;
currentFB ^= 1;
// rewrite line table
for (i=0; i<224/(lineskip+1); i++)
{
if (lineskip)
{
int j = lineskip + 1;
while (j)
{
frameBuffer16[i*(lineskip+1) + (lineskip + 1 - j)] = i*320 + 0x100; /* word offset of line */
j--;
}
}
else
{
if (i<200)
frameBuffer16[i] = i*320 + 0x100; /* word offset of line */
else
frameBuffer16[i] = 200*320 + 0x100; /* word offset of line */
}
}
// clear screen
for (i=0x100; i<0x10000; i++)
frameBuffer16[i] = 0;
// Flip the framebuffer selection bit and wait for it to take effect
MARS_VDP_FBCTL = currentFB ^ 1;
while ((MARS_VDP_FBCTL & MARS_VDP_FS) == currentFB) ;
currentFB ^= 1;
// rewrite line table
for (i=0; i<224/(lineskip+1); i++)
{
if (lineskip)
{
int j = lineskip + 1;
while (j)
{
frameBuffer16[i*(lineskip+1) + (lineskip + 1 - j)] = i*320 + 0x100; /* word offset of line */
j--;
}
}
else
{
if (i<200)
frameBuffer16[i] = i*320 + 0x100; /* word offset of line */
else
frameBuffer16[i] = 200*320 + 0x100; /* word offset of line */
}
}
// clear screen
for (i=0x100; i<0x10000; i++)
frameBuffer16[i] = 0;
}
Hw32xSetFGColor(255,31,31,31);
Hw32xSetBGColor(0,0,0,0);
init = vmode;
}
void Hw32xScreenClear()
{
int i;
int l = (init == MARS_VDP_MODE_256) ? 320*224/2 + 0x100 : 320*200 + 0x100;
volatile unsigned short *frameBuffer16 = &MARS_FRAMEBUFFER;
// clear screen
for (i=0x100; i<l; i++)
frameBuffer16[i] = 0;
// Flip the framebuffer selection bit and wait for it to take effect
MARS_VDP_FBCTL = currentFB ^ 1;
while ((MARS_VDP_FBCTL & MARS_VDP_FS) == currentFB) ;
currentFB ^= 1;
// clear screen
for (i=0x100; i<l; i++)
frameBuffer16[i] = 0;
Hw32xSetFGColor(255,31,31,31);
Hw32xSetBGColor(0,0,0,0);
}
void Hw32xDelay(int ticks)
{
unsigned long ct = MARS_SYS_COMM12 + ticks;
while (MARS_SYS_COMM12 < ct) ;
}
void Hw32xScreenFlip(int wait)
{
// Flip the framebuffer selection bit
MARS_VDP_FBCTL = currentFB ^ 1;
if (wait)
{
while ((MARS_VDP_FBCTL & MARS_VDP_FS) == currentFB) ;
currentFB ^= 1;
}
}
void Hw32xFlipWait()
{
while ((MARS_VDP_FBCTL & MARS_VDP_FS) == currentFB) ;
currentFB ^= 1;
}
// MD Command support code ---------------------------------------------
unsigned short HwMdReadPad(int port)
{
if (port == 0)
return MARS_SYS_COMM8;
else if (port == 1)
return MARS_SYS_COMM10;
else
return SEGA_CTRL_NONE;
}
unsigned char HwMdReadSram(unsigned short offset)
{
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM2 = offset;
MARS_SYS_COMM0 = 0x0100; // Read SRAM
while (MARS_SYS_COMM0) ;
return MARS_SYS_COMM2 & 0x00FF;
}
void HwMdWriteSram(unsigned char byte, unsigned short offset)
{
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM2 = offset;
MARS_SYS_COMM0 = 0x0200 | byte; // Write SRAM
while (MARS_SYS_COMM0) ;
}
int HwMdReadMouse(int port)
{
unsigned int mouse1, mouse2;
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM0 = 0x0300|port; // tells 68000 to read mouse
while (MARS_SYS_COMM0 == (0x0300|port)) ; // wait for mouse value
mouse1 = MARS_SYS_COMM0;
mouse2 = MARS_SYS_COMM2;
MARS_SYS_COMM0 = 0; // tells 68000 we got the mouse value
return (int)((mouse1 << 16) | mouse2);
}
void HwMdClearScreen(void)
{
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM0 = 0x0400; // Clear Screen (Name Table B)
while (MARS_SYS_COMM0) ;
}
void HwMdSetOffset(unsigned short offset)
{
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM2 = offset;
MARS_SYS_COMM0 = 0x0500; // Set offset (into either Name Table B or VRAM)
while (MARS_SYS_COMM0) ;
}
void HwMdSetNTable(unsigned short word)
{
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM2 = word;
MARS_SYS_COMM0 = 0x0600; // Set word at offset in Name Table B
while (MARS_SYS_COMM0) ;
}
void HwMdSetVram(unsigned short word)
{
while (MARS_SYS_COMM0) ; // wait until 68000 has responded to any earlier requests
MARS_SYS_COMM2 = word;
MARS_SYS_COMM0 = 0x0700; // Set word at offset in VRAM
while (MARS_SYS_COMM0) ;
}
void HwMdPuts(char *str, int color, int x, int y)
{
HwMdSetOffset(((y<<6) | x) << 1);
while (*str)
HwMdSetNTable(((*str++ - 0x20) & 0xFF) | color);
}
void HwMdPutc(char chr, int color, int x, int y)
{
HwMdSetOffset(((y<<6) | x) << 1);
HwMdSetNTable(((chr - 0x20) & 0xFF) | color);
}
// Slave SH2 support code ----------------------------------------------
void slave(void)
{
while (1) ;
}

30
misc/32x/hw_32x.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef HW_32X_H
#define HW_32X_H
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
extern void Hw32xSetFGColor(int s, int r, int g, int b);
extern void Hw32xSetBGColor(int s, int r, int g, int b);
extern void Hw32xInit(int vmode, int lineskip);
extern int Hw32xScreenGetX();
extern int Hw32xScreenGetY();
extern void Hw32xScreenSetXY(int x, int y);
extern void Hw32xScreenClear();
extern void Hw32xDelay(int ticks);
extern void Hw32xScreenFlip(int wait);
extern void Hw32xFlipWait();
extern unsigned short HwMdReadPad(int port);
extern unsigned char HwMdReadSram(unsigned short offset);
extern void HwMdWriteSram(unsigned char byte, unsigned short offset);
extern int HwMdReadMouse(int port);
extern void HwMdClearScreen(void);
extern void HwMdSetOffset(unsigned short offset);
extern void HwMdSetNTable(unsigned short word);
extern void HwMdSetVram(unsigned short word);
extern void HwMdPuts(char *str, int color, int x, int y);
extern void HwMdPutc(char chr, int color, int x, int y);
#endif

98
misc/32x/m68k_crt0.s Normal file
View File

@ -0,0 +1,98 @@
| SEGA 32X support code for the 68000
| by Chilly Willy
| First part of rom header
.text
| Initial exception vectors. When the console is first turned on, it is
| in MegaDrive mode. All vectors just point to the code to start up the
| Mars adapter. After the adapter is enabled, none of these vectors will
| appear as the adapter uses its own vector table to route exceptions to
| the jump table. 0x3F0 is where the 68000 starts at for the 32X.
.long 0x01000000,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
.long 0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0,0x000003F0
| Standard MegaDrive ROM header at 0x100
.ascii "SEGA 32X Example" /* SEGA must be the first four chars for TMSS */
.ascii "(C)2024 "
.ascii "ClassiCube 32X " /* export name */
.ascii " "
.ascii " "
.ascii "ClassiCube 32X " /* domestic (Japanese) name */
.ascii " "
.ascii " "
.ascii "GM MK-0000 -00"
.word 0x0000 /* checksum - not needed */
.ascii "J6 "
.long 0x00000000,0x0007FFFF /* ROM start, end */
.long 0x00FF0000,0x00FFFFFF /* RAM start, end */
.ifdef HAS_SAVE_RAM
.ascii "RA" /* External RAM */
.byte 0xF8 /* don't clear + odd bytes */
.byte 0x20 /* SRAM */
.long 0x00200001,0x0020FFFF /* SRAM start, end */
.else
.ascii " " /* no SRAM */
.endif
.ascii " "
.ascii " "
.ifdef MYTH_HOMEBREW
.ascii "MYTH3900" /* memo indicates Myth native executable */
.else
.ascii " " /* memo */
.endif
.ascii " "
.ascii " "
.ascii "F " /* enable any hardware configuration */
| Mars exception vector jump table at 0x200
jmp 0x880800.l /* reset = hot start */
jsr 0x880806.l /* EX_BusError */
jsr 0x880806.l /* EX_AddrError */
jsr 0x880806.l /* EX_IllInstr */
jsr 0x880806.l /* EX_DivByZero */
jsr 0x880806.l /* EX_CHK */
jsr 0x880806.l /* EX_TrapV */
jsr 0x880806.l /* EX_Priviledge */
jsr 0x880806.l /* EX_Trace */
jsr 0x880806.l /* EX_LineA */
jsr 0x880806.l /* EX_LineF */
.space 72 /* reserved */
jsr 0x880806.l /* EX_Spurious */
jsr 0x880806.l /* EX_Level1 */
jsr 0x880806.l /* EX_Level2 */
jsr 0x880806.l /* EX_Level3 */
jmp 0x88080C.l /* EX_Level4 HBlank */
jsr 0x880806.l /* EX_Level5 */
jmp 0x880812.l /* EX_Level6 VBlank */
jsr 0x880806.l /* EX_Level7 */
jsr 0x880806.l /* EX_Trap0 */
jsr 0x880806.l /* EX_Trap1 */
jsr 0x880806.l /* EX_Trap2 */
jsr 0x880806.l /* EX_Trap3 */
jsr 0x880806.l /* EX_Trap4 */
jsr 0x880806.l /* EX_Trap5 */
jsr 0x880806.l /* EX_Trap6 */
jsr 0x880806.l /* EX_Trap7 */
jsr 0x880806.l /* EX_Trap8 */
jsr 0x880806.l /* EX_Trap9 */
jsr 0x880806.l /* EX_TrapA */
jsr 0x880806.l /* EX_TrapB */
jsr 0x880806.l /* EX_TrapC */
jsr 0x880806.l /* EX_TrapD */
jsr 0x880806.l /* EX_TrapE */
jsr 0x880806.l /* EX_TrapF */
.space 166 /* reserved */

1846
misc/32x/m68k_crt1.s Normal file

File diff suppressed because it is too large Load Diff

29
misc/32x/main_32x.c Normal file
View File

@ -0,0 +1,29 @@
#include <stdlib.h>
#include "32x.h"
#include "hw_32x.h"
int32_t fix16_sqrt(int32_t value)
{
uint32_t t;
uint32_t r = value;
uint32_t b = 0x40000000;
uint32_t q = 0;
while (b > 0x40) {
t = q + b;
if (r >= t) {
r -= t;
q = t + b; /* Equivalent to q += 2 * b */
}
r <<= 1;
b >>= 1;
}
q >>= 8;
return q;
}

802
misc/32x/sh2_crt0.s Normal file
View File

@ -0,0 +1,802 @@
! SEGA 32X support code for SH2
! by Chilly Willy
! Rom header and SH2 init/exception code - must be first in object list
.text
! Standard MD Header at 0x000
.incbin "m68k_crt0.bin", 0, 0x3C0
! Standard Mars Header at 0x3C0
.ascii "32X Example " /* module name (16 chars) */
.long 0x00000000 /* version */
.long __text_end-0x02000000 /* Source (in ROM) */
.long 0x00000000 /* Destination (in SDRAM) */
.long __data_size /* Size */
.long 0x06000240 /* Master SH2 Jump */
.long 0x06000244 /* Slave SH2 Jump */
.long 0x06000000 /* Master SH2 VBR */
.long 0x06000120 /* Slave SH2 VBR */
! Standard MD startup code at 0x3F0
.incbin "m68k_crt1.bin"
.data
! Master Vector Base Table at 0x06000000
.long mstart /* Cold Start PC */
.long 0x0603FC00 /* Cold Start SP */
.long mstart /* Manual Reset PC */
.long 0x0603FC00 /* Manual Reset SP */
.long main_err /* Illegal instruction */
.long 0x00000000 /* reserved */
.long main_err /* Invalid slot instruction */
.long 0x20100400 /* reserved */
.long 0x20100420 /* reserved */
.long main_err /* CPU address error */
.long main_err /* DMA address error */
.long main_err /* NMI vector */
.long main_err /* User break vector */
.space 76 /* reserved */
.long main_err /* TRAPA #32 */
.long main_err /* TRAPA #33 */
.long main_err /* TRAPA #34 */
.long main_err /* TRAPA #35 */
.long main_err /* TRAPA #36 */
.long main_err /* TRAPA #37 */
.long main_err /* TRAPA #38 */
.long main_err /* TRAPA #39 */
.long main_err /* TRAPA #40 */
.long main_err /* TRAPA #41 */
.long main_err /* TRAPA #42 */
.long main_err /* TRAPA #43 */
.long main_err /* TRAPA #44 */
.long main_err /* TRAPA #45 */
.long main_err /* TRAPA #46 */
.long main_err /* TRAPA #47 */
.long main_err /* TRAPA #48 */
.long main_err /* TRAPA #49 */
.long main_err /* TRAPA #50 */
.long main_err /* TRAPA #51 */
.long main_err /* TRAPA #52 */
.long main_err /* TRAPA #53 */
.long main_err /* TRAPA #54 */
.long main_err /* TRAPA #55 */
.long main_err /* TRAPA #56 */
.long main_err /* TRAPA #57 */
.long main_err /* TRAPA #58 */
.long main_err /* TRAPA #59 */
.long main_err /* TRAPA #60 */
.long main_err /* TRAPA #61 */
.long main_err /* TRAPA #62 */
.long main_err /* TRAPA #63 */
.long main_irq /* Level 1 IRQ */
.long main_irq /* Level 2 & 3 IRQ's */
.long main_irq /* Level 4 & 5 IRQ's */
.long main_irq /* PWM interupt */
.long main_irq /* Command interupt */
.long main_irq /* H Blank interupt */
.long main_irq /* V Blank interupt */
.long main_irq /* Reset Button */
! Slave Vector Base Table at 0x06000120
.long sstart /* Cold Start PC */
.long 0x06040000 /* Cold Start SP */
.long sstart /* Manual Reset PC */
.long 0x06040000 /* Manual Reset SP */
.long slav_err /* Illegal instruction */
.long 0x00000000 /* reserved */
.long slav_err /* Invalid slot instruction */
.long 0x20100400 /* reserved */
.long 0x20100420 /* reserved */
.long slav_err /* CPU address error */
.long slav_err /* DMA address error */
.long slav_err /* NMI vector */
.long slav_err /* User break vector */
.space 76 /* reserved */
.long slav_err /* TRAPA #32 */
.long slav_err /* TRAPA #33 */
.long slav_err /* TRAPA #34 */
.long slav_err /* TRAPA #35 */
.long slav_err /* TRAPA #36 */
.long slav_err /* TRAPA #37 */
.long slav_err /* TRAPA #38 */
.long slav_err /* TRAPA #39 */
.long slav_err /* TRAPA #40 */
.long slav_err /* TRAPA #41 */
.long slav_err /* TRAPA #42 */
.long slav_err /* TRAPA #43 */
.long slav_err /* TRAPA #44 */
.long slav_err /* TRAPA #45 */
.long slav_err /* TRAPA #46 */
.long slav_err /* TRAPA #47 */
.long slav_err /* TRAPA #48 */
.long slav_err /* TRAPA #49 */
.long slav_err /* TRAPA #50 */
.long slav_err /* TRAPA #51 */
.long slav_err /* TRAPA #52 */
.long slav_err /* TRAPA #53 */
.long slav_err /* TRAPA #54 */
.long slav_err /* TRAPA #55 */
.long slav_err /* TRAPA #56 */
.long slav_err /* TRAPA #57 */
.long slav_err /* TRAPA #58 */
.long slav_err /* TRAPA #59 */
.long slav_err /* TRAPA #60 */
.long slav_err /* TRAPA #61 */
.long slav_err /* TRAPA #62 */
.long slav_err /* TRAPA #63 */
.long slav_irq /* Level 1 IRQ */
.long slav_irq /* Level 2 & 3 IRQ's */
.long slav_irq /* Level 4 & 5 IRQ's */
.long slav_irq /* PWM interupt */
.long slav_irq /* Command interupt */
.long slav_irq /* H Blank interupt */
.long slav_irq /* V Blank interupt */
.long slav_irq /* Reset Button */
! The main SH2 starts here at 0x06000240
mstart:
bra mcont
nop
! The slave SH2 starts here at 0x06000244
sstart:
bra scont
nop
! Each section of code below has its own data table so that the code
! can be extended without worrying about the offsets becoming too big.
! This results in duplicate entries, but not so many that we care. :)
mcont:
! clear interrupt flags
mov.l _master_int_clr,r1
mov.w r0,@-r1 /* PWM INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* CMD INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* H INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* V INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* VRES INT clear */
mov.w r0,@r1
mov.l _master_stk,r15
! purge cache and turn it off
mov.l _master_cctl,r0
mov #0x10,r1
mov.b r1,@r0
! clear bss
mov #0,r0
mov.l _master_bss_start,r1
mov.l _master_bss_end,r2
0:
mov.l r0,@r1
cmp/eq r1,r2
bf/s 0b
add #4,r1
! wait for 68000 to finish init
mov.l _master_sts,r0
mov.l _master_ok,r1
1:
mov.l @r0,r2
nop
nop
cmp/eq r1,r2
bt 1b
! do all initializers
mov.l _master_do_init,r0
jsr @r0
nop
! let Slave SH2 run
mov #0,r1
mov.l r1,@(4,r0) /* clear slave status */
mov #0x80,r0
mov.l _master_adapter,r1
mov.b r0,@r1 /* set FM */
mov #0x00,r0
mov.b r0,@(1,r1) /* set int enables */
mov #0x20,r0
ldc r0,sr /* allow ints */
! purge cache, turn it on, and run main()
mov.l _master_cctl,r0
mov #0x11,r1
mov.b r1,@r0
mov.l _master_go,r0
jsr @r0
nop
! do all finishers
mov.l _master_do_fini,r0
jsr @r0
nop
2:
bra 2b
nop
.align 2
_master_int_clr:
.long 0x2000401E /* one word passed last int clr reg */
_master_stk:
.long 0x0603FC00 /* Cold Start SP */
_master_sts:
.long 0x20004020
_master_ok:
.ascii "M_OK"
_master_adapter:
.long 0x20004000
_master_cctl:
.long 0xFFFFFE92
_master_go:
.long _main
_master_bss_start:
.long __bss_start
_master_bss_end:
.long __bss_end
_master_do_init:
.long __INIT_SECTION__
_master_do_fini:
.long __FINI_SECTION__
scont:
! clear interrupt flags
mov.l _slave_int_clr,r1
mov.w r0,@-r1 /* PWM INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* CMD INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* H INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* V INT clear */
mov.w r0,@r1
mov.w r0,@-r1 /* VRES INT clear */
mov.w r0,@r1
mov.l _slave_stk,r15
! wait for Master SH2 and 68000 to finish init
mov.l _slave_sts,r0
mov.l _slave_ok,r1
1:
mov.l @r0,r2
nop
nop
cmp/eq r1,r2
bt 1b
mov.l _slave_adapter,r1
mov #0x00,r0
mov.b r0,@(1,r1) /* set int enables (different from master despite same address!) */
mov #0x20,r0
ldc r0,sr /* allow ints */
! purge cache, turn it on, and run slave()
mov.l _slave_cctl,r0
mov #0x11,r1
mov.b r1,@r0
mov.l _slave_go,r0
jmp @r0
nop
.align 2
_slave_int_clr:
.long 0x2000401E /* one word passed last int clr reg */
_slave_stk:
.long 0x06040000 /* Cold Start SP */
_slave_sts:
.long 0x20004024
_slave_ok:
.ascii "S_OK"
_slave_adapter:
.long 0x20004000
_slave_cctl:
.long 0xFFFFFE92
_slave_go:
.long _slave
! Master exception handler
main_err:
rte
nop
! Master IRQ handler
main_irq:
mov.l r0,@-r15
stc sr,r0 /* SR holds IRQ level in I3-I0 */
shlr2 r0
and #0x38,r0
cmp/eq #0x28,r0
bt main_h_irq
cmp/eq #0x18,r0
bt main_pwm_irq
cmp/eq #0x30,r0
bt main_v_irq
cmp/eq #0x20,r0
bt main_cmd_irq
cmp/eq #0x38,r0
bt main_vres_irq
mov.l @r15+,r0
rte
nop
main_v_irq:
mov.l r1,@-r15
mov.l mvi_mars_adapter,r1
mov.w r0,@(0x16,r1) /* clear V IRQ */
nop
nop
nop
nop
! handle V IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
mvi_mars_adapter:
.long 0x20004000
main_h_irq:
mov.l r1,@-r15
mov.l mhi_mars_adapter,r1
mov.w r0,@(0x18,r1) /* clear H IRQ */
nop
nop
nop
nop
! handle H IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
mhi_mars_adapter:
.long 0x20004000
main_cmd_irq:
mov.l r1,@-r15
mov.l mci_mars_adapter,r1
mov.w r0,@(0x1A,r1) /* clear CMD IRQ */
nop
nop
nop
nop
! handle CMD IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
mci_mars_adapter:
.long 0x20004000
main_pwm_irq:
mov.l r1,@-r15
mov.l mpi_mars_adapter,r1
mov.w r0,@(0x1C,r1) /* clear PWM IRQ */
nop
nop
nop
nop
! handle PWM IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
mpi_mars_adapter:
.long 0x20004000
main_vres_irq:
mov.l mvri_mars_adapter,r1
mov.w r0,@(0x14,r1) /* clear VRES IRQ */
nop
nop
nop
nop
mov #0x0F,r0
shll2 r0
shll2 r0
ldc r0,sr /* disallow ints */
mov.l mvri_master_stk,r15
mov.l mvri_master_vres,r0
jmp @r0
nop
.align 2
mvri_mars_adapter:
.long 0x20004000
mvri_master_stk:
.long 0x0603FC00 /* Cold Start SP */
mvri_master_vres:
.long main_reset
! Slave exception handler
slav_err:
rte
nop
! Slave IRQ handler
slav_irq:
mov.l r0,@-r15
stc sr,r0 /* SR holds IRQ level I3-I0 */
shlr2 r0
and #0x38,r0
cmp/eq #0x28,r0
bt slav_h_irq
cmp/eq #0x18,r0
bt slav_pwm_irq
cmp/eq #0x30,r0
bt slav_v_irq
cmp/eq #0x20,r0
bt slav_cmd_irq
cmp/eq #0x38,r0
bt slav_vres_irq
mov.l @r15+,r0
rte
nop
slav_v_irq:
mov.l r1,@-r15
mov.l svi_mars_adapter,r1
mov.w r0,@(0x16,r1) /* clear V IRQ */
nop
nop
nop
nop
! handle V IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
svi_mars_adapter:
.long 0x20004000
slav_h_irq:
mov.l r1,@-r15
mov.l shi_mars_adapter,r1
mov.w r0,@(0x18,r1) /* clear H IRQ */
nop
nop
nop
nop
! handle H IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
shi_mars_adapter:
.long 0x20004000
slav_cmd_irq:
mov.l r1,@-r15
mov.l sci_mars_adapter,r1
mov.w r0,@(0x1A,r1) /* clear CMD IRQ */
nop
nop
nop
nop
! handle CMD IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
sci_mars_adapter:
.long 0x20004000
slav_pwm_irq:
mov.l r1,@-r15
mov.l spi_mars_adapter,r1
mov.w r0,@(0x1C,r1) /* clear PWM IRQ */
nop
nop
nop
nop
! handle PWM IRQ
mov.l @r15+,r1
mov.l @r15+,r0
rte
nop
.align 2
spi_mars_adapter:
.long 0x20004000
slav_vres_irq:
mov.l svri_mars_adapter,r1
mov.w r0,@(0x14,r1) /* clear VRES IRQ */
nop
nop
nop
nop
mov #0x0F,r0
shll2 r0
shll2 r0
ldc r0,sr /* disallow ints */
mov.l svri_slave_stk,r15
mov.l svri_slave_vres,r0
jmp @r0
nop
.align 2
svri_mars_adapter:
.long 0x20004000
svri_slave_stk:
.long 0x06040000 /* Cold Start SP */
svri_slave_vres:
.long slav_reset
! Fast memcpy function - copies longs, runs from sdram for speed
! On entry: r4 = dst, r5 = src, r6 = len (in longs)
.align 4
.global _fast_memcpy
_fast_memcpy:
mov.l @r5+,r3
mov.l r3,@r4
dt r6
bf/s _fast_memcpy
add #4,r4
rts
nop
! Cache clear line function
! On entry: r4 = ptr - should be 16 byte aligned
.align 4
.global _CacheClearLine
_CacheClearLine:
mov.l _cache_flush,r0
or r0,r4
mov #0,r0
mov.l r0,@r4
rts
nop
.align 2
_cache_flush:
.long 0x40000000
! Cache control function
! On entry: r4 = cache mode => 0x10 = CP, 0x08 = TW, 0x01 = CE
.align 4
.global _CacheControl
_CacheControl:
mov.l _sh2_cctl,r0
mov.b r4,@r0
rts
nop
.align 2
_sh2_cctl:
.long 0xFFFFFE92
! void ScreenStretch(int src, int width, int height, int interp);
! On entry: r4 = src pointer, r5 = width, r6 = height, r7 = interpolate
.align 4
.global _ScreenStretch
_ScreenStretch:
cmp/pl r7
bt ss_interp
! stretch screen without interpolation
0:
mov r5,r3
shll r3
mov r3,r2
shll r2
add r4,r3
add r4,r2
1:
add #-2,r3
mov.w @r3,r0
extu.w r0,r1
shll16 r0
or r1,r0
mov.l r0,@-r2
cmp/eq r3,r4
bf 1b
/* next line */
mov.w ss_pitch,r0
dt r6
bf/s 0b
add r0,r4
rts
nop
ss_interp:
! stretch screen with interpolation
0:
mov r5,r3
shll r3
mov r3,r2
shll r2
add r4,r3
add r4,r2
mov #0,r7
1:
add #-2,r3
mov.w @r3,r0
mov.w ss_mask,r1
and r0,r1 /* masked curr pixel */
shll16 r0
add r1,r7 /* add to masked prev pixel */
shlr r7 /* blended pixel */
or r7,r0 /* curr pixel << 16 | blended pixel */
mov r1,r7 /* masked prev pixel = masked curr pixel */
mov.l r0,@-r2
cmp/eq r3,r4
bf 1b
/* next line */
mov.w ss_pitch,r0
dt r6
bf/s 0b
add r0,r4
rts
nop
ss_mask:
.word 0x7BDE
ss_pitch:
.word 640
.align 2
.text
main_reset:
! do any master SH2 specific reset code here
mov.l slav_st,r0
mov.l slav_ok,r1
0:
mov.l @r0,r2
nop
nop
cmp/eq r1,r2
bf 0b /* wait for slave */
! recopy rom data to sdram
mov.l rom_header,r1
mov.l @r1,r2 /* src relative to start of rom */
mov.l @(4,r1),r3 /* dst relative to start of sdram */
mov.l @(8,r1),r4 /* size (longword aligned) */
mov.l rom_start,r1
add r1,r2
mov.l sdram_start,r1
add r1,r3
shlr2 r4 /* number of longs */
add #-1,r4
1:
mov.l @r2+,r0
mov.l r0,@r3
add #4,r3
dt r4
bf 1b
mov.l main_st,r0
mov.l main_ok,r1
mov.l r1,@r0 /* tell everyone reset complete */
mov.l main_go,r0
jmp @r0
nop
slav_reset:
! do any slave SH2 specific reset code here
mov.l slav_st,r0
mov.l slav_ok,r1
mov.l r1,@r0 /* tell master to start reset */
mov.l main_st,r0
mov.l main_ok,r1
0:
mov.l @r0,r2
nop
nop
cmp/eq r1,r2
bf 0b /* wait for master to do the work */
mov.l slav_go,r0
jmp @r0
nop
.align 2
main_st:
.long 0x20004020
main_ok:
.ascii "M_OK"
main_go:
.long mstart
rom_header:
.long 0x220003D4
rom_start:
.long 0x22000000
sdram_start:
.long 0x26000000
slav_st:
.long 0x20004024
slav_ok:
.ascii "S_OK"
slav_go:
.long sstart
.global _start
_start:

View File

@ -1,64 +0,0 @@
from http.server import HTTPServer, SimpleHTTPRequestHandler
import os
import subprocess
build_files = {
'/ClassiCube.exe' : 'cc-w32-d3d.exe', '/ClassiCube.opengl.exe' : 'cc-w32-ogl.exe',
'/ClassiCube.64.exe' : 'cc-w64-d3d.exe', '/ClassiCube.64-opengl.exe' : 'cc-w64-ogl.exe',
'/ClassiCube.32' : 'cc-nix32', '/ClassiCube' : 'cc-nix64',
'/ClassiCube.osx' : 'cc-osx32', '/ClassiCube.64.osx' : 'cc-osx64',
'/ClassiCube.js' : 'cc.js', '/ClassiCube.apk' : 'cc.apk',
'/ClassiCube.rpi' : 'cc-rpi',
'/cc-nix32-gl2' : 'cc-nix32-gl2', '/cc-nix64-gl2' : 'cc-nix64-gl2',
'/cc-osx32-gl2' : 'cc-osx32-gl2', '/cc-osx64-gl2' : 'cc-osx64-gl2',
}
release_files = {
'/win32' : 'win32/ClassiCube.exe', '/win64' : 'win64/ClassiCube.exe',
'/osx32' : 'osx32/ClassiCube.tar.gz', '/osx64' : 'osx64/ClassiCube.tar.gz',
'/mac32' : 'mac32/ClassiCube.tar.gz', '/mac64' : 'mac64/ClassiCube.tar.gz',
'/nix32' : 'nix32/ClassiCube.tar.gz', '/nix64' : 'nix64/ClassiCube.tar.gz',
'/rpi32' : 'rpi32/ClassiCube.tar.gz',
}
def run_script(file):
args = ["sh", file]
su = subprocess.Popen(args)
return su.wait()
class Handler(SimpleHTTPRequestHandler):
def serve_script(self, file, msg):
ret = run_script(file)
self.send_response(200)
self.end_headers()
self.wfile.write(msg % ret)
def do_GET(self):
if self.path in build_files:
self.serve_exe('client/src/' + build_files[self.path])
elif self.path in release_files:
self.serve_exe('client/release/' + release_files[self.path])
elif self.path == '/rebuild':
self.serve_script('build.sh', 'Rebuild client (%s)')
elif self.path == '/release':
self.serve_script('build_release.sh', 'Package release (%s)')
else:
self.send_error(404, "Unknown action")
return
def serve_exe(self, path):
try:
f = open(path, 'rb')
fs = os.fstat(f.fileno())
self.send_response(200)
self.send_header("Content-type", "application/octet-stream")
self.send_header("Content-Length", str(fs[6]))
self.end_headers()
self.copyfile(f, self.wfile)
f.close()
except IOError:
self.send_error(404, "File not found")
httpd = HTTPServer(('', 80), Handler)
httpd.serve_forever()

View File

@ -1,60 +0,0 @@
#!/bin/bash
# paths, change these as needed
SOURCE_DIR=~/client/src
MISC_DIR=~/client/misc
BUILDS_DIR=~/client/release
# ./ClassiCube
make_nix_tar() {
cp $SOURCE_DIR/$1 ClassiCube
chmod +x ClassiCube
tar -zcvf ClassiCube.tar.gz ClassiCube
rm ClassiCube
}
# ./ClassiCube.app/Info.plist
# ./ClassiCube.app/Contents/MacOS/ClassiCube
# ./ClassiCube.app/Resources/ClassiCube.icns
make_mac_tar() {
mkdir ClassiCube.app
mkdir ClassiCube.app/Contents
mkdir ClassiCube.app/Contents/MacOS
mkdir ClassiCube.app/Contents/Resources
cp $SOURCE_DIR/$1 ClassiCube.app/Contents/MacOS/ClassiCube
chmod +x ClassiCube.app/Contents/MacOS/ClassiCube
cp $MISC_DIR/info.plist ClassiCube.app/Contents/Info.plist
cp $MISC_DIR/CCIcon.icns ClassiCube.app/Contents/Resources/ClassiCube.icns
tar -zcvf ClassiCube.tar.gz ClassiCube.app
rm -rf ClassiCube.app
}
mkdir -p $BUILDS_DIR
mkdir -p $BUILDS_DIR/win32 $BUILDS_DIR/win64 $BUILDS_DIR/osx32 $BUILDS_DIR/osx64
mkdir -p $BUILDS_DIR/nix32 $BUILDS_DIR/nix64 $BUILDS_DIR/mac32 $BUILDS_DIR/mac64
mkdir -p $BUILDS_DIR/rpi32
# edge doesn't respect download attribute, and having ClassiCube.64.exe breaks plugins
cp $SOURCE_DIR/cc-w32-d3d.exe $BUILDS_DIR/win32/ClassiCube.exe
cp $SOURCE_DIR/cc-w64-d3d.exe $BUILDS_DIR/win64/ClassiCube.exe
# use tar to preserve chmod +x, so users don't have to manually do it
cd $BUILDS_DIR/osx32/
make_nix_tar cc-osx32
cd $BUILDS_DIR/osx64/
make_nix_tar cc-osx64
cd $BUILDS_DIR/nix32/
make_nix_tar cc-nix32
cd $BUILDS_DIR/nix64/
make_nix_tar cc-nix64
cd $BUILDS_DIR/rpi32/
make_nix_tar cc-rpi
# generate ClassiCube.app for mac users
cd $BUILDS_DIR/mac32/
make_mac_tar cc-osx32
cd $BUILDS_DIR/mac64/
make_mac_tar cc-osx64

View File

@ -1,34 +0,0 @@
import requests, re, datetime, json, time, os
# Any resemblence to any discord bots written by 123DMWM is purely coincidental. I swear.
# The URL of the discord channel webhook to notify
# You can generate a webhook by right clicking channel -> Edit Channel -> Webhooks
WEBHOOK_URL = ''
# The ID of the user you want to ping on a build failure
# You can get this by right clicking user -> Copy ID
# You may have to go to settings -> Appearance -> Check Developer Mode to see this option
TARGET_USER = ''
def notify_webhook(body):
try:
webhook_data = {
"username": "CC BuildBot",
"avatar_url": "https://static.classicube.net/img/cc-cube-small.png",
"content" : body
}
r = requests.post(WEBHOOK_URL, json=webhook_data)
print("BuildNotify response: " + r.text)
except Exception as e:
print("BuildNotify failed: %s" % (e))
cc_errors = None
try:
with open(sys.argv[1], 'r') as file:
cc_errors = file.read()
except FileNotFoundError:
# nothing to as no compile errors
pass
if cc_errors:
notify_webhook('**Houston, we have a problem** <@%s>\n\n%s' % (TARGET_USER, cc_errors))

View File

@ -2,8 +2,5 @@ This folder contains build scripts for automatically compiling ClassiCube
|File|Description|
|--------|-------|
|buildbot.sh | Compiles the game to optimised executables (with icons) |
|buildbot_plugin.sh | Compiles specified plugin for various platforms |
|buildtestplugin.sh | Example script for how to use buildbot_plugin.sh |
|makerelease.sh | Packages the executables to produce files for a release |
|notify.py | Notifies a user on Discord if buildbot fails |
|buildtestplugin.sh | Example script for how to use buildbot_plugin.sh |

View File

@ -1,13 +0,0 @@
# upload_build.sh [TARGET NAME] [SOURCE FILE]
# e.g. ~/upload_build.sh latest/ClassiCube.ipa cc.ipa
API_URL=
API_KEY=
if [ -s $2 ]; then
curl $API_URL \
--header "X-Build-Key:$API_KEY" \
--header "X-Build-Name:$1" \
--data-binary @$2
else
echo "Missing or empty file: $2"
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
-----BEGIN CERTIFICATE-----
MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB
iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw
MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV
BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy
dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK
AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B
3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY
tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/
Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2
VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT
79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6
c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT
Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l
c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee
UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE
Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G
A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF
Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO
VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3
ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs
8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR
iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze
Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ
XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/
qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB
VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB
L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG
jjxDah2nGN59PRbxYvnKkKj9
-----END CERTIFICATE-----

View File

@ -1,348 +1,382 @@
// This file includes the following root certificates:
// - DigiCert Global Root (dropbox.com)
// - DigiCert Global Root G2 (resources.download.minecraft.net)
// - ISRG Root X1 (catbox.moe)
// - ISRG Root X2 (123dmwm.com, garbage.loan)
// - Baltimore CyberTrust Root (classicube.net)
// - USERTrust RSA (imgur.com)
// Generated using "brssl -ta [cert 1] [cert 2].." from BearSSL
static const unsigned char TA0_DN[] = {
0x30, 0x61, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x0C, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x49,
0x6E, 0x63, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13,
0x10, 0x77, 0x77, 0x77, 0x2E, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72,
0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x17, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74,
0x20, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x52, 0x6F, 0x6F, 0x74,
0x20, 0x43, 0x41
};
static const unsigned char TA0_RSA_N[] = {
0xE2, 0x3B, 0xE1, 0x11, 0x72, 0xDE, 0xA8, 0xA4, 0xD3, 0xA3, 0x57, 0xAA,
0x50, 0xA2, 0x8F, 0x0B, 0x77, 0x90, 0xC9, 0xA2, 0xA5, 0xEE, 0x12, 0xCE,
0x96, 0x5B, 0x01, 0x09, 0x20, 0xCC, 0x01, 0x93, 0xA7, 0x4E, 0x30, 0xB7,
0x53, 0xF7, 0x43, 0xC4, 0x69, 0x00, 0x57, 0x9D, 0xE2, 0x8D, 0x22, 0xDD,
0x87, 0x06, 0x40, 0x00, 0x81, 0x09, 0xCE, 0xCE, 0x1B, 0x83, 0xBF, 0xDF,
0xCD, 0x3B, 0x71, 0x46, 0xE2, 0xD6, 0x66, 0xC7, 0x05, 0xB3, 0x76, 0x27,
0x16, 0x8F, 0x7B, 0x9E, 0x1E, 0x95, 0x7D, 0xEE, 0xB7, 0x48, 0xA3, 0x08,
0xDA, 0xD6, 0xAF, 0x7A, 0x0C, 0x39, 0x06, 0x65, 0x7F, 0x4A, 0x5D, 0x1F,
0xBC, 0x17, 0xF8, 0xAB, 0xBE, 0xEE, 0x28, 0xD7, 0x74, 0x7F, 0x7A, 0x78,
0x99, 0x59, 0x85, 0x68, 0x6E, 0x5C, 0x23, 0x32, 0x4B, 0xBF, 0x4E, 0xC0,
0xE8, 0x5A, 0x6D, 0xE3, 0x70, 0xBF, 0x77, 0x10, 0xBF, 0xFC, 0x01, 0xF6,
0x85, 0xD9, 0xA8, 0x44, 0x10, 0x58, 0x32, 0xA9, 0x75, 0x18, 0xD5, 0xD1,
0xA2, 0xBE, 0x47, 0xE2, 0x27, 0x6A, 0xF4, 0x9A, 0x33, 0xF8, 0x49, 0x08,
0x60, 0x8B, 0xD4, 0x5F, 0xB4, 0x3A, 0x84, 0xBF, 0xA1, 0xAA, 0x4A, 0x4C,
0x7D, 0x3E, 0xCF, 0x4F, 0x5F, 0x6C, 0x76, 0x5E, 0xA0, 0x4B, 0x37, 0x91,
0x9E, 0xDC, 0x22, 0xE6, 0x6D, 0xCE, 0x14, 0x1A, 0x8E, 0x6A, 0xCB, 0xFE,
0xCD, 0xB3, 0x14, 0x64, 0x17, 0xC7, 0x5B, 0x29, 0x9E, 0x32, 0xBF, 0xF2,
0xEE, 0xFA, 0xD3, 0x0B, 0x42, 0xD4, 0xAB, 0xB7, 0x41, 0x32, 0xDA, 0x0C,
0xD4, 0xEF, 0xF8, 0x81, 0xD5, 0xBB, 0x8D, 0x58, 0x3F, 0xB5, 0x1B, 0xE8,
0x49, 0x28, 0xA2, 0x70, 0xDA, 0x31, 0x04, 0xDD, 0xF7, 0xB2, 0x16, 0xF2,
0x4C, 0x0A, 0x4E, 0x07, 0xA8, 0xED, 0x4A, 0x3D, 0x5E, 0xB5, 0x7F, 0xA3,
0x90, 0xC3, 0xAF, 0x27
};
static const unsigned char TA0_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA1_DN[] = {
0x30, 0x61, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x0C, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x49,
0x6E, 0x63, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13,
0x10, 0x77, 0x77, 0x77, 0x2E, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72,
0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x17, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74,
0x20, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x52, 0x6F, 0x6F, 0x74,
0x20, 0x47, 0x32
};
static const unsigned char TA1_RSA_N[] = {
0xBB, 0x37, 0xCD, 0x34, 0xDC, 0x7B, 0x6B, 0xC9, 0xB2, 0x68, 0x90, 0xAD,
0x4A, 0x75, 0xFF, 0x46, 0xBA, 0x21, 0x0A, 0x08, 0x8D, 0xF5, 0x19, 0x54,
0xC9, 0xFB, 0x88, 0xDB, 0xF3, 0xAE, 0xF2, 0x3A, 0x89, 0x91, 0x3C, 0x7A,
0xE6, 0xAB, 0x06, 0x1A, 0x6B, 0xCF, 0xAC, 0x2D, 0xE8, 0x5E, 0x09, 0x24,
0x44, 0xBA, 0x62, 0x9A, 0x7E, 0xD6, 0xA3, 0xA8, 0x7E, 0xE0, 0x54, 0x75,
0x20, 0x05, 0xAC, 0x50, 0xB7, 0x9C, 0x63, 0x1A, 0x6C, 0x30, 0xDC, 0xDA,
0x1F, 0x19, 0xB1, 0xD7, 0x1E, 0xDE, 0xFD, 0xD7, 0xE0, 0xCB, 0x94, 0x83,
0x37, 0xAE, 0xEC, 0x1F, 0x43, 0x4E, 0xDD, 0x7B, 0x2C, 0xD2, 0xBD, 0x2E,
0xA5, 0x2F, 0xE4, 0xA9, 0xB8, 0xAD, 0x3A, 0xD4, 0x99, 0xA4, 0xB6, 0x25,
0xE9, 0x9B, 0x6B, 0x00, 0x60, 0x92, 0x60, 0xFF, 0x4F, 0x21, 0x49, 0x18,
0xF7, 0x67, 0x90, 0xAB, 0x61, 0x06, 0x9C, 0x8F, 0xF2, 0xBA, 0xE9, 0xB4,
0xE9, 0x92, 0x32, 0x6B, 0xB5, 0xF3, 0x57, 0xE8, 0x5D, 0x1B, 0xCD, 0x8C,
0x1D, 0xAB, 0x95, 0x04, 0x95, 0x49, 0xF3, 0x35, 0x2D, 0x96, 0xE3, 0x49,
0x6D, 0xDD, 0x77, 0xE3, 0xFB, 0x49, 0x4B, 0xB4, 0xAC, 0x55, 0x07, 0xA9,
0x8F, 0x95, 0xB3, 0xB4, 0x23, 0xBB, 0x4C, 0x6D, 0x45, 0xF0, 0xF6, 0xA9,
0xB2, 0x95, 0x30, 0xB4, 0xFD, 0x4C, 0x55, 0x8C, 0x27, 0x4A, 0x57, 0x14,
0x7C, 0x82, 0x9D, 0xCD, 0x73, 0x92, 0xD3, 0x16, 0x4A, 0x06, 0x0C, 0x8C,
0x50, 0xD1, 0x8F, 0x1E, 0x09, 0xBE, 0x17, 0xA1, 0xE6, 0x21, 0xCA, 0xFD,
0x83, 0xE5, 0x10, 0xBC, 0x83, 0xA5, 0x0A, 0xC4, 0x67, 0x28, 0xF6, 0x73,
0x14, 0x14, 0x3D, 0x46, 0x76, 0xC3, 0x87, 0x14, 0x89, 0x21, 0x34, 0x4D,
0xAF, 0x0F, 0x45, 0x0C, 0xA6, 0x49, 0xA1, 0xBA, 0xBB, 0x9C, 0xC5, 0xB1,
0x33, 0x83, 0x29, 0x85
};
static const unsigned char TA1_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA2_DN[] = {
0x30, 0x4F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x20, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x53,
0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65,
0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x15,
0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x49, 0x53, 0x52,
0x47, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x58, 0x31
};
static const unsigned char TA2_RSA_N[] = {
0xAD, 0xE8, 0x24, 0x73, 0xF4, 0x14, 0x37, 0xF3, 0x9B, 0x9E, 0x2B, 0x57,
0x28, 0x1C, 0x87, 0xBE, 0xDC, 0xB7, 0xDF, 0x38, 0x90, 0x8C, 0x6E, 0x3C,
0xE6, 0x57, 0xA0, 0x78, 0xF7, 0x75, 0xC2, 0xA2, 0xFE, 0xF5, 0x6A, 0x6E,
0xF6, 0x00, 0x4F, 0x28, 0xDB, 0xDE, 0x68, 0x86, 0x6C, 0x44, 0x93, 0xB6,
0xB1, 0x63, 0xFD, 0x14, 0x12, 0x6B, 0xBF, 0x1F, 0xD2, 0xEA, 0x31, 0x9B,
0x21, 0x7E, 0xD1, 0x33, 0x3C, 0xBA, 0x48, 0xF5, 0xDD, 0x79, 0xDF, 0xB3,
0xB8, 0xFF, 0x12, 0xF1, 0x21, 0x9A, 0x4B, 0xC1, 0x8A, 0x86, 0x71, 0x69,
0x4A, 0x66, 0x66, 0x6C, 0x8F, 0x7E, 0x3C, 0x70, 0xBF, 0xAD, 0x29, 0x22,
0x06, 0xF3, 0xE4, 0xC0, 0xE6, 0x80, 0xAE, 0xE2, 0x4B, 0x8F, 0xB7, 0x99,
0x7E, 0x94, 0x03, 0x9F, 0xD3, 0x47, 0x97, 0x7C, 0x99, 0x48, 0x23, 0x53,
0xE8, 0x38, 0xAE, 0x4F, 0x0A, 0x6F, 0x83, 0x2E, 0xD1, 0x49, 0x57, 0x8C,
0x80, 0x74, 0xB6, 0xDA, 0x2F, 0xD0, 0x38, 0x8D, 0x7B, 0x03, 0x70, 0x21,
0x1B, 0x75, 0xF2, 0x30, 0x3C, 0xFA, 0x8F, 0xAE, 0xDD, 0xDA, 0x63, 0xAB,
0xEB, 0x16, 0x4F, 0xC2, 0x8E, 0x11, 0x4B, 0x7E, 0xCF, 0x0B, 0xE8, 0xFF,
0xB5, 0x77, 0x2E, 0xF4, 0xB2, 0x7B, 0x4A, 0xE0, 0x4C, 0x12, 0x25, 0x0C,
0x70, 0x8D, 0x03, 0x29, 0xA0, 0xE1, 0x53, 0x24, 0xEC, 0x13, 0xD9, 0xEE,
0x19, 0xBF, 0x10, 0xB3, 0x4A, 0x8C, 0x3F, 0x89, 0xA3, 0x61, 0x51, 0xDE,
0xAC, 0x87, 0x07, 0x94, 0xF4, 0x63, 0x71, 0xEC, 0x2E, 0xE2, 0x6F, 0x5B,
0x98, 0x81, 0xE1, 0x89, 0x5C, 0x34, 0x79, 0x6C, 0x76, 0xEF, 0x3B, 0x90,
0x62, 0x79, 0xE6, 0xDB, 0xA4, 0x9A, 0x2F, 0x26, 0xC5, 0xD0, 0x10, 0xE1,
0x0E, 0xDE, 0xD9, 0x10, 0x8E, 0x16, 0xFB, 0xB7, 0xF7, 0xA8, 0xF7, 0xC7,
0xE5, 0x02, 0x07, 0x98, 0x8F, 0x36, 0x08, 0x95, 0xE7, 0xE2, 0x37, 0x96,
0x0D, 0x36, 0x75, 0x9E, 0xFB, 0x0E, 0x72, 0xB1, 0x1D, 0x9B, 0xBC, 0x03,
0xF9, 0x49, 0x05, 0xD8, 0x81, 0xDD, 0x05, 0xB4, 0x2A, 0xD6, 0x41, 0xE9,
0xAC, 0x01, 0x76, 0x95, 0x0A, 0x0F, 0xD8, 0xDF, 0xD5, 0xBD, 0x12, 0x1F,
0x35, 0x2F, 0x28, 0x17, 0x6C, 0xD2, 0x98, 0xC1, 0xA8, 0x09, 0x64, 0x77,
0x6E, 0x47, 0x37, 0xBA, 0xCE, 0xAC, 0x59, 0x5E, 0x68, 0x9D, 0x7F, 0x72,
0xD6, 0x89, 0xC5, 0x06, 0x41, 0x29, 0x3E, 0x59, 0x3E, 0xDD, 0x26, 0xF5,
0x24, 0xC9, 0x11, 0xA7, 0x5A, 0xA3, 0x4C, 0x40, 0x1F, 0x46, 0xA1, 0x99,
0xB5, 0xA7, 0x3A, 0x51, 0x6E, 0x86, 0x3B, 0x9E, 0x7D, 0x72, 0xA7, 0x12,
0x05, 0x78, 0x59, 0xED, 0x3E, 0x51, 0x78, 0x15, 0x0B, 0x03, 0x8F, 0x8D,
0xD0, 0x2F, 0x05, 0xB2, 0x3E, 0x7B, 0x4A, 0x1C, 0x4B, 0x73, 0x05, 0x12,
0xFC, 0xC6, 0xEA, 0xE0, 0x50, 0x13, 0x7C, 0x43, 0x93, 0x74, 0xB3, 0xCA,
0x74, 0xE7, 0x8E, 0x1F, 0x01, 0x08, 0xD0, 0x30, 0xD4, 0x5B, 0x71, 0x36,
0xB4, 0x07, 0xBA, 0xC1, 0x30, 0x30, 0x5C, 0x48, 0xB7, 0x82, 0x3B, 0x98,
0xA6, 0x7D, 0x60, 0x8A, 0xA2, 0xA3, 0x29, 0x82, 0xCC, 0xBA, 0xBD, 0x83,
0x04, 0x1B, 0xA2, 0x83, 0x03, 0x41, 0xA1, 0xD6, 0x05, 0xF1, 0x1B, 0xC2,
0xB6, 0xF0, 0xA8, 0x7C, 0x86, 0x3B, 0x46, 0xA8, 0x48, 0x2A, 0x88, 0xDC,
0x76, 0x9A, 0x76, 0xBF, 0x1F, 0x6A, 0xA5, 0x3D, 0x19, 0x8F, 0xEB, 0x38,
0xF3, 0x64, 0xDE, 0xC8, 0x2B, 0x0D, 0x0A, 0x28, 0xFF, 0xF7, 0xDB, 0xE2,
0x15, 0x42, 0xD4, 0x22, 0xD0, 0x27, 0x5D, 0xE1, 0x79, 0xFE, 0x18, 0xE7,
0x70, 0x88, 0xAD, 0x4E, 0xE6, 0xD9, 0x8B, 0x3A, 0xC6, 0xDD, 0x27, 0x51,
0x6E, 0xFF, 0xBC, 0x64, 0xF5, 0x33, 0x43, 0x4F
};
static const unsigned char TA2_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA3_DN[] = {
0x30, 0x4F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x20, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x53,
0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65,
0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x15,
0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x49, 0x53, 0x52,
0x47, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x58, 0x32
};
static const unsigned char TA3_EC_Q[] = {
0x04, 0xCD, 0x9B, 0xD5, 0x9F, 0x80, 0x83, 0x0A, 0xEC, 0x09, 0x4A, 0xF3,
0x16, 0x4A, 0x3E, 0x5C, 0xCF, 0x77, 0xAC, 0xDE, 0x67, 0x05, 0x0D, 0x1D,
0x07, 0xB6, 0xDC, 0x16, 0xFB, 0x5A, 0x8B, 0x14, 0xDB, 0xE2, 0x71, 0x60,
0xC4, 0xBA, 0x45, 0x95, 0x11, 0x89, 0x8E, 0xEA, 0x06, 0xDF, 0xF7, 0x2A,
0x16, 0x1C, 0xA4, 0xB9, 0xC5, 0xC5, 0x32, 0xE0, 0x03, 0xE0, 0x1E, 0x82,
0x18, 0x38, 0x8B, 0xD7, 0x45, 0xD8, 0x0A, 0x6A, 0x6E, 0xE6, 0x00, 0x77,
0xFB, 0x02, 0x51, 0x7D, 0x22, 0xD8, 0x0A, 0x6E, 0x9A, 0x5B, 0x77, 0xDF,
0xF0, 0xFA, 0x41, 0xEC, 0x39, 0xDC, 0x75, 0xCA, 0x68, 0x07, 0x0C, 0x1F,
0xEA
};
static const unsigned char TA4_DN[] = {
0x30, 0x5A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x49, 0x45, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x09, 0x42, 0x61, 0x6C, 0x74, 0x69, 0x6D, 0x6F, 0x72, 0x65, 0x31,
0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0A, 0x43, 0x79,
0x62, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x31, 0x22, 0x30, 0x20,
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x19, 0x42, 0x61, 0x6C, 0x74, 0x69,
0x6D, 0x6F, 0x72, 0x65, 0x20, 0x43, 0x79, 0x62, 0x65, 0x72, 0x54, 0x72,
0x75, 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74
};
static const unsigned char TA4_RSA_N[] = {
0xA3, 0x04, 0xBB, 0x22, 0xAB, 0x98, 0x3D, 0x57, 0xE8, 0x26, 0x72, 0x9A,
0xB5, 0x79, 0xD4, 0x29, 0xE2, 0xE1, 0xE8, 0x95, 0x80, 0xB1, 0xB0, 0xE3,
0x5B, 0x8E, 0x2B, 0x29, 0x9A, 0x64, 0xDF, 0xA1, 0x5D, 0xED, 0xB0, 0x09,
0x05, 0x6D, 0xDB, 0x28, 0x2E, 0xCE, 0x62, 0xA2, 0x62, 0xFE, 0xB4, 0x88,
0xDA, 0x12, 0xEB, 0x38, 0xEB, 0x21, 0x9D, 0xC0, 0x41, 0x2B, 0x01, 0x52,
0x7B, 0x88, 0x77, 0xD3, 0x1C, 0x8F, 0xC7, 0xBA, 0xB9, 0x88, 0xB5, 0x6A,
0x09, 0xE7, 0x73, 0xE8, 0x11, 0x40, 0xA7, 0xD1, 0xCC, 0xCA, 0x62, 0x8D,
0x2D, 0xE5, 0x8F, 0x0B, 0xA6, 0x50, 0xD2, 0xA8, 0x50, 0xC3, 0x28, 0xEA,
0xF5, 0xAB, 0x25, 0x87, 0x8A, 0x9A, 0x96, 0x1C, 0xA9, 0x67, 0xB8, 0x3F,
0x0C, 0xD5, 0xF7, 0xF9, 0x52, 0x13, 0x2F, 0xC2, 0x1B, 0xD5, 0x70, 0x70,
0xF0, 0x8F, 0xC0, 0x12, 0xCA, 0x06, 0xCB, 0x9A, 0xE1, 0xD9, 0xCA, 0x33,
0x7A, 0x77, 0xD6, 0xF8, 0xEC, 0xB9, 0xF1, 0x68, 0x44, 0x42, 0x48, 0x13,
0xD2, 0xC0, 0xC2, 0xA4, 0xAE, 0x5E, 0x60, 0xFE, 0xB6, 0xA6, 0x05, 0xFC,
0xB4, 0xDD, 0x07, 0x59, 0x02, 0xD4, 0x59, 0x18, 0x98, 0x63, 0xF5, 0xA5,
0x63, 0xE0, 0x90, 0x0C, 0x7D, 0x5D, 0xB2, 0x06, 0x7A, 0xF3, 0x85, 0xEA,
0xEB, 0xD4, 0x03, 0xAE, 0x5E, 0x84, 0x3E, 0x5F, 0xFF, 0x15, 0xED, 0x69,
0xBC, 0xF9, 0x39, 0x36, 0x72, 0x75, 0xCF, 0x77, 0x52, 0x4D, 0xF3, 0xC9,
0x90, 0x2C, 0xB9, 0x3D, 0xE5, 0xC9, 0x23, 0x53, 0x3F, 0x1F, 0x24, 0x98,
0x21, 0x5C, 0x07, 0x99, 0x29, 0xBD, 0xC6, 0x3A, 0xEC, 0xE7, 0x6E, 0x86,
0x3A, 0x6B, 0x97, 0x74, 0x63, 0x33, 0xBD, 0x68, 0x18, 0x31, 0xF0, 0x78,
0x8D, 0x76, 0xBF, 0xFC, 0x9E, 0x8E, 0x5D, 0x2A, 0x86, 0xA7, 0x4D, 0x90,
0xDC, 0x27, 0x1A, 0x39
};
static const unsigned char TA4_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA5_DN[] = {
0x30, 0x81, 0x88, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
0x08, 0x13, 0x0A, 0x4E, 0x65, 0x77, 0x20, 0x4A, 0x65, 0x72, 0x73, 0x65,
0x79, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0B,
0x4A, 0x65, 0x72, 0x73, 0x65, 0x79, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31,
0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x54, 0x68,
0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20,
0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x2E, 0x30, 0x2C, 0x06,
0x03, 0x55, 0x04, 0x03, 0x13, 0x25, 0x55, 0x53, 0x45, 0x52, 0x54, 0x72,
0x75, 0x73, 0x74, 0x20, 0x52, 0x53, 0x41, 0x20, 0x43, 0x65, 0x72, 0x74,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75,
0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79
};
static const unsigned char TA5_RSA_N[] = {
0x80, 0x12, 0x65, 0x17, 0x36, 0x0E, 0xC3, 0xDB, 0x08, 0xB3, 0xD0, 0xAC,
0x57, 0x0D, 0x76, 0xED, 0xCD, 0x27, 0xD3, 0x4C, 0xAD, 0x50, 0x83, 0x61,
0xE2, 0xAA, 0x20, 0x4D, 0x09, 0x2D, 0x64, 0x09, 0xDC, 0xCE, 0x89, 0x9F,
0xCC, 0x3D, 0xA9, 0xEC, 0xF6, 0xCF, 0xC1, 0xDC, 0xF1, 0xD3, 0xB1, 0xD6,
0x7B, 0x37, 0x28, 0x11, 0x2B, 0x47, 0xDA, 0x39, 0xC6, 0xBC, 0x3A, 0x19,
0xB4, 0x5F, 0xA6, 0xBD, 0x7D, 0x9D, 0xA3, 0x63, 0x42, 0xB6, 0x76, 0xF2,
0xA9, 0x3B, 0x2B, 0x91, 0xF8, 0xE2, 0x6F, 0xD0, 0xEC, 0x16, 0x20, 0x90,
0x09, 0x3E, 0xE2, 0xE8, 0x74, 0xC9, 0x18, 0xB4, 0x91, 0xD4, 0x62, 0x64,
0xDB, 0x7F, 0xA3, 0x06, 0xF1, 0x88, 0x18, 0x6A, 0x90, 0x22, 0x3C, 0xBC,
0xFE, 0x13, 0xF0, 0x87, 0x14, 0x7B, 0xF6, 0xE4, 0x1F, 0x8E, 0xD4, 0xE4,
0x51, 0xC6, 0x11, 0x67, 0x46, 0x08, 0x51, 0xCB, 0x86, 0x14, 0x54, 0x3F,
0xBC, 0x33, 0xFE, 0x7E, 0x6C, 0x9C, 0xFF, 0x16, 0x9D, 0x18, 0xBD, 0x51,
0x8E, 0x35, 0xA6, 0xA7, 0x66, 0xC8, 0x72, 0x67, 0xDB, 0x21, 0x66, 0xB1,
0xD4, 0x9B, 0x78, 0x03, 0xC0, 0x50, 0x3A, 0xE8, 0xCC, 0xF0, 0xDC, 0xBC,
0x9E, 0x4C, 0xFE, 0xAF, 0x05, 0x96, 0x35, 0x1F, 0x57, 0x5A, 0xB7, 0xFF,
0xCE, 0xF9, 0x3D, 0xB7, 0x2C, 0xB6, 0xF6, 0x54, 0xDD, 0xC8, 0xE7, 0x12,
0x3A, 0x4D, 0xAE, 0x4C, 0x8A, 0xB7, 0x5C, 0x9A, 0xB4, 0xB7, 0x20, 0x3D,
0xCA, 0x7F, 0x22, 0x34, 0xAE, 0x7E, 0x3B, 0x68, 0x66, 0x01, 0x44, 0xE7,
0x01, 0x4E, 0x46, 0x53, 0x9B, 0x33, 0x60, 0xF7, 0x94, 0xBE, 0x53, 0x37,
0x90, 0x73, 0x43, 0xF3, 0x32, 0xC3, 0x53, 0xEF, 0xDB, 0xAA, 0xFE, 0x74,
0x4E, 0x69, 0xC7, 0x6B, 0x8C, 0x60, 0x93, 0xDE, 0xC4, 0xC7, 0x0C, 0xDF,
0xE1, 0x32, 0xAE, 0xCC, 0x93, 0x3B, 0x51, 0x78, 0x95, 0x67, 0x8B, 0xEE,
0x3D, 0x56, 0xFE, 0x0C, 0xD0, 0x69, 0x0F, 0x1B, 0x0F, 0xF3, 0x25, 0x26,
0x6B, 0x33, 0x6D, 0xF7, 0x6E, 0x47, 0xFA, 0x73, 0x43, 0xE5, 0x7E, 0x0E,
0xA5, 0x66, 0xB1, 0x29, 0x7C, 0x32, 0x84, 0x63, 0x55, 0x89, 0xC4, 0x0D,
0xC1, 0x93, 0x54, 0x30, 0x19, 0x13, 0xAC, 0xD3, 0x7D, 0x37, 0xA7, 0xEB,
0x5D, 0x3A, 0x6C, 0x35, 0x5C, 0xDB, 0x41, 0xD7, 0x12, 0xDA, 0xA9, 0x49,
0x0B, 0xDF, 0xD8, 0x80, 0x8A, 0x09, 0x93, 0x62, 0x8E, 0xB5, 0x66, 0xCF,
0x25, 0x88, 0xCD, 0x84, 0xB8, 0xB1, 0x3F, 0xA4, 0x39, 0x0F, 0xD9, 0x02,
0x9E, 0xEB, 0x12, 0x4C, 0x95, 0x7C, 0xF3, 0x6B, 0x05, 0xA9, 0x5E, 0x16,
0x83, 0xCC, 0xB8, 0x67, 0xE2, 0xE8, 0x13, 0x9D, 0xCC, 0x5B, 0x82, 0xD3,
0x4C, 0xB3, 0xED, 0x5B, 0xFF, 0xDE, 0xE5, 0x73, 0xAC, 0x23, 0x3B, 0x2D,
0x00, 0xBF, 0x35, 0x55, 0x74, 0x09, 0x49, 0xD8, 0x49, 0x58, 0x1A, 0x7F,
0x92, 0x36, 0xE6, 0x51, 0x92, 0x0E, 0xF3, 0x26, 0x7D, 0x1C, 0x4D, 0x17,
0xBC, 0xC9, 0xEC, 0x43, 0x26, 0xD0, 0xBF, 0x41, 0x5F, 0x40, 0xA9, 0x44,
0x44, 0xF4, 0x99, 0xE7, 0x57, 0x87, 0x9E, 0x50, 0x1F, 0x57, 0x54, 0xA8,
0x3E, 0xFD, 0x74, 0x63, 0x2F, 0xB1, 0x50, 0x65, 0x09, 0xE6, 0x58, 0x42,
0x2E, 0x43, 0x1A, 0x4C, 0xB4, 0xF0, 0x25, 0x47, 0x59, 0xFA, 0x04, 0x1E,
0x93, 0xD4, 0x26, 0x46, 0x4A, 0x50, 0x81, 0xB2, 0xDE, 0xBE, 0x78, 0xB7,
0xFC, 0x67, 0x15, 0xE1, 0xC9, 0x57, 0x84, 0x1E, 0x0F, 0x63, 0xD6, 0xE9,
0x62, 0xBA, 0xD6, 0x5F, 0x55, 0x2E, 0xEA, 0x5C, 0xC6, 0x28, 0x08, 0x04,
0x25, 0x39, 0xB8, 0x0E, 0x2B, 0xA9, 0xF2, 0x4C, 0x97, 0x1C, 0x07, 0x3F,
0x0D, 0x52, 0xF5, 0xED, 0xEF, 0x2F, 0x82, 0x0F
};
static const unsigned char TA5_RSA_E[] = {
0x01, 0x00, 0x01
};
static const br_x509_trust_anchor TAs[6] = {
{
{ (unsigned char *)TA0_DN, sizeof TA0_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA0_RSA_N, sizeof TA0_RSA_N,
(unsigned char *)TA0_RSA_E, sizeof TA0_RSA_E,
} }
}
},
{
{ (unsigned char *)TA1_DN, sizeof TA1_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA1_RSA_N, sizeof TA1_RSA_N,
(unsigned char *)TA1_RSA_E, sizeof TA1_RSA_E,
} }
}
},
{
{ (unsigned char *)TA2_DN, sizeof TA2_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA2_RSA_N, sizeof TA2_RSA_N,
(unsigned char *)TA2_RSA_E, sizeof TA2_RSA_E,
} }
}
},
{
{ (unsigned char *)TA3_DN, sizeof TA3_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_EC,
{ .ec = {
BR_EC_secp384r1,
(unsigned char *)TA3_EC_Q, sizeof TA3_EC_Q,
} }
}
},
{
{ (unsigned char *)TA4_DN, sizeof TA4_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA4_RSA_N, sizeof TA4_RSA_N,
(unsigned char *)TA4_RSA_E, sizeof TA4_RSA_E,
} }
}
},
{
{ (unsigned char *)TA5_DN, sizeof TA5_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA5_RSA_N, sizeof TA5_RSA_N,
(unsigned char *)TA5_RSA_E, sizeof TA5_RSA_E,
} }
}
}
};
#define TAs_NUM 6
// This file includes the following root certificates:
// - DigiCert Global Root (dropbox.com)
// - DigiCert Global Root G2 (resources.download.minecraft.net)
// - ISRG Root X1 (catbox.moe)
// - ISRG Root X2 (123dmwm.com, garbage.loan)
// - Baltimore CyberTrust Root (old classicube.net)
// - USERTrust RSA (imgur.com)
// - Google Trust Services Root R4 (classicube.net)
// Generated using "brssl -ta [cert 1] [cert 2].." from BearSSL
static const unsigned char TA0_DN[] = {
0x30, 0x61, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x0C, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x49,
0x6E, 0x63, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13,
0x10, 0x77, 0x77, 0x77, 0x2E, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72,
0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x17, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74,
0x20, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x52, 0x6F, 0x6F, 0x74,
0x20, 0x43, 0x41
};
static const unsigned char TA0_RSA_N[] = {
0xE2, 0x3B, 0xE1, 0x11, 0x72, 0xDE, 0xA8, 0xA4, 0xD3, 0xA3, 0x57, 0xAA,
0x50, 0xA2, 0x8F, 0x0B, 0x77, 0x90, 0xC9, 0xA2, 0xA5, 0xEE, 0x12, 0xCE,
0x96, 0x5B, 0x01, 0x09, 0x20, 0xCC, 0x01, 0x93, 0xA7, 0x4E, 0x30, 0xB7,
0x53, 0xF7, 0x43, 0xC4, 0x69, 0x00, 0x57, 0x9D, 0xE2, 0x8D, 0x22, 0xDD,
0x87, 0x06, 0x40, 0x00, 0x81, 0x09, 0xCE, 0xCE, 0x1B, 0x83, 0xBF, 0xDF,
0xCD, 0x3B, 0x71, 0x46, 0xE2, 0xD6, 0x66, 0xC7, 0x05, 0xB3, 0x76, 0x27,
0x16, 0x8F, 0x7B, 0x9E, 0x1E, 0x95, 0x7D, 0xEE, 0xB7, 0x48, 0xA3, 0x08,
0xDA, 0xD6, 0xAF, 0x7A, 0x0C, 0x39, 0x06, 0x65, 0x7F, 0x4A, 0x5D, 0x1F,
0xBC, 0x17, 0xF8, 0xAB, 0xBE, 0xEE, 0x28, 0xD7, 0x74, 0x7F, 0x7A, 0x78,
0x99, 0x59, 0x85, 0x68, 0x6E, 0x5C, 0x23, 0x32, 0x4B, 0xBF, 0x4E, 0xC0,
0xE8, 0x5A, 0x6D, 0xE3, 0x70, 0xBF, 0x77, 0x10, 0xBF, 0xFC, 0x01, 0xF6,
0x85, 0xD9, 0xA8, 0x44, 0x10, 0x58, 0x32, 0xA9, 0x75, 0x18, 0xD5, 0xD1,
0xA2, 0xBE, 0x47, 0xE2, 0x27, 0x6A, 0xF4, 0x9A, 0x33, 0xF8, 0x49, 0x08,
0x60, 0x8B, 0xD4, 0x5F, 0xB4, 0x3A, 0x84, 0xBF, 0xA1, 0xAA, 0x4A, 0x4C,
0x7D, 0x3E, 0xCF, 0x4F, 0x5F, 0x6C, 0x76, 0x5E, 0xA0, 0x4B, 0x37, 0x91,
0x9E, 0xDC, 0x22, 0xE6, 0x6D, 0xCE, 0x14, 0x1A, 0x8E, 0x6A, 0xCB, 0xFE,
0xCD, 0xB3, 0x14, 0x64, 0x17, 0xC7, 0x5B, 0x29, 0x9E, 0x32, 0xBF, 0xF2,
0xEE, 0xFA, 0xD3, 0x0B, 0x42, 0xD4, 0xAB, 0xB7, 0x41, 0x32, 0xDA, 0x0C,
0xD4, 0xEF, 0xF8, 0x81, 0xD5, 0xBB, 0x8D, 0x58, 0x3F, 0xB5, 0x1B, 0xE8,
0x49, 0x28, 0xA2, 0x70, 0xDA, 0x31, 0x04, 0xDD, 0xF7, 0xB2, 0x16, 0xF2,
0x4C, 0x0A, 0x4E, 0x07, 0xA8, 0xED, 0x4A, 0x3D, 0x5E, 0xB5, 0x7F, 0xA3,
0x90, 0xC3, 0xAF, 0x27
};
static const unsigned char TA0_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA1_DN[] = {
0x30, 0x61, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x0C, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x49,
0x6E, 0x63, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13,
0x10, 0x77, 0x77, 0x77, 0x2E, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72,
0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x17, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74,
0x20, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x52, 0x6F, 0x6F, 0x74,
0x20, 0x47, 0x32
};
static const unsigned char TA1_RSA_N[] = {
0xBB, 0x37, 0xCD, 0x34, 0xDC, 0x7B, 0x6B, 0xC9, 0xB2, 0x68, 0x90, 0xAD,
0x4A, 0x75, 0xFF, 0x46, 0xBA, 0x21, 0x0A, 0x08, 0x8D, 0xF5, 0x19, 0x54,
0xC9, 0xFB, 0x88, 0xDB, 0xF3, 0xAE, 0xF2, 0x3A, 0x89, 0x91, 0x3C, 0x7A,
0xE6, 0xAB, 0x06, 0x1A, 0x6B, 0xCF, 0xAC, 0x2D, 0xE8, 0x5E, 0x09, 0x24,
0x44, 0xBA, 0x62, 0x9A, 0x7E, 0xD6, 0xA3, 0xA8, 0x7E, 0xE0, 0x54, 0x75,
0x20, 0x05, 0xAC, 0x50, 0xB7, 0x9C, 0x63, 0x1A, 0x6C, 0x30, 0xDC, 0xDA,
0x1F, 0x19, 0xB1, 0xD7, 0x1E, 0xDE, 0xFD, 0xD7, 0xE0, 0xCB, 0x94, 0x83,
0x37, 0xAE, 0xEC, 0x1F, 0x43, 0x4E, 0xDD, 0x7B, 0x2C, 0xD2, 0xBD, 0x2E,
0xA5, 0x2F, 0xE4, 0xA9, 0xB8, 0xAD, 0x3A, 0xD4, 0x99, 0xA4, 0xB6, 0x25,
0xE9, 0x9B, 0x6B, 0x00, 0x60, 0x92, 0x60, 0xFF, 0x4F, 0x21, 0x49, 0x18,
0xF7, 0x67, 0x90, 0xAB, 0x61, 0x06, 0x9C, 0x8F, 0xF2, 0xBA, 0xE9, 0xB4,
0xE9, 0x92, 0x32, 0x6B, 0xB5, 0xF3, 0x57, 0xE8, 0x5D, 0x1B, 0xCD, 0x8C,
0x1D, 0xAB, 0x95, 0x04, 0x95, 0x49, 0xF3, 0x35, 0x2D, 0x96, 0xE3, 0x49,
0x6D, 0xDD, 0x77, 0xE3, 0xFB, 0x49, 0x4B, 0xB4, 0xAC, 0x55, 0x07, 0xA9,
0x8F, 0x95, 0xB3, 0xB4, 0x23, 0xBB, 0x4C, 0x6D, 0x45, 0xF0, 0xF6, 0xA9,
0xB2, 0x95, 0x30, 0xB4, 0xFD, 0x4C, 0x55, 0x8C, 0x27, 0x4A, 0x57, 0x14,
0x7C, 0x82, 0x9D, 0xCD, 0x73, 0x92, 0xD3, 0x16, 0x4A, 0x06, 0x0C, 0x8C,
0x50, 0xD1, 0x8F, 0x1E, 0x09, 0xBE, 0x17, 0xA1, 0xE6, 0x21, 0xCA, 0xFD,
0x83, 0xE5, 0x10, 0xBC, 0x83, 0xA5, 0x0A, 0xC4, 0x67, 0x28, 0xF6, 0x73,
0x14, 0x14, 0x3D, 0x46, 0x76, 0xC3, 0x87, 0x14, 0x89, 0x21, 0x34, 0x4D,
0xAF, 0x0F, 0x45, 0x0C, 0xA6, 0x49, 0xA1, 0xBA, 0xBB, 0x9C, 0xC5, 0xB1,
0x33, 0x83, 0x29, 0x85
};
static const unsigned char TA1_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA2_DN[] = {
0x30, 0x4F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x20, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x53,
0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65,
0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x15,
0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x49, 0x53, 0x52,
0x47, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x58, 0x31
};
static const unsigned char TA2_RSA_N[] = {
0xAD, 0xE8, 0x24, 0x73, 0xF4, 0x14, 0x37, 0xF3, 0x9B, 0x9E, 0x2B, 0x57,
0x28, 0x1C, 0x87, 0xBE, 0xDC, 0xB7, 0xDF, 0x38, 0x90, 0x8C, 0x6E, 0x3C,
0xE6, 0x57, 0xA0, 0x78, 0xF7, 0x75, 0xC2, 0xA2, 0xFE, 0xF5, 0x6A, 0x6E,
0xF6, 0x00, 0x4F, 0x28, 0xDB, 0xDE, 0x68, 0x86, 0x6C, 0x44, 0x93, 0xB6,
0xB1, 0x63, 0xFD, 0x14, 0x12, 0x6B, 0xBF, 0x1F, 0xD2, 0xEA, 0x31, 0x9B,
0x21, 0x7E, 0xD1, 0x33, 0x3C, 0xBA, 0x48, 0xF5, 0xDD, 0x79, 0xDF, 0xB3,
0xB8, 0xFF, 0x12, 0xF1, 0x21, 0x9A, 0x4B, 0xC1, 0x8A, 0x86, 0x71, 0x69,
0x4A, 0x66, 0x66, 0x6C, 0x8F, 0x7E, 0x3C, 0x70, 0xBF, 0xAD, 0x29, 0x22,
0x06, 0xF3, 0xE4, 0xC0, 0xE6, 0x80, 0xAE, 0xE2, 0x4B, 0x8F, 0xB7, 0x99,
0x7E, 0x94, 0x03, 0x9F, 0xD3, 0x47, 0x97, 0x7C, 0x99, 0x48, 0x23, 0x53,
0xE8, 0x38, 0xAE, 0x4F, 0x0A, 0x6F, 0x83, 0x2E, 0xD1, 0x49, 0x57, 0x8C,
0x80, 0x74, 0xB6, 0xDA, 0x2F, 0xD0, 0x38, 0x8D, 0x7B, 0x03, 0x70, 0x21,
0x1B, 0x75, 0xF2, 0x30, 0x3C, 0xFA, 0x8F, 0xAE, 0xDD, 0xDA, 0x63, 0xAB,
0xEB, 0x16, 0x4F, 0xC2, 0x8E, 0x11, 0x4B, 0x7E, 0xCF, 0x0B, 0xE8, 0xFF,
0xB5, 0x77, 0x2E, 0xF4, 0xB2, 0x7B, 0x4A, 0xE0, 0x4C, 0x12, 0x25, 0x0C,
0x70, 0x8D, 0x03, 0x29, 0xA0, 0xE1, 0x53, 0x24, 0xEC, 0x13, 0xD9, 0xEE,
0x19, 0xBF, 0x10, 0xB3, 0x4A, 0x8C, 0x3F, 0x89, 0xA3, 0x61, 0x51, 0xDE,
0xAC, 0x87, 0x07, 0x94, 0xF4, 0x63, 0x71, 0xEC, 0x2E, 0xE2, 0x6F, 0x5B,
0x98, 0x81, 0xE1, 0x89, 0x5C, 0x34, 0x79, 0x6C, 0x76, 0xEF, 0x3B, 0x90,
0x62, 0x79, 0xE6, 0xDB, 0xA4, 0x9A, 0x2F, 0x26, 0xC5, 0xD0, 0x10, 0xE1,
0x0E, 0xDE, 0xD9, 0x10, 0x8E, 0x16, 0xFB, 0xB7, 0xF7, 0xA8, 0xF7, 0xC7,
0xE5, 0x02, 0x07, 0x98, 0x8F, 0x36, 0x08, 0x95, 0xE7, 0xE2, 0x37, 0x96,
0x0D, 0x36, 0x75, 0x9E, 0xFB, 0x0E, 0x72, 0xB1, 0x1D, 0x9B, 0xBC, 0x03,
0xF9, 0x49, 0x05, 0xD8, 0x81, 0xDD, 0x05, 0xB4, 0x2A, 0xD6, 0x41, 0xE9,
0xAC, 0x01, 0x76, 0x95, 0x0A, 0x0F, 0xD8, 0xDF, 0xD5, 0xBD, 0x12, 0x1F,
0x35, 0x2F, 0x28, 0x17, 0x6C, 0xD2, 0x98, 0xC1, 0xA8, 0x09, 0x64, 0x77,
0x6E, 0x47, 0x37, 0xBA, 0xCE, 0xAC, 0x59, 0x5E, 0x68, 0x9D, 0x7F, 0x72,
0xD6, 0x89, 0xC5, 0x06, 0x41, 0x29, 0x3E, 0x59, 0x3E, 0xDD, 0x26, 0xF5,
0x24, 0xC9, 0x11, 0xA7, 0x5A, 0xA3, 0x4C, 0x40, 0x1F, 0x46, 0xA1, 0x99,
0xB5, 0xA7, 0x3A, 0x51, 0x6E, 0x86, 0x3B, 0x9E, 0x7D, 0x72, 0xA7, 0x12,
0x05, 0x78, 0x59, 0xED, 0x3E, 0x51, 0x78, 0x15, 0x0B, 0x03, 0x8F, 0x8D,
0xD0, 0x2F, 0x05, 0xB2, 0x3E, 0x7B, 0x4A, 0x1C, 0x4B, 0x73, 0x05, 0x12,
0xFC, 0xC6, 0xEA, 0xE0, 0x50, 0x13, 0x7C, 0x43, 0x93, 0x74, 0xB3, 0xCA,
0x74, 0xE7, 0x8E, 0x1F, 0x01, 0x08, 0xD0, 0x30, 0xD4, 0x5B, 0x71, 0x36,
0xB4, 0x07, 0xBA, 0xC1, 0x30, 0x30, 0x5C, 0x48, 0xB7, 0x82, 0x3B, 0x98,
0xA6, 0x7D, 0x60, 0x8A, 0xA2, 0xA3, 0x29, 0x82, 0xCC, 0xBA, 0xBD, 0x83,
0x04, 0x1B, 0xA2, 0x83, 0x03, 0x41, 0xA1, 0xD6, 0x05, 0xF1, 0x1B, 0xC2,
0xB6, 0xF0, 0xA8, 0x7C, 0x86, 0x3B, 0x46, 0xA8, 0x48, 0x2A, 0x88, 0xDC,
0x76, 0x9A, 0x76, 0xBF, 0x1F, 0x6A, 0xA5, 0x3D, 0x19, 0x8F, 0xEB, 0x38,
0xF3, 0x64, 0xDE, 0xC8, 0x2B, 0x0D, 0x0A, 0x28, 0xFF, 0xF7, 0xDB, 0xE2,
0x15, 0x42, 0xD4, 0x22, 0xD0, 0x27, 0x5D, 0xE1, 0x79, 0xFE, 0x18, 0xE7,
0x70, 0x88, 0xAD, 0x4E, 0xE6, 0xD9, 0x8B, 0x3A, 0xC6, 0xDD, 0x27, 0x51,
0x6E, 0xFF, 0xBC, 0x64, 0xF5, 0x33, 0x43, 0x4F
};
static const unsigned char TA2_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA3_DN[] = {
0x30, 0x4F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x20, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x53,
0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65,
0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x15,
0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x49, 0x53, 0x52,
0x47, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x58, 0x32
};
static const unsigned char TA3_EC_Q[] = {
0x04, 0xCD, 0x9B, 0xD5, 0x9F, 0x80, 0x83, 0x0A, 0xEC, 0x09, 0x4A, 0xF3,
0x16, 0x4A, 0x3E, 0x5C, 0xCF, 0x77, 0xAC, 0xDE, 0x67, 0x05, 0x0D, 0x1D,
0x07, 0xB6, 0xDC, 0x16, 0xFB, 0x5A, 0x8B, 0x14, 0xDB, 0xE2, 0x71, 0x60,
0xC4, 0xBA, 0x45, 0x95, 0x11, 0x89, 0x8E, 0xEA, 0x06, 0xDF, 0xF7, 0x2A,
0x16, 0x1C, 0xA4, 0xB9, 0xC5, 0xC5, 0x32, 0xE0, 0x03, 0xE0, 0x1E, 0x82,
0x18, 0x38, 0x8B, 0xD7, 0x45, 0xD8, 0x0A, 0x6A, 0x6E, 0xE6, 0x00, 0x77,
0xFB, 0x02, 0x51, 0x7D, 0x22, 0xD8, 0x0A, 0x6E, 0x9A, 0x5B, 0x77, 0xDF,
0xF0, 0xFA, 0x41, 0xEC, 0x39, 0xDC, 0x75, 0xCA, 0x68, 0x07, 0x0C, 0x1F,
0xEA
};
static const unsigned char TA4_DN[] = {
0x30, 0x5A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x49, 0x45, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x09, 0x42, 0x61, 0x6C, 0x74, 0x69, 0x6D, 0x6F, 0x72, 0x65, 0x31,
0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0A, 0x43, 0x79,
0x62, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x31, 0x22, 0x30, 0x20,
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x19, 0x42, 0x61, 0x6C, 0x74, 0x69,
0x6D, 0x6F, 0x72, 0x65, 0x20, 0x43, 0x79, 0x62, 0x65, 0x72, 0x54, 0x72,
0x75, 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74
};
static const unsigned char TA4_RSA_N[] = {
0xA3, 0x04, 0xBB, 0x22, 0xAB, 0x98, 0x3D, 0x57, 0xE8, 0x26, 0x72, 0x9A,
0xB5, 0x79, 0xD4, 0x29, 0xE2, 0xE1, 0xE8, 0x95, 0x80, 0xB1, 0xB0, 0xE3,
0x5B, 0x8E, 0x2B, 0x29, 0x9A, 0x64, 0xDF, 0xA1, 0x5D, 0xED, 0xB0, 0x09,
0x05, 0x6D, 0xDB, 0x28, 0x2E, 0xCE, 0x62, 0xA2, 0x62, 0xFE, 0xB4, 0x88,
0xDA, 0x12, 0xEB, 0x38, 0xEB, 0x21, 0x9D, 0xC0, 0x41, 0x2B, 0x01, 0x52,
0x7B, 0x88, 0x77, 0xD3, 0x1C, 0x8F, 0xC7, 0xBA, 0xB9, 0x88, 0xB5, 0x6A,
0x09, 0xE7, 0x73, 0xE8, 0x11, 0x40, 0xA7, 0xD1, 0xCC, 0xCA, 0x62, 0x8D,
0x2D, 0xE5, 0x8F, 0x0B, 0xA6, 0x50, 0xD2, 0xA8, 0x50, 0xC3, 0x28, 0xEA,
0xF5, 0xAB, 0x25, 0x87, 0x8A, 0x9A, 0x96, 0x1C, 0xA9, 0x67, 0xB8, 0x3F,
0x0C, 0xD5, 0xF7, 0xF9, 0x52, 0x13, 0x2F, 0xC2, 0x1B, 0xD5, 0x70, 0x70,
0xF0, 0x8F, 0xC0, 0x12, 0xCA, 0x06, 0xCB, 0x9A, 0xE1, 0xD9, 0xCA, 0x33,
0x7A, 0x77, 0xD6, 0xF8, 0xEC, 0xB9, 0xF1, 0x68, 0x44, 0x42, 0x48, 0x13,
0xD2, 0xC0, 0xC2, 0xA4, 0xAE, 0x5E, 0x60, 0xFE, 0xB6, 0xA6, 0x05, 0xFC,
0xB4, 0xDD, 0x07, 0x59, 0x02, 0xD4, 0x59, 0x18, 0x98, 0x63, 0xF5, 0xA5,
0x63, 0xE0, 0x90, 0x0C, 0x7D, 0x5D, 0xB2, 0x06, 0x7A, 0xF3, 0x85, 0xEA,
0xEB, 0xD4, 0x03, 0xAE, 0x5E, 0x84, 0x3E, 0x5F, 0xFF, 0x15, 0xED, 0x69,
0xBC, 0xF9, 0x39, 0x36, 0x72, 0x75, 0xCF, 0x77, 0x52, 0x4D, 0xF3, 0xC9,
0x90, 0x2C, 0xB9, 0x3D, 0xE5, 0xC9, 0x23, 0x53, 0x3F, 0x1F, 0x24, 0x98,
0x21, 0x5C, 0x07, 0x99, 0x29, 0xBD, 0xC6, 0x3A, 0xEC, 0xE7, 0x6E, 0x86,
0x3A, 0x6B, 0x97, 0x74, 0x63, 0x33, 0xBD, 0x68, 0x18, 0x31, 0xF0, 0x78,
0x8D, 0x76, 0xBF, 0xFC, 0x9E, 0x8E, 0x5D, 0x2A, 0x86, 0xA7, 0x4D, 0x90,
0xDC, 0x27, 0x1A, 0x39
};
static const unsigned char TA4_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA5_DN[] = {
0x30, 0x81, 0x88, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
0x08, 0x13, 0x0A, 0x4E, 0x65, 0x77, 0x20, 0x4A, 0x65, 0x72, 0x73, 0x65,
0x79, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0B,
0x4A, 0x65, 0x72, 0x73, 0x65, 0x79, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31,
0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x54, 0x68,
0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20,
0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x2E, 0x30, 0x2C, 0x06,
0x03, 0x55, 0x04, 0x03, 0x13, 0x25, 0x55, 0x53, 0x45, 0x52, 0x54, 0x72,
0x75, 0x73, 0x74, 0x20, 0x52, 0x53, 0x41, 0x20, 0x43, 0x65, 0x72, 0x74,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75,
0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79
};
static const unsigned char TA5_RSA_N[] = {
0x80, 0x12, 0x65, 0x17, 0x36, 0x0E, 0xC3, 0xDB, 0x08, 0xB3, 0xD0, 0xAC,
0x57, 0x0D, 0x76, 0xED, 0xCD, 0x27, 0xD3, 0x4C, 0xAD, 0x50, 0x83, 0x61,
0xE2, 0xAA, 0x20, 0x4D, 0x09, 0x2D, 0x64, 0x09, 0xDC, 0xCE, 0x89, 0x9F,
0xCC, 0x3D, 0xA9, 0xEC, 0xF6, 0xCF, 0xC1, 0xDC, 0xF1, 0xD3, 0xB1, 0xD6,
0x7B, 0x37, 0x28, 0x11, 0x2B, 0x47, 0xDA, 0x39, 0xC6, 0xBC, 0x3A, 0x19,
0xB4, 0x5F, 0xA6, 0xBD, 0x7D, 0x9D, 0xA3, 0x63, 0x42, 0xB6, 0x76, 0xF2,
0xA9, 0x3B, 0x2B, 0x91, 0xF8, 0xE2, 0x6F, 0xD0, 0xEC, 0x16, 0x20, 0x90,
0x09, 0x3E, 0xE2, 0xE8, 0x74, 0xC9, 0x18, 0xB4, 0x91, 0xD4, 0x62, 0x64,
0xDB, 0x7F, 0xA3, 0x06, 0xF1, 0x88, 0x18, 0x6A, 0x90, 0x22, 0x3C, 0xBC,
0xFE, 0x13, 0xF0, 0x87, 0x14, 0x7B, 0xF6, 0xE4, 0x1F, 0x8E, 0xD4, 0xE4,
0x51, 0xC6, 0x11, 0x67, 0x46, 0x08, 0x51, 0xCB, 0x86, 0x14, 0x54, 0x3F,
0xBC, 0x33, 0xFE, 0x7E, 0x6C, 0x9C, 0xFF, 0x16, 0x9D, 0x18, 0xBD, 0x51,
0x8E, 0x35, 0xA6, 0xA7, 0x66, 0xC8, 0x72, 0x67, 0xDB, 0x21, 0x66, 0xB1,
0xD4, 0x9B, 0x78, 0x03, 0xC0, 0x50, 0x3A, 0xE8, 0xCC, 0xF0, 0xDC, 0xBC,
0x9E, 0x4C, 0xFE, 0xAF, 0x05, 0x96, 0x35, 0x1F, 0x57, 0x5A, 0xB7, 0xFF,
0xCE, 0xF9, 0x3D, 0xB7, 0x2C, 0xB6, 0xF6, 0x54, 0xDD, 0xC8, 0xE7, 0x12,
0x3A, 0x4D, 0xAE, 0x4C, 0x8A, 0xB7, 0x5C, 0x9A, 0xB4, 0xB7, 0x20, 0x3D,
0xCA, 0x7F, 0x22, 0x34, 0xAE, 0x7E, 0x3B, 0x68, 0x66, 0x01, 0x44, 0xE7,
0x01, 0x4E, 0x46, 0x53, 0x9B, 0x33, 0x60, 0xF7, 0x94, 0xBE, 0x53, 0x37,
0x90, 0x73, 0x43, 0xF3, 0x32, 0xC3, 0x53, 0xEF, 0xDB, 0xAA, 0xFE, 0x74,
0x4E, 0x69, 0xC7, 0x6B, 0x8C, 0x60, 0x93, 0xDE, 0xC4, 0xC7, 0x0C, 0xDF,
0xE1, 0x32, 0xAE, 0xCC, 0x93, 0x3B, 0x51, 0x78, 0x95, 0x67, 0x8B, 0xEE,
0x3D, 0x56, 0xFE, 0x0C, 0xD0, 0x69, 0x0F, 0x1B, 0x0F, 0xF3, 0x25, 0x26,
0x6B, 0x33, 0x6D, 0xF7, 0x6E, 0x47, 0xFA, 0x73, 0x43, 0xE5, 0x7E, 0x0E,
0xA5, 0x66, 0xB1, 0x29, 0x7C, 0x32, 0x84, 0x63, 0x55, 0x89, 0xC4, 0x0D,
0xC1, 0x93, 0x54, 0x30, 0x19, 0x13, 0xAC, 0xD3, 0x7D, 0x37, 0xA7, 0xEB,
0x5D, 0x3A, 0x6C, 0x35, 0x5C, 0xDB, 0x41, 0xD7, 0x12, 0xDA, 0xA9, 0x49,
0x0B, 0xDF, 0xD8, 0x80, 0x8A, 0x09, 0x93, 0x62, 0x8E, 0xB5, 0x66, 0xCF,
0x25, 0x88, 0xCD, 0x84, 0xB8, 0xB1, 0x3F, 0xA4, 0x39, 0x0F, 0xD9, 0x02,
0x9E, 0xEB, 0x12, 0x4C, 0x95, 0x7C, 0xF3, 0x6B, 0x05, 0xA9, 0x5E, 0x16,
0x83, 0xCC, 0xB8, 0x67, 0xE2, 0xE8, 0x13, 0x9D, 0xCC, 0x5B, 0x82, 0xD3,
0x4C, 0xB3, 0xED, 0x5B, 0xFF, 0xDE, 0xE5, 0x73, 0xAC, 0x23, 0x3B, 0x2D,
0x00, 0xBF, 0x35, 0x55, 0x74, 0x09, 0x49, 0xD8, 0x49, 0x58, 0x1A, 0x7F,
0x92, 0x36, 0xE6, 0x51, 0x92, 0x0E, 0xF3, 0x26, 0x7D, 0x1C, 0x4D, 0x17,
0xBC, 0xC9, 0xEC, 0x43, 0x26, 0xD0, 0xBF, 0x41, 0x5F, 0x40, 0xA9, 0x44,
0x44, 0xF4, 0x99, 0xE7, 0x57, 0x87, 0x9E, 0x50, 0x1F, 0x57, 0x54, 0xA8,
0x3E, 0xFD, 0x74, 0x63, 0x2F, 0xB1, 0x50, 0x65, 0x09, 0xE6, 0x58, 0x42,
0x2E, 0x43, 0x1A, 0x4C, 0xB4, 0xF0, 0x25, 0x47, 0x59, 0xFA, 0x04, 0x1E,
0x93, 0xD4, 0x26, 0x46, 0x4A, 0x50, 0x81, 0xB2, 0xDE, 0xBE, 0x78, 0xB7,
0xFC, 0x67, 0x15, 0xE1, 0xC9, 0x57, 0x84, 0x1E, 0x0F, 0x63, 0xD6, 0xE9,
0x62, 0xBA, 0xD6, 0x5F, 0x55, 0x2E, 0xEA, 0x5C, 0xC6, 0x28, 0x08, 0x04,
0x25, 0x39, 0xB8, 0x0E, 0x2B, 0xA9, 0xF2, 0x4C, 0x97, 0x1C, 0x07, 0x3F,
0x0D, 0x52, 0xF5, 0xED, 0xEF, 0x2F, 0x82, 0x0F
};
static const unsigned char TA5_RSA_E[] = {
0x01, 0x00, 0x01
};
static const unsigned char TA6_DN[] = {
0x30, 0x47, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x55, 0x53, 0x31, 0x22, 0x30, 0x20, 0x06, 0x03, 0x55, 0x04, 0x0A,
0x13, 0x19, 0x47, 0x6F, 0x6F, 0x67, 0x6C, 0x65, 0x20, 0x54, 0x72, 0x75,
0x73, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20,
0x4C, 0x4C, 0x43, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x0B, 0x47, 0x54, 0x53, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x52,
0x34
};
static const unsigned char TA6_EC_Q[] = {
0x04, 0xF3, 0x74, 0x73, 0xA7, 0x68, 0x8B, 0x60, 0xAE, 0x43, 0xB8, 0x35,
0xC5, 0x81, 0x30, 0x7B, 0x4B, 0x49, 0x9D, 0xFB, 0xC1, 0x61, 0xCE, 0xE6,
0xDE, 0x46, 0xBD, 0x6B, 0xD5, 0x61, 0x18, 0x35, 0xAE, 0x40, 0xDD, 0x73,
0xF7, 0x89, 0x91, 0x30, 0x5A, 0xEB, 0x3C, 0xEE, 0x85, 0x7C, 0xA2, 0x40,
0x76, 0x3B, 0xA9, 0xC6, 0xB8, 0x47, 0xD8, 0x2A, 0xE7, 0x92, 0x91, 0x6A,
0x73, 0xE9, 0xB1, 0x72, 0x39, 0x9F, 0x29, 0x9F, 0xA2, 0x98, 0xD3, 0x5F,
0x5E, 0x58, 0x86, 0x65, 0x0F, 0xA1, 0x84, 0x65, 0x06, 0xD1, 0xDC, 0x8B,
0xC9, 0xC7, 0x73, 0xC8, 0x8C, 0x6A, 0x2F, 0xE5, 0xC4, 0xAB, 0xD1, 0x1D,
0x8A
};
static const br_x509_trust_anchor TAs[7] = {
{
{ (unsigned char *)TA0_DN, sizeof TA0_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA0_RSA_N, sizeof TA0_RSA_N,
(unsigned char *)TA0_RSA_E, sizeof TA0_RSA_E,
} }
}
},
{
{ (unsigned char *)TA1_DN, sizeof TA1_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA1_RSA_N, sizeof TA1_RSA_N,
(unsigned char *)TA1_RSA_E, sizeof TA1_RSA_E,
} }
}
},
{
{ (unsigned char *)TA2_DN, sizeof TA2_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA2_RSA_N, sizeof TA2_RSA_N,
(unsigned char *)TA2_RSA_E, sizeof TA2_RSA_E,
} }
}
},
{
{ (unsigned char *)TA3_DN, sizeof TA3_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_EC,
{ .ec = {
BR_EC_secp384r1,
(unsigned char *)TA3_EC_Q, sizeof TA3_EC_Q,
} }
}
},
{
{ (unsigned char *)TA4_DN, sizeof TA4_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA4_RSA_N, sizeof TA4_RSA_N,
(unsigned char *)TA4_RSA_E, sizeof TA4_RSA_E,
} }
}
},
{
{ (unsigned char *)TA5_DN, sizeof TA5_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)TA5_RSA_N, sizeof TA5_RSA_N,
(unsigned char *)TA5_RSA_E, sizeof TA5_RSA_E,
} }
}
},
{
{ (unsigned char *)TA6_DN, sizeof TA6_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_EC,
{ .ec = {
BR_EC_secp384r1,
(unsigned char *)TA6_EC_Q, sizeof TA6_EC_Q,
} }
}
}
};
#define TAs_NUM 7

BIN
misc/certs/isrg-root-x2.der Normal file

Binary file not shown.

BIN
misc/certs/isrgrootx1.der Normal file

Binary file not shown.

BIN
misc/certs/r4.crt Normal file

Binary file not shown.

View File

@ -1,58 +0,0 @@
#include "ViewportTransform.S"
.global _DrawColouredQuads
.align 4
.type _DrawColouredQuads,%function
_DrawColouredQuads:
! Setup
fldi0 fr1 ! U = 0
fldi0 fr2 ! V = 0
TransformSetup
ViewportTransformSetup _VP_COL_HWIDTH
.TRANSFORM_QUAD:
LoadColouredVertex
ProcessVertex1
LoadColouredVertex
ProcessVertex2
LoadColouredVertex
ProcessVertex3
LoadColouredVertex
ProcessVertex4
! CLIPFLAGS TESTING
cmp/eq #0,r0 ! T = r0 == 0 (all points invisible)
bt/s .NO_POINTS_VISIBLE ! if T goto NO_POINTS_VISIBLE
nop
bra .SOME_POINTS_VISIBLE
nop
.NO_POINTS_VISIBLE:
bra .LOOP_END ! jump to loop end after executing instruction in delay slot
add #-128, r5 ! r5 -= 4 * sizeof(VERTEX), move back to 1 vertex before start of quad
.SOME_POINTS_VISIBLE:
.LOOP_END:
dt r6 ! r6--; T = r6 == 0
bf .TRANSFORM_QUAD ! if !T then goto TRANSFORM_QUAD
nop
TransformEnd
.align 4
.global _VP_COL_HWIDTH
_VP_COL_HWIDTH: .long 0
.global _VP_COL_HHEIGHT
_VP_COL_HHEIGHT: .long 0
.global _VP_COL_X_PLUS_HWIDTH
_VP_COL_X_PLUS_HWIDTH: .long 0
.global _VP_COL_Y_PLUS_HHEIGHT
_VP_COL_Y_PLUS_HHEIGHT: .long 0

View File

@ -1,56 +0,0 @@
#include "ViewportTransform.S"
.global _DrawTexturedQuads
.align 4
.type _DrawTexturedQuads,%function
_DrawTexturedQuads:
! Setup
TransformSetup
ViewportTransformSetup _VP_TEX_HWIDTH
.TRANSFORM_QUAD:
LoadTexturedVertex
ProcessVertex1
LoadTexturedVertex
ProcessVertex2
LoadTexturedVertex
ProcessVertex3
LoadTexturedVertex
ProcessVertex4
! CLIPFLAGS TESTING
cmp/eq #0,r0 ! T = r0 == 0 (all points invisible)
bt/s .NO_POINTS_VISIBLE ! if T goto NO_POINTS_VISIBLE
nop
bra .SOME_POINTS_VISIBLE
nop
.NO_POINTS_VISIBLE:
bra .LOOP_END ! jump to loop end after executing instruction in delay slot
add #-128, r5 ! r5 -= 4 * sizeof(VERTEX), move back to prior quad, so that this invisible quad gets overwritten in next iteration
.SOME_POINTS_VISIBLE:
.LOOP_END:
dt r6 ! r6--; T = r6 == 0
bf .TRANSFORM_QUAD ! if !T then goto TRANSFORM_QUAD
nop
TransformEnd
.align 4
.global _VP_TEX_HWIDTH
_VP_TEX_HWIDTH: .long 0
.global _VP_TEX_HHEIGHT
_VP_TEX_HHEIGHT: .long 0
.global _VP_TEX_X_PLUS_HWIDTH
_VP_TEX_X_PLUS_HWIDTH: .long 0
.global _VP_TEX_Y_PLUS_HHEIGHT
_VP_TEX_Y_PLUS_HHEIGHT: .long 0

View File

@ -5,7 +5,7 @@ TARGET := ClassiCube-dc
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
CFLAGS := -g -O2 -pipe -fno-math-errno -Ithird_party/bearssl/inc
CFLAGS := -g -DNDEBUG -O3 -fipa-pta -fno-pie -flto=auto -fomit-frame-pointer -fbuiltin -ffast-math -ffp-contract=fast -mfsrra -mfsca -pipe -fno-math-errno -Ithird_party/bearssl/inc
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
@ -25,16 +25,19 @@ endif
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
default: $(GLDC_LIB) $(BUILD_DIR) $(TARGET).cdi
default: $(BUILD_DIR) $(TARGET).cdi
clean:
rm $(TARGET).cdi $(TARGET).iso $(TARGET).elf $(TARGET)-scr.bin $(TARGET).bin $(OBJS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
#---------------------------------------------------------------------------------
# executable generation
#---------------------------------------------------------------------------------
$(TARGET).elf: $(OBJS)
$(TARGET).elf: $(OBJS) $(GLDC_LIB)
kos-cc $(LDFLAGS) $^ -o $@ $(LIBS)
$(TARGET).bin: $(TARGET).elf
@ -66,9 +69,6 @@ $(TARGET).cdi: $(TARGET).iso
$(GLDC_LIB): FORCE
$(MAKE) -C third_party/gldc
FORCE: ;
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o: src/%.c
kos-cc $(CFLAGS) $(DEPFLAGS) -c $< -o $@
@ -77,7 +77,7 @@ $(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
kos-cc $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
kos-cc -c $< -o $@
kos-cc $(DEPFLAGS) -c $< -o $@
# Dependency tracking
$(DEPFILES):

196
misc/dreamcast/VertexClip.S Normal file
View File

@ -0,0 +1,196 @@
! r1 = v1, CLOBBERS
! r2 = v2, CLOBBERS
! r3 = OUT, CLOBBERS
! r4 = TMP 1, preserved
! r5 = TMP 2, preserved
! r0 = CL0, CLOBBERS
! FR0 = 0
! FR1 = 0
! FR2 = A.1
! FR3 = B.1
! FR4 = 0
! FR5 = 0
! FR6 = A.2
! FR7 = B.2
! FR8 = 0
! FR9 = 0
! FR10 = invT
! FR11 = t
#define TM1 r0 // CLOBBERED, temp register 1
#define TM2 r4 // PRESERVED, temp register 2
#define CLO r5 // PRESERVED, output colour
#define IN1 r1 // CLOBBERED, input vertex 1
#define IN2 r2 // CLOBBERED, input vertex 2
#define OUT r3 // CLOBBERED, output vertex
#define CL1 r1 // CLOBBERED, input colour 1
#define CL2 r2 // CLOBBERED, input colour 2
! Calculates the near plane intersection point between two points:
! float t = fabsf(v1->z) / fabsf(v2->z - v1->z)
! float invt = 1.0f - t;
!
! out->x = invt * v1->x + t * v2->x;
! out->y = invt * v1->y + t * v2->y;
! out->z = 0.0f; // clipped against near plane anyways (I.e Z/W = 0 --> Z = 0)
!
! out->u = invt * v1->u + t * v2->u;
! out->v = invt * v1->v + t * v2->v;
! out->w = invt * v1->w + t * v2->w;
!
! out->b = invt * v1->b + t * v2->b;
! out->g = invt * v1->g + t * v2->g;
! out->r = invt * v1->r + t * v2->r;
! out->a = invt * v1->a + t * v2->a;
! To optimise these calculations, FIPR is used:
! FIPR = FVm.x*FVn.x + FVm.y*FVn.x + FVm.z*FVn.z + FVm.w*FVn.w --> FVn.w
! FIPR can be used to accomplish "vout->Q = invt * v1->Q + t * v2->Q" by:
! - assigning x/y components to 0 for both vectors
! - assigning t and invT to z/w of FVm vector
! - assigning v1 and v2 to z/w of FVn vector
! FIPR = 0*0 + 0*0 + t*v1->Q + invT*v2->Q --> FVn.w
! FIPR = t*v1->Q + invT*v2->Q --> FVn.w
.global _ClipLine
.align 4
_ClipLine:
mov.l r4,@-r15 ! LS, push(r4)
mov.l r5,@-r15 ! LS, push(r5)
mov IN1, TM1 ! MT, tmp = &v1
fldi0 fr4 ! LS, fr4 = 0
add #12, TM1 ! EX, tmp = &v1->z
fmov.s @TM1, fr2 ! LS, fr2 = v1->z
mov IN2, TM1 ! MT, tmp = &v2
fldi0 fr5 ! LS, fr5 = 0
add #12, TM1 ! EX, tmp = &v2->z
fmov.s @TM1,fr11 ! LS, fr11 = v2->z
fsub fr2,fr11 ! FE, fr11 = v2->z - v1->z
fldi0 fr8 ! LS, fr8 = 0
fmul fr11,fr11 ! FE, fr11 = (v2->z - v1->z) * (v2->z * v1->z)
fldi0 fr9 ! LS, fr9 = 0
fldi0 fr0 ! LS, fr0 = 0
fldi0 fr1 ! LS, fr1 = 0
fsrra fr11 ! FE, fr11 = 1 / abs(v2->z - v1->z)
fabs fr2 ! LS, fr2 = abs(v1->z)
fmul fr2,fr11 ! FE, fr11 = abs(v1->Z) / abs(v2->z - v1->z) --> t
add #4, IN1 ! EX, v1 += 4
fldi1 fr10 ! LS, fr10 = 1
add #4, IN2 ! EX, v2 += 4
add #4, OUT ! EX, OUT += 4
fsub fr11,fr10 ! FE, fr10 = 1.0 - t --> invT
fmov.s @IN1+, fr2 ! LS, A1 = v1->x, v1 += 4
fmov.s @IN2+, fr3 ! LS, B1 = v2->x, v2 += 4
fipr fv8, fv0 ! FE, LERP(A1, B1)
fmov.s @IN1+, fr6 ! LS, A2 = v1->y, v1 += 4
fmov.s @IN2+, fr7 ! LS, B2 = v2->y, v2 += 4
fmov.s fr3,@OUT ! LS, OUT->x = LERP
add #4, OUT ! EX, OUT += 4
fipr fv8, fv4 ! FE, LERP(A2, B2)
add #4, IN1 ! EX, v1 += 4
add #4, IN2 ! EX, v2 += 4
fmov.s fr7,@OUT ! LS, OUT->y = LERP
add #4, OUT ! EX, OUT += 4
fmov.s fr1,@OUT ! LS, OUT->z = 0
add #4, OUT ! EX, OUT += 4
fmov.s @IN1+, fr2 ! LS, A1 = v1->u, v1 += 4
fmov.s @IN2+, fr3 ! LS, B1 = v2->u, v2 += 4
fipr fv8, fv0 ! FE, LERP(A1, B1)
fmov.s @IN1+, fr6 ! LS, A2 = v1->v, v1 += 4
fmov.s @IN2+, fr7 ! LS, B2 = v2->v, v2 += 4
fmov.s fr3,@OUT ! LS, OUT->u = LERP
add #4, OUT ! EX, OUT += 4
fipr fv8, fv4 ! FE, LERP(A2, B2)
add #4, IN1 ! EX, v1 += 4
add #4, IN2 ! EX, v2 += 4
fmov.s @IN1,fr2 ! LS, A1 = v1->w
fmov.s @IN2,fr3 ! LS, B1 = v2->w
fmov.s fr7,@OUT ! LS, OUT->v = LERP
add #8, OUT ! EX, OUT += 8
fipr fv8, fv0 ! FE, LERP(A1, B1)
add #-4, IN1 ! EX, v1 -= 4
add #-4, IN2 ! EX, v2 -= 4
fmov.s fr3,@OUT ! LS, OUT->w = lerp
add #-4, OUT ! EX, OUT -= 4
mov.l @IN1,CL1 ! LS, ACOLOR = v1->bgra
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
! Bypass interpolation if unnecessary
cmp/eq CL1,CL2 ! MT, T = ACOLOR == BCOLOR
bt.s 1f ! BR, if (T) goto 1;
mov CL1,CLO ! MT, OUTCOLOR = ACOLOR (branch delay instruction)
! Interpolate B
extu.b CL1,TM1 ! EX, val = ACOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
shlr8 CL1 ! EX, ACOLOR >>= 8
ftrc fr3,fpul ! FE, FPUL = int(lerp)
shlr8 CL2 ! EX, BCOLOR >>= 8
sts fpul,TM2 ! CO, tmp = FPUL
! Interpolate G
extu.b CL1,TM1 ! EX, val = ACOLOR.g
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.g
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
shlr8 CL1 ! EX, ACOLOR >>= 8
ftrc fr3,fpul ! FE, FPUL = int(lerp)
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
mov TM2,CLO ! MT, OUTCOLOR.b = tmp
shlr8 CL2 ! EX, BCOLOR >>= 8
sts fpul,TM2 ! CO, tmp = FPUL
! Interpolate R
extu.b CL1,TM1 ! EX, val = ACOLOR.r
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.r
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
shlr8 CL1 ! EX, ACOLOR >>= 8
ftrc fr3,fpul ! FE, FPUL = int(lerp)
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
shll8 TM2 ! EX, tmp <<= 8
or TM2,CLO ! EX, OUTCOLOR.g |= tmp
shlr8 CL2 ! EX, BCOLOR >>= 8
sts fpul,TM2 ! CO, tmp = FPUL
! Interpolate A
extu.b CL1,TM1 ! EX, val = ACOLOR.a
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.a
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
ftrc fr3,fpul ! FE, FPUL = int(lerp)
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
shll16 TM2 ! EX, tmp <<= 16
or TM2,CLO ! EX, OUTCOLOR.r |= tmp
sts fpul,TM2 ! CO, tmp = FPUL
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
shll16 TM2 ! EX, tmp <<= 16
shll8 TM2 ! EX, tmp <<= 8
or TM2,CLO ! EX, OUTCOLOR.a |= tmp
1:
mov.l CLO,@OUT ! LS, OUT->color = OUTCOLOR
mov.l @r15+,r5 ! LS, pop(r5)
rts ! CO, return after executing instruction in delay slot
mov.l @r15+,r4 ! LS, pop(r4)
.size _ClipLine, .-_ClipLine
.type _ClipLine,%function

View File

@ -0,0 +1,184 @@
! FR0 = 0
! FR1 = 0
! FR2 = A.1
! FR3 = B.1
! FR4 = 0
! FR5 = 0
! FR6 = A.2
! FR7 = B.2
! FR8 = 0
! FR9 = 0
! FR10 = invT
! FR11 = t
#define TM1 r1 // temp register 1
#define TM2 r3 // temp register 2
#define IN1 r4 // input vertex 1
#define IN2 r5 // input vertex 2
#define OUT r6 // output vertex
#define CL1 r4 // input colour 1
#define CL2 r5 // input colour 2
#define CLO r7 // output colour
! Calculates the near plane intersection point between two points:
! float t = fabsf(v1->z) / fabsf(v2->z - v1->z)
! float invt = 1.0f - t;
!
! out->x = invt * v1->x + t * v2->x;
! out->y = invt * v1->y + t * v2->y;
! out->z = 0.0f; // clipped against near plane anyways (I.e Z/W = 0 --> Z = 0)
!
! out->u = invt * v1->u + t * v2->u;
! out->v = invt * v1->v + t * v2->v;
! out->w = invt * v1->w + t * v2->w;
!
! out->b = invt * v1->b + t * v2->b;
! out->g = invt * v1->g + t * v2->g;
! out->r = invt * v1->r + t * v2->r;
! out->a = invt * v1->a + t * v2->a;
! To optimise these calculations, FIPR is used:
! FIPR = FVm.x*FVn.x + FVm.y*FVn.x + FVm.z*FVn.z + FVm.w*FVn.w --> FVn.w
! FIPR can be used to accomplish "vout->Q invt * v1->Q + t * v2->Q" by:
! - assigning x/y components to 0 for both vectors
! - assigning t and invT to z/w of FVm vector
! - assigning v1 and v2 to z/w of FVn vector
! FIPR = 0*0 + 0*0 + t*v1->Q + invT*v2->Q --> FVn.w
! FIPR = t*v1->Q + invT*v2->Q --> FVn.w
.global _ClipEdge
.align 4
_ClipEdge:
mov IN1, TM1 ! MT, tmp = &v1
fldi0 fr4 ! LS, fr4 = 0
add #12, TM1 ! EX, tmp = &v1->z
fmov.s @TM1, fr2 ! LS, fr2 = v1->z
mov IN2, TM1 ! MT, tmp = &v2
fldi0 fr5 ! LS, fr5 = 0
add #12, TM1 ! EX, tmp = &v2->z
fmov.s @TM1,fr11 ! LS, fr11 = v2->z
fsub fr2,fr11 ! FE, fr11 = v2->z - v1->z
fldi0 fr8 ! LS, fr8 = 0
fmul fr11,fr11 ! FE, fr11 = (v2->z - v1->z) * (v2->z * v1->z)
fldi0 fr9 ! LS, fr9 = 0
fldi0 fr0 ! LS, fr0 = 0
fldi0 fr1 ! LS, fr1 = 0
fsrra fr11 ! FE, fr11 = 1 / abs(v2->z - v1->z)
fabs fr2 ! LS, fr2 = abs(v1->z)
fmul fr2,fr11 ! FE, fr11 = abs(v1->Z) / abs(v2->z - v1->z) --> t
add #4, IN1 ! EX, v1 += 4
fldi1 fr10 ! LS, fr10 = 1
add #4, IN2 ! EX, v2 += 4
add #4, OUT ! EX, OUT += 4
fsub fr11,fr10 ! FE, fr10 = 1.0 - t --> invT
fmov.s @IN1+, fr2 ! LS, A1 = v1->x, v1 += 4
fmov.s @IN2+, fr3 ! LS, B1 = v2->x, v2 += 4
fipr fv8, fv0 ! FE, LERP(A1, B1)
fmov.s @IN1+, fr6 ! LS, A2 = v1->y, v1 += 4
fmov.s @IN2+, fr7 ! LS, B2 = v2->y, v2 += 4
fmov.s fr3,@OUT ! LS, OUT->x = LERP
add #4, OUT ! EX, OUT += 4
fipr fv8, fv4 ! FE, LERP(A2, B2)
add #4, IN1 ! EX, v1 += 4
add #4, IN2 ! EX, v2 += 4
fmov.s fr7,@OUT ! LS, OUT->y = LERP
add #4, OUT ! EX, OUT += 4
fmov.s fr1,@OUT ! LS, OUT->z = 0
add #4, OUT ! EX, OUT += 4
fmov.s @IN1+, fr2 ! LS, A1 = v1->u, v1 += 4
fmov.s @IN2+, fr3 ! LS, B1 = v2->u, v2 += 4
fipr fv8, fv0 ! FE, LERP(A1, B1)
fmov.s @IN1+, fr6 ! LS, A2 = v1->v, v1 += 4
fmov.s @IN2+, fr7 ! LS, B2 = v2->v, v2 += 4
fmov.s fr3,@OUT ! LS, OUT->u = LERP
add #4, OUT ! EX, OUT += 4
fipr fv8, fv4 ! FE, LERP(A2, B2)
add #4, IN1 ! EX, v1 += 4
add #4, IN2 ! EX, v2 += 4
fmov.s @IN1,fr2 ! LS, A1 = v1->w
fmov.s @IN2,fr3 ! LS, B1 = v2->w
fmov.s fr7,@OUT ! LS, OUT->v = LERP
add #8, OUT ! EX, OUT += 8
fipr fv8, fv0 ! FE, LERP(A1, B1)
add #-4, IN1 ! EX, v1 -= 4
add #-4, IN2 ! EX, v2 -= 4
fmov.s fr3,@OUT ! LS, OUT->w = lerp
add #-4, OUT ! EX, OUT -= 4
mov.l @IN1,CL1 ! LS, ACOLOR = v1->bgra
mov.l @IN2,CL2 ! LS, BCOLOR = v2->bgra
! Bypass RGBA interpolation if unnecessary
cmp/eq CL1,CL2 ! MT, T = ACOLOR == BCOLOR
bt.s 1f ! BR, if (T) goto 1;
mov CL1,CLO ! MT, OUTCOLOR = ACOLOR (branch delay instruction)
! Interpolate B
extu.b CL1,TM1 ! EX, val = ACOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.b
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
shlr8 CL1 ! EX, ACOLOR >>= 8
ftrc fr3,fpul ! FE, FPUL = int(lerp)
shlr8 CL2 ! EX, BCOLOR >>= 8
sts fpul,TM2 ! CO, tmp = FPUL
! Interpolate G
extu.b CL1,TM1 ! EX, val = ACOLOR.g
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.g
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
shlr8 CL1 ! EX, ACOLOR >>= 8
ftrc fr3,fpul ! FE, FPUL = int(lerp)
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
mov TM2,CLO ! MT, OUTCOLOR.b = tmp
shlr8 CL2 ! EX, BCOLOR >>= 8
sts fpul,TM2 ! CO, tmp = FPUL
! Interpolate R
extu.b CL1,TM1 ! EX, val = ACOLOR.r
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.r
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
shlr8 CL1 ! EX, ACOLOR >>= 8
ftrc fr3,fpul ! FE, FPUL = int(lerp)
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
shll8 TM2 ! EX, tmp <<= 8
or TM2,CLO ! EX, OUTCOLOR.g |= tmp
shlr8 CL2 ! EX, BCOLOR >>= 8
sts fpul,TM2 ! CO, tmp = FPUL
extu.b CL1,TM1 ! EX, val = ACOLOR.a
lds TM1,fpul ! CO, FPUL = val
float fpul,fr2 ! EX, fr2 = float(FPUL)
extu.b CL2,TM1 ! EX, val = BCOLOR.a
lds TM1,fpul ! CO, FPUL = val
float fpul,fr3 ! EX, fr3 = float(FPUL)
fipr fv8, fv0 ! FE, LERP(A1, B1)
ftrc fr3,fpul ! FE, FPUL = int(lerp)
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
shll16 TM2 ! EX, tmp <<= 16
or TM2,CLO ! EX, OUTCOLOR.r |= tmp
sts fpul,TM2 ! CO, tmp = FPUL
extu.b TM2,TM2 ! EX, tmp = (uint8)tmp
shll16 TM2 ! EX, tmp <<= 16
shll8 TM2 ! EX, tmp <<= 8
or TM2,CLO ! EX, OUTCOLOR.a |= tmp
1:
rts ! CO, return after executing instruction in delay slot
mov.l CLO,@OUT ! LS, OUT->color = OUTCOLOR
.size _ClipEdge, .-_ClipEdge
.type _ClipEdge, %function

612
misc/dreamcast/VertexDraw.S Normal file
View File

@ -0,0 +1,612 @@
! r8 = STORE_QUEUE
! r9 = num vertices left
! r10 = PVR_CMD_VERTEX
! r11 = PVR_CMD_VERTEX_EOL
! r12 = ClipLine function
! r13 = cur vertex
! r14 = next vertex (prefetch)
#define R_VTX r10
#define R_EOL r11
#define REG_CMD_VTX r10
#define REG_CMD_EOL r11
#define REG_CLIPFUNC r12
.align 4
! Pushes a vertex to the store queue
! CLOBBERS: r2
! INPUTS: R (vertex), r8 (SQ global)
! OUTPUTS: r8 altered
.macro PushVertex R
! memcpy(r8, \R, 32)
mov.l @(0,\R), r2
mov.l r2, @(0,r8)
mov.l @(4,\R), r2
mov.l r2, @(4,r8)
mov.l @(8,\R), r2
mov.l r2, @(8,r8)
mov.l @(12,\R),r2
mov.l r2,@(12,r8)
mov.l @(16,\R),r2
mov.l r2,@(16,r8)
mov.l @(20,\R),r2
mov.l r2,@(20,r8)
mov.l @(24,\R),r2
mov.l r2,@(24,r8)
mov.l @(28,\R),r2
mov.l r2,@(28,r8)
pref @r8 ! LS, Trigger SQ
add #32,r8 ! EX, SQ += 32
.endm
! Transforms then pushes a vertex to the store queue
! note: Vertices are assumed as pre viewport transformed already
! CLOBBERS: r2, fr0, fr4, fr5
! INPUTS: R (vertex), r8 (SQ global)
! OUTPUTS: R, r8 altered
.macro TransformVertex R
! INVERSE W CALCULATION
add #28, \R ! EX, SRC += 28
fmov.s @\R,fr0 ! LS, fr0 = v->w
fmul fr0,fr0 ! FE, fr0 = fr0 * fr0
add #-28, \R ! EX, SRC -= 28
mov.l @\R+, r2 ! LS, tmp = SRC->flags, SRC += 4
mov.l r2,@r8 ! LS, DST->flags = tmp
fsrra fr0 ! FE, invW = 1 / sqrt(SRC->W * SRC->W)
add #4, r8 ! EX, DST += 4
! COPY U,V
mov.l @(12,\R),r2 ! LS, tmp = SRC->u
mov.l r2,@(12,r8) ! LS, DST->u = tmp
mov.l @(16,\R),r2 ! LS, tmp = SRC->v
mov.l r2,@(16,r8) ! LS, DST->v = tmp
! TRANSFORM X
fmov.s @\R,fr4 ! LS, fr4 = SRC->x
fmul fr0,fr4 ! FE, fr4 = invW * SRC->x
mov.l @(20,\R),r2 ! LS, tmp = SRC->bgra
mov.l r2,@(20,r8) ! LS, SRC->bgra = tmp
add #4, \R ! EX, SRC += 4
fmov.s fr4,@r8 ! LS, DST->x = fr4
! TRANSFORM Y
fmov.s @\R,fr4 ! LS, fr4 = SRC->y
add #8, r8 ! EX, DST += 8
fmul fr0,fr4 ! FE, fr4 = invW * SRC->y
fmov.s fr0,@r8 ! LS, DST->z = invW
add #-4, r8 ! EX, DST -= 4
add #-8, \R ! EX, src -= 8 (back to start of vertex)
fmov.s fr4,@r8 ! LS, DST->y = fr4
add #-8,r8 ! EX, DST -= 8 (back to start of vertex)
pref @r8 ! LS, Trigger SQ
add #32,r8 ! EX, SQ += 32
.endm
#define REG_CLIP1 r1
#define REG_CLIP2 r2
#define REG_V0 r4
#define REG_V1 r5
#define REG_V2 r6
#define REG_V3 r7
! r3 also matches out parameter for ClipLine
#define REG_TMP r3
#define TMP_SET_A \
mov r15, REG_TMP
#define TMP_SET_B \
mov r15, REG_TMP; add #32, REG_TMP
_Case_0_0_0_1:
! v0
! / |
! / |
! .....A....B...
! / |
! v3--v2---v1
sts pr,r13
TMP_SET_A
mov REG_V3, REG_CLIP1
mov REG_V0, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
TMP_SET_B
mov REG_V0, REG_CLIP1
mov REG_V1, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TransformVertex REG_V0
TMP_SET_B
TransformVertex REG_TMP
TMP_SET_A
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_0_0_1_0:
! v1
! / |
! / |
! ....A.....B...
! / |
! v0--v3---v2
sts pr,r13
TMP_SET_A
mov REG_V0, REG_CLIP1
mov REG_V1, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V1, REG_CLIP1
mov REG_V2, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
TMP_SET_A
TransformVertex REG_TMP
TransformVertex REG_V1
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_0_1_0_0:
! v2
! / |
! / |
! ....A.....B...
! / |
! v1--v0---v3
sts pr,r13
TMP_SET_A
mov REG_V1, REG_CLIP1
mov REG_V2, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V2, REG_CLIP1
mov REG_V3, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
TMP_SET_A
TransformVertex REG_TMP
TransformVertex REG_V2
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_0_0_0:
! v3
! / |
! / |
! ....A.....B...
! / |
! v2--v1---v0
sts pr,r13
TMP_SET_A
mov REG_V2, REG_CLIP1
mov REG_V3, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V3, REG_CLIP1
mov REG_V0, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
TransformVertex REG_TMP
TMP_SET_A
TransformVertex REG_TMP
TransformVertex REG_V3
lds r13,pr
rts
nop
_Case_0_0_1_1:
! v0-----------v1
! \ |
! ....B..........A...
! \ |
! v3-----v2
sts pr,r13
TMP_SET_A
mov REG_V1, REG_CLIP1
mov REG_V2, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V3, REG_CLIP1
mov REG_V0, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
TransformVertex REG_V1
TMP_SET_A
TransformVertex REG_TMP
TransformVertex REG_V0
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_0_0_1:
! v3-----------v0
! \ |
! ....B..........A...
! \ |
! v2-----v1
sts pr,r13
TMP_SET_A
mov REG_V0, REG_CLIP1
mov REG_V1, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V2, REG_CLIP1
mov REG_V3, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_A
TransformVertex REG_TMP
TMP_SET_B
TransformVertex REG_TMP
TransformVertex REG_V0
TransformVertex REG_V3
lds r13,pr
rts
nop
_Case_0_1_1_0:
! v1-----------v2
! \ |
! ....B..........A...
! \ |
! v0-----v3
sts pr,r13
TMP_SET_A
mov REG_V2, REG_CLIP1
mov REG_V3, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
TMP_SET_B
mov REG_V0, REG_CLIP1
mov REG_V1, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TransformVertex REG_V1
TransformVertex REG_V2
TMP_SET_B
TransformVertex REG_TMP
TMP_SET_A
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_1_0_0:
! v2-----------v3
! \ |
! ....B..........A...
! \ |
! v1-----v0
sts pr,r13
TMP_SET_A
mov REG_V3, REG_CLIP1
mov REG_V0, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V1, REG_CLIP1
mov REG_V2, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
TransformVertex REG_TMP
TransformVertex REG_V2
TMP_SET_A
TransformVertex REG_TMP
TransformVertex REG_V3
lds r13,pr
rts
nop
_Case_0_1_1_1:
! --v1--
! v0-- --v2
! \ |
! .....B.....A...
! \ |
! v3
! v1,v2,v0 v2,v0,A v0,A,B
sts pr,r13
TMP_SET_A
mov REG_V2, REG_CLIP1
mov REG_V3, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V3, REG_CLIP1
mov REG_V0, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
TransformVertex REG_V1
TransformVertex REG_V2
TransformVertex REG_V0
TMP_SET_A
TransformVertex REG_TMP
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_0_1_1:
! --v0--
! v3-- --v1
! \ |
! .....B.....A...
! \ |
! v2
! v0,v1,v3 v1,v3,A v3,A,B
sts pr,r13
TMP_SET_A
mov REG_V1, REG_CLIP1
mov REG_V2, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V2, REG_CLIP1
mov REG_V3, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
mov.l REG_CMD_VTX, @REG_V3
TransformVertex REG_V0
TransformVertex REG_V1
TransformVertex REG_V3
TMP_SET_A
TransformVertex REG_TMP
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_1_0_1:
! --v3--
! v2-- --v0
! \ |
! .....B.....A...
! \ |
! v1
! v3,v0,v2 v0,v2,A v2,A,B
sts pr,r13
TMP_SET_A
mov REG_V0, REG_CLIP1
mov REG_V1, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V1, REG_CLIP1
mov REG_V2, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
mov.l REG_CMD_VTX, @REG_V3
TransformVertex REG_V3
TransformVertex REG_V0
TransformVertex REG_V2
TMP_SET_A
TransformVertex REG_TMP
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_1_1_0:
! --v2--
! v1-- --v3
! \ |
! .....B.....A...
! \ |
! v0
! v2,v3,v1 v3,v1,A v1,A,B
sts pr,r13
TMP_SET_A
mov REG_V3, REG_CLIP1
mov REG_V0, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_VTX, @REG_TMP
TMP_SET_B
mov REG_V0, REG_CLIP1
mov REG_V1, REG_CLIP2
jsr @REG_CLIPFUNC
mov.l REG_CMD_EOL, @REG_TMP
mov.l REG_CMD_VTX, @REG_V3
TransformVertex REG_V2
TransformVertex REG_V3
TransformVertex REG_V1
TMP_SET_A
TransformVertex REG_TMP
TMP_SET_B
TransformVertex REG_TMP
lds r13,pr
rts
nop
_Case_1_1_1_1:
! Triangle strip: {1,2,0} {2,0,3}
TransformVertex REG_V1
TransformVertex REG_V2
TransformVertex REG_V0
TransformVertex REG_V3
rts
nop
.global _ProcessVertexList
.align 4
_ProcessVertexList:
! STORE CPU REGISTERS
mov.l r8,@-r15
mov.l r9,@-r15
mov.l r10,@-r15
mov.l r11,@-r15
mov.l r12,@-r15
mov.l r13,@-r15
mov.l r14,@-r15
sts.l pr,@-r15
! REGISTER SETUP
mov r4,r14
mov r4,r13
mov.l .CLIPFUNC,r12
mov.l .PVR_EOL, r11
mov.l .PVR_VTX, r10
mov r5,r9
mov r6,r8
bra SUBMIT_LOOP
add #-64,r15
! Submits a PowerVR GPU command
DO_CMD:
PushVertex REG_V0
bra NEXT_ITER
nop
SUBMIT_LOOP:
mov.l @r13,r0 ! FLAGS = CUR->flags
add #32,r14 ! NEXT += sizeof(Vertex)
mov r0,r2 ! TYPE = FLAGS
and r11,r2 ! TYPE = FLAGS & 0xF000000 (reuse PVR_CMD_VERTEX_EOL as type mask)
! Check for PVR_CMD_VERTEX
cmp/eq r10,r2 ! T = r2 == PVR_CMD_VERTEX
bt.s NEXT_ITER ! if (T) goto NEXT_ITER
pref @r14 ! prefetch(NEXT) -- always executed
! Check for non PVR_CMD_VERTEX_EOL
cmp/eq r11,r2 ! T = r2 == PVR_CMD_VERTEX_EOL
bf.s DO_CMD ! if (!T) goto DO_CMD
! PVR_CMD_VERTEX_EOL case
extu.b r0,r1 ! EX, MASK = FLAGS & 0xFF (branch delay slot)
mov.l r11,@r13 ! LS, CUR->flags = PVR_CMD_VERTEX_EOL
! Prepare and then jump to quad drawing function, based on quad clipflags
mova .CASES,r0 ! LS, r0 = CASES
mov r13,r7 ! MT, r7 = v3
shll2 r1 ! EX, MASK <<= 2
mov r13,r6 ! MT, r6 = v3
mov.l @(r0,r1),r2 ! LS, r1 = CASES[MASK]
mov r13,r5 ! MT, r5 = v3
add #-32,r6 ! EX, r6 = v3 - 1 (v2)
mov r13,r4 ! MT, r4 = v3
add #-64,r5 ! EX, r5 = v3 - 2 (v1)
jsr @r2 ! C0, jump CASES[MASK]
add #-96,r4 ! EX, r4 = v3 - 3 (v0) (branch delay slot)
NEXT_ITER:
dt r9 ! NUM--; T = NUM == 0
bf.s SUBMIT_LOOP
mov r14,r13 ! CUR = NEXT
add #64,r15
! RESTORE CPU REGISTERS
lds.l @r15+,pr
mov.l @r15+,r14
mov.l @r15+,r13
mov.l @r15+,r12
mov.l @r15+,r11
mov.l @r15+,r10
mov.l @r15+,r9
rts
mov.l @r15+,r8
.size _ProcessVertexList, .-_ProcessVertexList
.type _ProcessVertexList, %function
.align 4
.VP_1:
.long _vp
.PVR_VTX:
.long 0xE0000000
.PVR_EOL:
.long 0xF0000000
.CLIPFUNC:
.long _ClipLine
BUGGY_CASE:
rts
nop
! CASES table holds the functions to transfer a quad,
! based on the visibility clipflags of the 4 vertices
! e.g. CASES[15] = V0_VIS | V1_VIS | V2_VIS | V3_VIS (all 4 visible)
.CASES:
.long BUGGY_CASE ! Should never happen
.long _Case_0_0_0_1
.long _Case_0_0_1_0
.long _Case_0_0_1_1
.long _Case_0_1_0_0
.long BUGGY_CASE ! V0_VIS | V2_VIS, Should never happen
.long _Case_0_1_1_0
.long _Case_0_1_1_1
.long _Case_1_0_0_0
.long _Case_1_0_0_1
.long BUGGY_CASE ! V1_VIS | V3_VIS, Should never happen
.long _Case_1_0_1_1
.long _Case_1_1_0_0
.long _Case_1_1_0_1
.long _Case_1_1_1_0
.long _Case_1_1_1_1

View File

@ -0,0 +1,240 @@
#define FLG r0 // clip flags
#define TMP r1 // temp
#define VTX r2 // PVR_CMD_VERTEX
#define EOS r3 // PVR_CMD_VERTEX_EOL
#define SRC r4 // src pointer ARG
#define DST r5 // dst pointer ARG
#define CNT r6 // quads count ARG
#define PFT r7 // prefetch address
#define ZERO fr0 // 0.0
#define F_U fr1 // vertex.u
#define F_V fr2 // vertex.v
#define F_C fr3 // vertex.colour
#define F_X fr4 // vertex.x
#define F_Y fr5 // vertex.y
#define F_Z fr6 // vertex.z
#define F_W fr7 // vertex.w
#define XYZW fv4 // vertex.xyzw
! =========================================================
! ========================= TRANSFORM SETUP ===============
! =========================================================
.macro TransformSetup
mov SRC, PFT ! MT, pft = src
add #-32, DST ! EX, dst -= sizeof(VERTEX)
mov #0xE0, VTX ! EX, VTX = 0x00 00 00 E0
pref @PFT ! LS, PREFETCH pft (first vertex)
shll16 VTX ! EX, VTX = 0x00 E0 00 00
shll8 VTX ! EX, VTX = 0xE0 00 00 00 (PVR_CMD_VERTEX)
mov #0xF0, EOS ! EX, EOS = 0x00 00 00 F0
shll16 EOS ! EX, EOS = 0x00 F0 00 00
shll8 EOS ! EX, EOS = 0xF0 00 00 00 (PVR_CMD_VERTEX_EOL)
fldi0 ZERO ! LS, fr0 = 0.0
.endm
.macro TransformEnd
add #32, DST ! EX, DST += sizeof(VERTEX)
rts ! CO, return after executing instruction in delay slot
mov DST, r0 ! MT, r0 = DST
.endm
! =========================================================
! ========================= VERTEX LOADING ================
! =========================================================
.macro LoadColouredVertex
! LOAD XYZ
fmov @SRC+, F_X ! LS, X = src->x
fmov @SRC+, F_Y ! LS, Y = src->y
fmov @SRC+, F_Z ! LS, Z = src->z
fldi1 F_W ! LS, W = 1.0
! PREPARE NEXT VERTEX
add #16, PFT ! EX, pft += VERTEX_STRIDE
pref @PFT ! LS, PREFETCH pft (next vertex)
add #64, DST ! EX, dst += 2 * sizeof(VERTEX)
! TRANSFORM VERTEX
ftrv xmtrx, XYZW ! FE, TRANSFORM(XYZW)
! LOAD ATTRIBUTES
fmov @SRC+, F_C ! LS, C = src->color
.endm
.macro LoadTexturedVertex
! LOAD XYZ
fmov @SRC+, F_X ! LS, X = src->x
fmov @SRC+, F_Y ! LS, Y = src->y
fmov @SRC+, F_Z ! LS, Z = src->z
fldi1 F_W ! LS, W = 1.0
! PREPARE NEXT VERTEX
add #24, PFT ! EX, pft += VERTEX_STRIDE
pref @PFT ! LS, PREFETCH pft (next vertex)
add #64, DST ! EX, dst += 2 * sizeof(VERTEX)
! TRANSFORM VERTEX
ftrv xmtrx, XYZW ! FE, TRANSFORM(XYZW)
! LOAD ATTRIBUTES
fmov @SRC+, F_C ! LS, C = src->color
fmov @SRC+, F_U ! LS, U = src->u
fmov @SRC+, F_V ! LS, V = src->v
.endm
! =========================================================
! ========================= VERTEX OUTPUT =================
! =========================================================
! To take advantage of SH4 dual instruction processing,
! clipflag calculation and vertex output are interleaved
.macro ProcessVertex1
fmov.s F_W,@-DST ! LS, dst->w = W
fmov.s F_C,@-DST ! LS, dst->c = C
fmov.s F_V,@-DST ! LS, dst->v = V
fcmp/gt ZERO, F_Z ! FE, T = Z > 0
fmov.s F_U,@-DST ! LS, dst->u = U
movt FLG ! EX, CLIPFLAGS = T
fmov.s F_Z,@-DST ! LS, dst->z = Z
fmov.s F_Y,@-DST ! LS, dst->y = Y
fmov.s F_X,@-DST ! LS, dst->x = X
mov.l VTX,@-DST ! LS, dst->flags = PVR_CMD_VERTEX
.endm
.macro ProcessVertex2
fmov.s F_W,@-DST ! LS, dst->w = W
fmov.s F_C,@-DST ! LS, dst->c = C
fmov.s F_V,@-DST ! LS, dst->v = V
fcmp/gt ZERO,F_Z ! FE, T = Z > 0
fmov.s F_U,@-DST ! LS, dst->u = U
movt TMP ! EX, tmp = T
fmov.s F_Z,@-DST ! LS, dst->z = Z
add TMP,TMP ! EX, tmp = tmp + tmp
fmov.s F_Y,@-DST ! LS, dst->y = Y
or TMP,FLG ! EX, CLIPFLAGS |= tmp (T << 1)
fmov.s F_X,@-DST ! LS, dst->x = X
mov.l VTX,@-DST ! LS, dst->flags = PVR_CMD_VERTEX
.endm
.macro ProcessVertex3
fmov.s F_W,@-DST ! LS, dst->w = W
fmov.s F_C,@-DST ! LS, dst->c = C
fmov.s F_V,@-DST ! LS, dst->v = V
fcmp/gt ZERO, F_Z ! FE, T = Z > 0
fmov.s F_U,@-DST ! LS, dst->u = U
movt TMP ! EX, tmp = T
fmov.s F_Z,@-DST ! LS, dst->z = Z
fmov.s F_Y,@-DST ! LS, dst->y = Y
shll2 TMP ! EX, tmp = tmp << 2
fmov.s F_X,@-DST ! LS, dst->x = X
or TMP,FLG ! EX, CLIPFLAGS |= tmp (T << 2)
mov.l VTX,@-DST ! LS, dst->flags = PVR_CMD_VERTEX
.endm
.macro ProcessVertex4
fmov.s F_W,@-DST ! LS, dst->w = W
or EOS,FLG ! EX, CLIPFLAGS |= PVR_CMD_VERTEX_EOL
fmov.s F_C,@-DST ! LS, dst->c = C
fmov.s F_V,@-DST ! LS, dst->v = V
fcmp/gt ZERO, F_Z ! FE, T = Z > 0
fmov.s F_U,@-DST ! LS, dst->u = U
movt TMP ! EX, tmp = T
fmov.s F_Z,@-DST ! LS, dst->z = Z
shll2 TMP ! EX, tmp = tmp << 2
fmov.s F_Y,@-DST ! LS, dst->y = Y
add TMP,TMP ! EX, tmp = (tmp << 2) + (tmp << 2) (T << 3)
fmov.s F_X,@-DST ! LS, dst->x = X
or TMP,FLG ! EX, CLIPFLAGS |= tmp (T << 3)
mov.l FLG,@-DST ! LS, dst->flags = PVR_CMD_VERTEX_EOL | CLIPFLAGS
.endm
! =========================================================
! ==================== TEXTURED VERTEX TRANSFORM ==========
! =========================================================
.global _DrawTexturedQuads
.align 4
_DrawTexturedQuads:
! Setup
TransformSetup
.T_TRANSFORM_QUAD:
LoadTexturedVertex
ProcessVertex1
LoadTexturedVertex
ProcessVertex2
LoadTexturedVertex
ProcessVertex3
LoadTexturedVertex
ProcessVertex4
! CLIPFLAGS TESTING
and #15,FLG
cmp/eq #0,FLG ! T = CLIPFLAGS == 0 (all points invisible)
bt/s .T_NONE_VISIBLE ! if T goto NONE_VISIBLE
nop
bra .T_SOME_VISIBLE
nop
.T_NONE_VISIBLE:
bra .T_LOOP_END ! jump to loop end after executing instruction in delay slot
add #-128, DST ! DST -= 4 * sizeof(VERTEX), move back to prior quad, so that this invisible quad gets overwritten in next iteration
.T_SOME_VISIBLE:
.T_LOOP_END:
dt CNT ! count--; T = count == 0
bf .T_TRANSFORM_QUAD ! if !T then goto T_TRANSFORM_QUAD
nop
TransformEnd
.size _DrawTexturedQuads, .-_DrawTexturedQuads
.type _DrawTexturedQuads, %function
! =========================================================
! ==================== COLOURED VERTEX TRANSFORM ==========
! =========================================================
.global _DrawColouredQuads
.align 4
_DrawColouredQuads:
! Setup
fldi0 F_U ! U = 0
fldi0 F_V ! V = 0
TransformSetup
.C_TRANSFORM_QUAD:
LoadColouredVertex
ProcessVertex1
LoadColouredVertex
ProcessVertex2
LoadColouredVertex
ProcessVertex3
LoadColouredVertex
ProcessVertex4
! CLIPFLAGS TESTING
and #15,FLG
cmp/eq #0,FLG ! T = CLIPFLAGS == 0 (all points invisible)
bt/s .C_NONE_VISIBLE ! if T goto NONE_VISIBLE
nop
bra .C_SOME_VISIBLE
nop
.C_NONE_VISIBLE:
bra .C_LOOP_END ! jump to loop end after executing instruction in delay slot
add #-128, DST ! dst -= 4 * sizeof(VERTEX), move back to 1 vertex before start of quad
.C_SOME_VISIBLE:
.C_LOOP_END:
dt CNT ! count--; T = count == 0
bf .C_TRANSFORM_QUAD ! if !T then goto TRANSFORM_QUAD
nop
TransformEnd
.size _DrawColouredQuads, .-_DrawColouredQuads
.type _DrawColouredQuads, %function

View File

@ -1,246 +0,0 @@
! =========================================================
! ======================== PROCESSOR INFO =================
! =========================================================
! The SH4 can dual issue (i.e. parallel execution) two instructions
! as long as the groups of the two instructions are different:
! * LS - most ALU and FPU register load/stores
! * EX - most ALU arithmetic instructions
! * MT - TST, CMP, NOP, MOV Rm,Rn
! * FE - most FPU arithmetic instructions
! * CO - other instructions (NOTE: Cannot be exeucted in parallel)
! Thee following general aspects of instructions are important to note per the SH4 manual:
! * Issue rate: Interval between the issue of an instruction and that of the next instruction
! * Latency: Interval between the issue of an instruction and the generation of its result (completion)
! * Latency is also the interval between the execution of two instructions with an interdependent relationship.
! (although different cases may either increase or decrease Latency)
! =========================================================
! ======================== REGISTER USAGES ================
! =========================================================
! SH4 C ABI:
! - R0 to R3 are return values (can be overwritten)
! - R4 to R7 are input arguments (can be overwritten)
! - R8 to R13 are non-volatile (must be restored at end)
! - R14 is the frame pointer (must be restored at end)
! - R15 is the stack pointer (must be restored at end)
! - FR0 to FR3 are return values (can be overwritten)
! - FR4 to FR11 are input arguments (can be overwritten)
! - FR12 to FR13 are non-volatile (must be restored at end)
!r0 = clip flags
!r1 = GPU command
!r2 = temp
!r3 = prefetch address
!r4 = src pointer ARG
!r5 = dst pointer ARG
!r6 = quads count ARG
!r7 = ?
!r10 = PVR_CMD_VERTEX
!r11 = PVR_CMD_VERTEX_EOL
!fr0 = temp
!fr1 = u
!fr2 = v
!fr3 = c
!fr4 = x
!fr5 = y
!fr6 = z
!fr7 = w
!fr8 = VIEWPORT_HWIDTH
!fr9 = VIEWPORT_HHEIGHT
!fr10 = VIEWPORT_X_PLUS_HWIDTH
!fr11 = VIEWPORT_Y_PLUS_HHEIGHT
!fv4 = XYZW
! =========================================================
! ========================= TRANSFORM SETUP ===============
! =========================================================
.macro TransformSetup
mov r4,r3 ! MT, r3 = src
mov.l r10, @-r15 ! LS, push(r10)
add #-32, r5 ! EX, r5 -= sizeof(VERTEX)
mov.l r11, @-r15 ! LS, push(r11)
mov #0xE0, r10 ! EX, r10 = 0x00 00 00 E0
pref @r3 ! LS, PREFETCH r3 (first vertex)
shll16 r10 ! EX, r10 = 0x00 E0 00 00
shll8 r10 ! EX, r10 = 0xE0 00 00 00 (PVR_CMD_VERTEX)
mov #0xF0, r11 ! EX, r11 = 0x00 00 00 F0
shll16 r11 ! EX, r11 = 0x00 F0 00 00
shll8 r11 ! EX, r11 = 0xF0 00 00 00 (PVR_CMD_VERTEX_EOL)
nop ! MT, align to even boundary
.endm
.macro TransformEnd
mov.l @r15+, r11 ! LS, pop(r11)
mov.l @r15+, r10 ! LS, pop(r10)
add #32, r5 ! EX, r5 += sizeof(VERTEX)
rts ! CO, return after executing instruction in delay slot
mov r5,r0 ! MT, r0 = r5
.endm
! =========================================================
! ========================= VERTEX LOADING ================
! =========================================================
.macro LoadColouredVertex
! LOAD XYZ
fmov @r4+, fr4 ! LS, X = src->x
fmov @r4+, fr5 ! LS, Y = src->y
fmov @r4+, fr6 ! LS, Z = src->z
fldi1 fr7 ! LS, W = 1.0
! PREPARE NEXT VERTEX
add #16, r3 ! EX, r3 += VERTEX_STRIDE
pref @r3 ! LS, PREFETCH r3 (next vertex)
add #64, r5 ! EX, r5 += 2 * sizeof(VERTEX)
! TRANSFORM VERTEX
ftrv xmtrx, fv4 ! FE, TRANSFORM(XYZW)
! LOAD ATTRIBUTES
fmov @r4+,fr3 ! LS, C = src->color
.endm
.macro LoadTexturedVertex
! LOAD XYZ
fmov @r4+, fr4 ! LS, X = src->x
fmov @r4+, fr5 ! LS, Y = src->y
fmov @r4+, fr6 ! LS, Z = src->z
fldi1 fr7 ! LS, W = 1.0
! PREPARE NEXT VERTEX
add #24, r3 ! EX, r3 += VERTEX_STRIDE
pref @r3 ! LS, PREFETCH r3 (next vertex)
add #64, r5 ! EX, r5 += 2 * sizeof(VERTEX)
! TRANSFORM VERTEX
ftrv xmtrx, fv4 ! FE, TRANSFORM(XYZW)
! LOAD ATTRIBUTES
fmov @r4+,fr3 ! LS, C = src->color
fmov @r4+,fr1 ! LS, U = src->u
fmov @r4+,fr2 ! LS, V = src->v
.endm
! =========================================================
! ========================= VERTEX OUTPUT =================
! =========================================================
! To take advantage of SH4 dual instruction processing,
! clipflag calculation and vertex output are interleaved
.macro ProcessVertex1
fmov.s fr7,@-r5 ! LS, dst->w = W
fmov.s fr3,@-r5 ! LS, dst->c = C
fneg fr7 ! LS, W = -W
fmov.s fr2,@-r5 ! LS, dst->v = V
fcmp/gt fr7,fr6 ! FE, T = Z > W (i.e. Z > -W)
fmov.s fr1,@-r5 ! LS, dst->u = U
movt r0 ! EX, CLIPFLAGS = T
fmov.s fr6,@-r5 ! LS, dst->z = Z
fmov.s fr5,@-r5 ! LS, dst->y = Y
fmov.s fr4,@-r5 ! LS, dst->x = X
mov.l r10,@-r5 ! LS, dst->flags = PVR_CMD_VERTEX
.endm
.macro ProcessVertex2
fmov.s fr7,@-r5 ! LS, dst->w = W
fmov.s fr3,@-r5 ! LS, dst->c = C
fneg fr7 ! LS, W = -W
fmov.s fr2,@-r5 ! LS, dst->v = V
fcmp/gt fr7,fr6 ! FE, T = Z > W (i.e. Z > -W)
fmov.s fr1,@-r5 ! LS, dst->u = U
movt r2 ! EX, tmp = T
fmov.s fr6,@-r5 ! LS, dst->z = Z
add r2,r2 ! EX, tmp = tmp + tmp
fmov.s fr5,@-r5 ! LS, dst->y = Y
or r2,r0 ! EX, CLIPFLAGS |= tmp (T << 1)
fmov.s fr4,@-r5 ! LS, dst->x = X
mov.l r10,@-r5 ! LS, dst->flags = PVR_CMD_VERTEX
.endm
.macro ProcessVertex3
fmov.s fr7,@-r5 ! LS, dst->w = W
fmov.s fr3,@-r5 ! LS, dst->c = C
fneg fr7 ! LS, W = -W
fmov.s fr2,@-r5 ! LS, dst->v = V
fcmp/gt fr7,fr6 ! FE, T = Z > W (i.e. Z > -W)
fmov.s fr1,@-r5 ! LS, dst->u = U
movt r2 ! EX, tmp = T
fmov.s fr6,@-r5 ! LS, dst->z = Z
fmov.s fr5,@-r5 ! LS, dst->y = Y
shll2 r2 ! EX, tmp = tmp << 2
fmov.s fr4,@-r5 ! LS, dst->x = X
or r2,r0 ! EX, CLIPFLAGS |= tmp (T << 2)
mov.l r10,@-r5 ! LS, dst->flags = PVR_CMD_VERTEX
.endm
.macro ProcessVertex4
fmov.s fr7,@-r5 ! LS, dst->w = W
or r11,r0 ! EX, CLIPFLAGS |= PVR_CMD_VERTEX_EOL
fmov.s fr3,@-r5 ! LS, dst->c = C
fneg fr7 ! LS, W = -W
fmov.s fr2,@-r5 ! LS, dst->v = V
fcmp/gt fr7,fr6 ! FE, T = Z > W (i.e. Z > -W)
fmov.s fr1,@-r5 ! LS, dst->u = U
movt r2 ! EX, tmp = T
fmov.s fr6,@-r5 ! LS, dst->z = Z
shll2 r2 ! EX, tmp = tmp << 2
fmov.s fr5,@-r5 ! LS, dst->y = Y
add r2,r2 ! EX, tmp = (tmp << 2) + (tmp << 2) (T << 3)
fmov.s fr4,@-r5 ! LS, dst->x = X
or r2,r0 ! EX, CLIPFLAGS |= tmp (T << 3)
mov.l r0,@-r5 ! LS, dst->flags = PVR_CMD_VERTEX_EOL | CLIPFLAGS
.endm
! =========================================================
! ====================== VIEWPORT TRANSFORM ===============
! =========================================================
!r2 = return addr
!r0 = temp
!r5 = dst pointer
!fr0 = temp
!fr4 = temp
!fr5 = temp
!fr5 = temp
!fr8 = VIEWPORT_HWIDTH
!fr9 = VIEWPORT_HHEIGHT
!fr10 = VIEWPORT_X_PLUS_HWIDTH
!fr11 = VIEWPORT_Y_PLUS_HHEIGHT
.macro ViewportTransformSetup vp_addr
mova \vp_addr, r0 ! EX, r0 = &VIEWPORT
fmov.s @r0+,fr8 ! LS, fr8 = VIEWPORT_HWIDTH
fmov.s @r0+,fr9 ! LS, fr9 = VIEWPORT_HHEIGHT
fmov.s @r0+,fr10 ! LS, fr10 = VIEWPORT_X_PLUS_HWIDTH
fmov.s @r0+,fr11 ! LS, fr11 = VIEWPORT_Y_PLUS_HHEIGHT
nop ! MT (align to even instructions boundary)
.endm
.macro ViewportTransformVertex
! INVERSE W CALCULATION
add #28, r5 ! EX, r5 = &vertex->w
fmov.s @r5,fr0 ! LS, fr0 = vertex->w
fmul fr0,fr0 ! FE, fr0 = fr0 * fr0
add #-24, r5 ! EX, r5 = &vertex->x
fsrra fr0 ! FE, fr0 = 1 / sqrt(fr0) -> 1 / vertex->w
! TRANSFORM X
fmov.s @r5,fr4 ! LS, fr4 = vertex->x
fmov fr10,fr5 ! LS, fr5 = VIEWPORT_X_PLUS_HWIDTH
fmul fr8,fr4 ! FE, fr4 = VIEWPORT_HWIDTH * vertex->x
fmac fr0,fr4,fr5 ! FE, fr5 = fr0 * fr4 + fr5 -- (X * F * hwidth) + x_plus_hwidth
fmov.s fr5,@r5 ! LS, vertex->x = fr5
add #4, r5 ! EX, r5 = &vertex->y
! TRANSFORM Y
fmov.s @r5,fr4 ! LS, fr4 = vertex->y
fmov fr11,fr5 ! LS, fr5 = VIEWPORT_Y_PLUS_HHEIGHT
fmul fr9,fr4 ! FE, fr4 = VIEWPORT_HHEIGHT * vertex->y
fmac fr0,fr4,fr5 ! FE, fr5 = fr0 * fr4 + fr5 -- (Y * F * hheight) + y_plus_hheight
fmov.s fr5,@r5 ! LS, vertex->y = fr5
add #4, r5 ! EX, r5 = &vertex->z
! ASSIGN Z
fmov.s fr0,@r5 ! LS, vertex->z = fr0
add #20, r5 ! EX, r5 += 20 (points to start of next vertex)
.endm

View File

@ -0,0 +1,31 @@
=========================================================
======================== PROCESSOR INFO =================
=========================================================
The SH4 can dual issue (i.e. parallel execution) two instructions
as long as the groups of the two instructions are different:
* LS - most ALU and FPU register load/stores
* EX - most ALU arithmetic instructions
* MT - TST, CMP, NOP, MOV Rm,Rn (NOTE: Can execute in parallel with other MT)
* FE - most FPU arithmetic instructions
* CO - other instructions (NOTE: Cannot never execute in parallel)
The following general aspects of instructions are important to note per the SH4 manual:
* Issue rate: Interval between the issue of an instruction and that of the next instruction
* Latency: Interval between the issue of an instruction and the generation of its result (completion)
* Latency is also the interval between the execution of two instructions with an interdependent relationship.
(although different cases may either increase or decrease Latency)
=========================================================
======================== REGISTER USAGES ================
=========================================================
SH4 C ABI:
- R0 to R3 are return values (can be overwritten)
- R4 to R7 are input arguments (can be overwritten)
- R8 to R13 are non-volatile (must be restored at end)
- R14 is the frame pointer (must be restored at end)
- R15 is the stack pointer (must be restored at end)
- FR0 to FR3 are return values (can be overwritten)
- FR4 to FR11 are input arguments (can be overwritten)
- FR12 to FR13 are non-volatile (must be restored at end)

View File

@ -1,24 +1,15 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/blocksds/core
export BLOCKSDSEXT ?= /opt/blocksds/external
export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
NAME := ClassiCube
GAME_TITLE := ClassiCube
GAME_TITLE := ClassiCube
GAME_SUBTITLE := Built with BlocksDS
GAME_AUTHOR := UnknownShadow200
GAME_ICON := misc/ds/icon.bmp
GAME_AUTHOR := UnknownShadow200
GAME_ICON := misc/ds/icon.bmp
GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR)
SOURCEDIRS := src
INCLUDEDIRS :=
DEFINES := -DPLAT_NDS
LIBS := -ldswifi9 -lnds9 -lc
LIBDIRS := $(BLOCKSDS)/libs/dswifi $(BLOCKSDS)/libs/libnds
export WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
# DLDI and internal SD slot of DSi
# --------------------------------
@ -28,137 +19,42 @@ SDROOT := sdroot
# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode
SDIMAGE := image.bin
# Build artifacts
# ---------------
BUILDDIR := build-nds
ELF := build-nds/$(NAME).elf
DUMP := build-nds/$(NAME).dump
MAP := build-nds/$(NAME).map
ROM := $(NAME).nds
# Tools
# -----
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
LD := $(PREFIX)gcc
OBJDUMP := $(PREFIX)objdump
MKDIR := mkdir
RM := rm -rf
# Verbose flag
# ------------
ifeq ($(VERBOSE),1)
V :=
# Build artfacts
# --------------
ifdef BUILD_DSI
BUILDDIR := build-dsi
ROM := ClassiCube-dsi.nds
else
V := @
BUILDDIR := build-nds
ROM := ClassiCube-nds.nds
endif
# Source files
# ------------
SOURCES_S := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.s))
SOURCES_C := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.c))
# Compiler and linker flags
# -------------------------
ARCH := -mthumb -mcpu=arm946e-s+nofp
SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs
WARNFLAGS := -Wall
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(INCLUDEFLAGS) \
$(ARCH) -ffunction-sections -fdata-sections \
-specs=$(SPECS)
CFLAGS += -std=gnu17 $(WARNFLAGS) $(DEFINES) $(INCLUDEFLAGS) \
$(ARCH) -O2 -ffunction-sections -fdata-sections \
-specs=$(SPECS)
LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \
-Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS)
# Intermediate build files
# ------------------------
OBJS := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C)))
DEPS := $(OBJS:.o=.d)
# Targets
# -------
.PHONY: all clean dump dldipatch sdimage
.PHONY: all clean arm9 arm7 dldipatch sdimage
all: $(ROM)
# Combine the title strings
ifeq ($(strip $(GAME_SUBTITLE)),)
GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_AUTHOR)
else
GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR)
endif
$(ROM): $(ELF)
@echo " NDSTOOL $@"
$(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \
-7 $(BLOCKSDS)/sys/default_arm7/arm7.elf -9 $(ELF) \
-b $(GAME_ICON) "$(GAME_FULL_TITLE)" \
$(NDSTOOL_ARGS)
$(ELF): $(OBJS)
@echo " LD $@"
$(V)$(LD) -o $@ $(OBJS) $(LDFLAGS)
$(DUMP): $(ELF)
@echo " OBJDUMP $@"
$(V)$(OBJDUMP) -h -C -S $< > $@
dump: $(DUMP)
clean:
@echo " CLEAN"
$(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE)
$(MAKE) -f Makefile.arm9 clean --no-print-directory
$(MAKE) -f Makefile.arm7 clean --no-print-directory
$(RM) $(ROM) $(BUILDDIR) $(SDIMAGE)
arm9:
$(MAKE) -f misc/ds/Makefile.arm9 --no-print-directory
arm7:
$(MAKE) -f misc/ds/Makefile.arm7 --no-print-directory
$(ROM): arm9 arm7
$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \
-7 $(BUILDDIR)/cc-arm7.elf -9 $(BUILDDIR)/cc-arm9.elf \
-b $(GAME_ICON) "$(GAME_FULL_TITLE)"
sdimage:
@echo " MKFATIMG $(SDIMAGE) $(SDROOT)"
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE)
$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE)
dldipatch: $(ROM)
@echo " DLDIPATCH $(ROM)"
$(V)$(BLOCKSDS)/tools/dldipatch/dldipatch patch \
$(BLOCKSDS)/sys/dldi_r4/r4tf.dldi $(ROM)
# Rules
# -----
$(BUILDDIR)/%.s.o : %.s
@echo " AS $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.c.o : %.c
@echo " CC $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.arm.c.o : %.arm.c
@echo " CC $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)
$(BLOCKSDS)/tools/dlditool/dlditool $(BLOCKSDS)/tools/dldi/r4tfv2.dldi $(ROM)

96
misc/ds/Makefile.arm7 Normal file
View File

@ -0,0 +1,96 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
export WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
SOURCEDIRS := misc/ds
INCLUDEDIRS :=
DSIWIFI := third_party/dsiwifi
ifdef BUILD_DSI
SOURCEDIRS += $(DSIWIFI)/arm_iop/source $(DSIWIFI)/common/source $(DSIWIFI)/arm_iop/source/ath $(DSIWIFI)/arm_iop/source/crypto $(DSIWIFI)/arm_iop/source/ieee
INCLUDEDIRS += $(DSIWIFI)/arm_iop/source $(DSIWIFI)/arm_iop/include $(DSIWIFI)/common/source $(DSIWIFI)/include $(DSIWIFI)/include/lwip
BUILDDIR := build-dsi
LIBS := -lc -lnds7
LIBDIRS := $(BLOCKSDS)/libs/libnds
else
BUILDDIR := build-nds
LIBS := -lc -lnds7 -ldswifi7
LIBDIRS := $(BLOCKSDS)/libs/libnds $(BLOCKSDS)/libs/dswifi
endif
NAME := cc-arm7
ELF := $(BUILDDIR)/$(NAME).elf
MAP := $(BUILDDIR)/$(NAME).map
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
LD := $(CC)
DEFINES := -D__NDS__ -DARM7
ARCH := -mcpu=arm7tdmi -mtune=arm7tdmi
WARNFLAGS := -Wall
# Source files
# ------------
S_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.s))
C_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.c))
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
-ffunction-sections -fdata-sections
CFLAGS += -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fomit-frame-pointer
LDFLAGS := -mthumb -mthumb-interwork $(LIBDIRSFLAGS) \
-Wl,-Map,$(MAP) -Wl,--gc-sections -nostdlib \
-T$(BLOCKSDS)/sys/crts/ds_arm7.ld \
-Wl,--no-warn-rwx-segments \
-Wl,--start-group $(LIBS) -lgcc -Wl,--end-group
# Intermediate build files
# ------------------------
OBJS := $(addprefix $(BUILDDIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o)))
DEPS := $(OBJS:.o=.d)
export VPATH := $(SOURCEDIRS)
# Targets
# -------
.PHONY: all clean
all: $(BUILDDIR) $(ELF)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(ELF): $(OBJS)
$(LD) -o $@ $(OBJS) $(BLOCKSDS)/sys/crts/ds_arm7_crt0.o $(LDFLAGS)
clean:
rm $(ELF) $(MAP) $(OBJS)
# Rules
# -----
$(BUILDDIR)/%.o : %.s
$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.o : %.c
$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)

106
misc/ds/Makefile.arm9 Normal file
View File

@ -0,0 +1,106 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
export WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
SOURCEDIRS := src
INCLUDEDIRS :=
DSIWIFI := third_party/dsiwifi
ifdef BUILD_DSI
SOURCEDIRS += $(DSIWIFI)/arm_host/source $(DSIWIFI)/common/source $(DSIWIFI)/arm_host/source/nds $(DSIWIFI)/arm_host/source/lwip $(DSIWIFI)/arm_host/source/lwip/ipv4 $(DSIWIFI)/arm_host/source/lwip/ipv6 $(DSIWIFI)/arm_host/source/lwip/netif $(DSIWIFI)/arm_host/source/lwip/netif/ppp $(DSIWIFI)/arm_host/source/lwip/api
INCLUDEDIRS += $(DSIWIFI)/arm_host/include $(DSIWIFI)/common/source $(DSIWIFI)/include $(DSIWIFI)/include/lwip
BUILDDIR := build-dsi
DEFINES := -DPLAT_NDS -DBUILD_DSI
LIBS := -lnds9 -lc
LIBDIRS := $(BLOCKSDS)/libs/libnds
else
BUILDDIR := build-nds
DEFINES := -DPLAT_NDS
LIBS := -ldswifi9 -lnds9 -lc
LIBDIRS := $(BLOCKSDS)/libs/dswifi $(BLOCKSDS)/libs/libnds
endif
NAME := cc-arm9
ELF := $(BUILDDIR)/$(NAME).elf
MAP := $(BUILDDIR)/$(NAME).map
# Tools
# -----
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
LD := $(PREFIX)gcc
# Source files
# ------------
S_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.s))
C_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.c))
# Compiler and linker flags
# -------------------------
ARCH := -mthumb -mcpu=arm946e-s+nofp
SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs
WARNFLAGS := -Wall
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(INCLUDEFLAGS) \
$(ARCH) -ffunction-sections -fdata-sections \
-specs=$(SPECS)
CFLAGS += -std=gnu17 $(WARNFLAGS) $(DEFINES) $(INCLUDEFLAGS) \
$(ARCH) -O2 -ffunction-sections -fdata-sections \
-specs=$(SPECS)
LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \
-Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS)
# Intermediate build files
# ------------------------
OBJS := $(addprefix $(BUILDDIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o)))
DEPS := $(OBJS:.o=.d)
export VPATH := $(SOURCEDIRS)
# Targets
# -------
.PHONY: all
all: $(BUILDDIR) $(ELF)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(ELF): $(OBJS)
$(LD) -o $@ $(OBJS) $(LDFLAGS)
clean:
rm $(ELF) $(MAP) $(OBJS)
rm -rf $(BUILDDIR)
# Rules
# -----
$(BUILDDIR)/%.o : %.s
$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.o : %.c
$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.arm.o : %.arm.c
$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

54
misc/ds/main_arm7.c Normal file
View File

@ -0,0 +1,54 @@
// SPDX-License-Identifier: Zlib
//
// Copyright (C) 2005 Michael Noland (joat)
// Copyright (C) 2005 Jason Rogers (Dovoto)
// Copyright (C) 2005-2015 Dave Murphy (WinterMute)
// Copyright (C) 2023 Antonio Niño Díaz
// Default ARM7 core
#include <dswifi7.h>
#include <nds.h>
volatile bool exit_loop = false;
static void power_button_callback(void) {
exit_loop = true;
}
static void vblank_handler(void) {
inputGetAndSend();
Wifi_Update();
}
int main(int argc, char *argv[]) {
enableSound();
readUserSettings();
ledBlink(0);
touchInit();
irqInit();
irqSet(IRQ_VBLANK, vblank_handler);
fifoInit();
installWifiFIFO();
installSoundFIFO();
installSystemFIFO();
setPowerButtonCB(power_button_callback);
initClockIRQTimer(3);
irqEnable(IRQ_VBLANK | IRQ_RTC);
while (!exit_loop)
{
const uint16_t key_mask = KEY_SELECT | KEY_START | KEY_L | KEY_R;
uint16_t keys_pressed = ~REG_KEYINPUT;
if ((keys_pressed & key_mask) == key_mask)
exit_loop = true;
swiWaitForVBlank();
}
return 0;
}

View File

@ -25,10 +25,9 @@ INCLUDES := third_party/bearssl/inc
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project

View File

@ -0,0 +1,3 @@
#!/bin/sh
mkdir -p ${XDG_DATA_HOME}/ClassiCube
cd ${XDG_DATA_HOME}/ClassiCube && exec ClassiCube $@

View File

@ -0,0 +1,78 @@
{
"id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "ClassiCubeLauncher",
"finish-args": [
"--socket=wayland",
"--socket=fallback-x11",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=pulseaudio"
],
"modules": [
{
"name": "SDL3",
"buildsystem": "cmake-ninja",
"builddir": true,
"sources": [
{
"type": "git",
"url": "https://github.com/libsdl-org/SDL.git",
"branch": "main"
}
],
"cleanup": [
"/bin/sdl3-config",
"/include",
"/lib/libSDL3.la",
"/lib/libSDL3main.a",
"/lib/libSDL3main.la",
"/lib/libSDL3_test.a",
"/lib/libSDL3_test.la",
"/lib/cmake",
"/share/aclocal",
"/lib/pkgconfig"
],
"modules": [
{
"name": "libdecor",
"buildsystem": "meson",
"config-opts": [
"-Ddemo=false"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.freedesktop.org/libdecor/libdecor.git"
}
],
"cleanup": [
"/include",
"/lib/pkgconfig"
]
}
]
},
{
"name": "ClassiCube",
"buildsystem": "simple",
"build-commands": [
"gcc -fno-math-errno src/*.c -o src/ClassiCube -rdynamic -lpthread -lGL -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3 -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -DCC_BUILD_FLATPAK -L /app/lib -lSDL3",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ClassiCube/ClassiCube.git"
}
]
}
]
}

View File

@ -0,0 +1,34 @@
{
"id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "ClassiCubeLauncher",
"finish-args": [
"--socket=x11",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=pulseaudio"
],
"modules": [
{
"name": "ClassiCube",
"buildsystem": "simple",
"build-commands": [
"gcc -fno-math-errno src/*.c -o src/ClassiCube -O1 -DCC_BUILD_FLATPAK -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -rdynamic -lm -lpthread -lX11 -lXi -lGL -ldl",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ClassiCube/ClassiCube.git"
}
]
}
]
}

View File

@ -1,29 +0,0 @@
id: net.classicube.flatpak.client
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: ClassiCubeLauncher
finish-args:
- --socket=x11
- --device=dri
- --share=network
- --share=ipc
- --socket=pulseaudio
modules:
- name: ClassiCube
buildsystem: simple
build-commands:
- gcc -fno-math-errno src/*.c -o src/ClassiCube -O1 -DCC_BUILD_FLATPAK -DCC_BUILD_GLMODERN -rdynamic -lm -lpthread -lX11 -lXi -lGL -ldl
- install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin
- install -Dm755 ClassiCubeLauncher -t ${FLATPAK_DEST}/bin
- install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg
- install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop
- install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml
sources:
- type: dir
path: ../../../
- type: script
dest-filename: ClassiCubeLauncher
commands:
- mkdir -p ${XDG_DATA_HOME}/ClassiCube
- cd ${XDG_DATA_HOME}/ClassiCube && exec /app/bin/ClassiCube "$@"

View File

@ -24,7 +24,16 @@ Exec=$GAME_DIR/ClassiCube
Icon=$GAME_DIR/CCicon.png
Path=$GAME_DIR
Terminal=false
Categories=Game
Categories=Game;
Actions=singleplayer;resume;
[Desktop Action singleplayer]
Name=Start singleplayer
Exec=$GAME_DIR/ClassiCube --singleplayer
[Desktop Action resume]
Name=Resume last server
Exec=$GAME_DIR/ClassiCube --resume
EOF
chmod +x $DESKTOP_FILE

View File

@ -19,7 +19,7 @@
9A6C7C962C073E0C00676D27 /* Screens.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7BFD2C073DEE00676D27 /* Screens.c */; };
9A6C7C972C073E0C00676D27 /* SSL.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7BFE2C073DEE00676D27 /* SSL.c */; };
9A6C7C982C073E0C00676D27 /* LBackend_Android.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7BFF2C073DEE00676D27 /* LBackend_Android.c */; };
9A6C7C992C073E0C00676D27 /* Window_SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7C002C073DEE00676D27 /* Window_SDL.c */; };
9A6C7C992C073E0C00676D27 /* Window_SDL2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7C002C073DEE00676D27 /* Window_SDL2.c */; };
9A6C7C9A2C073E0C00676D27 /* Graphics_GL2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7C012C073DEE00676D27 /* Graphics_GL2.c */; };
9A6C7C9B2C073E0C00676D27 /* Lighting.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7C022C073DEE00676D27 /* Lighting.c */; };
9A6C7C9C2C073E0C00676D27 /* EntityComponents.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A6C7C042C073DEF00676D27 /* EntityComponents.c */; };
@ -135,7 +135,7 @@
9A6C7BFD2C073DEE00676D27 /* Screens.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Screens.c; path = "../../../../../../ClassiCube-master/src/Screens.c"; sourceTree = "<group>"; };
9A6C7BFE2C073DEE00676D27 /* SSL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SSL.c; path = "../../../../../../ClassiCube-master/src/SSL.c"; sourceTree = "<group>"; };
9A6C7BFF2C073DEE00676D27 /* LBackend_Android.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = LBackend_Android.c; path = "../../../../../../ClassiCube-master/src/LBackend_Android.c"; sourceTree = "<group>"; };
9A6C7C002C073DEE00676D27 /* Window_SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Window_SDL.c; path = "../../../../../../ClassiCube-master/src/Window_SDL.c"; sourceTree = "<group>"; };
9A6C7C002C073DEE00676D27 /* Window_SDL2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Window_SDL2.c; path = "../../../../../../ClassiCube-master/src/Window_SDL2.c"; sourceTree = "<group>"; };
9A6C7C012C073DEE00676D27 /* Graphics_GL2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Graphics_GL2.c; path = "../../../../../../ClassiCube-master/src/Graphics_GL2.c"; sourceTree = "<group>"; };
9A6C7C022C073DEE00676D27 /* Lighting.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Lighting.c; path = "../../../../../../ClassiCube-master/src/Lighting.c"; sourceTree = "<group>"; };
9A6C7C032C073DEF00676D27 /* Http.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Http.h; path = "../../../../../../ClassiCube-master/src/Http.h"; sourceTree = "<group>"; };
@ -466,7 +466,7 @@
9A6C7C0F2C073DF100676D27 /* Vorbis.h */,
9A6C7C662C073E0400676D27 /* Widgets.c */,
9A6C7C122C073DF100676D27 /* Widgets.h */,
9A6C7C002C073DEE00676D27 /* Window_SDL.c */,
9A6C7C002C073DEE00676D27 /* Window_SDL2.c */,
9A6C7C162C073DF200676D27 /* Window_SDL3.c */,
9A6C7C302C073DF600676D27 /* Window_Terminal.c */,
9A6C7C692C073E0400676D27 /* Window.h */,
@ -563,7 +563,7 @@
9A6C7CAB2C073E0C00676D27 /* _ftbase.c in Sources */,
9A6C7CB22C073E0C00676D27 /* MapRenderer.c in Sources */,
9A6C7C9B2C073E0C00676D27 /* Lighting.c in Sources */,
9A6C7C992C073E0C00676D27 /* Window_SDL.c in Sources */,
9A6C7C992C073E0C00676D27 /* Window_SDL2.c in Sources */,
9A6C7CBF2C073E0C00676D27 /* TouchUI.c in Sources */,
9A6C7CD32C073E0C00676D27 /* Http_Worker.c in Sources */,
9A6C7CD82C073E0C00676D27 /* Entity.c in Sources */,

View File

@ -5,7 +5,7 @@
<key>CFBundleExecutable</key>
<string>ClassiCube</string>
<key>CFBundleIconFile</key>
<string>ClassiCube</string>
<string>appicon</string>
<key>CFBundleIdentifier</key>
<string>com.classicube.client.mac</string>
<key>CFBundleInfoDictionaryVersion</key>
@ -17,4 +17,4 @@
<key>CFBundleDisplayName</key>
<string>ClassiCube</string>
</dict>
</plist>
</plist>

View File

@ -18,19 +18,41 @@ SOURCE_DIR := src
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(BUILD_DIR) $(TARGET).code.bin
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(C_OBJECTS:%.o=%.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
default: $(BUILD_DIR) $(TARGET).bin
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
#---------------------------------------------------------------------------------
# executable generation
#---------------------------------------------------------------------------------
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(TARGET).code.bin
$(REZ) $(REZFLAGS) \
--copy "$(TARGET).code.bin" \
"misc/macclassic/68APPL.r" \
-t "APPL" -c "????" \
-o $(TARGET).bin --cc $(TARGET).APPL --cc $(TARGET).dsk
$(TARGET).code.bin: $(C_OBJECTS)
$(CC) $(C_OBJECTS) -o $@ $(LDFLAGS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
# Dependency tracking
$(DEPFILES):
include $(wildcard $(DEPFILES))

View File

@ -19,7 +19,24 @@ SOURCE_DIR := src
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(BUILD_DIR) $(TARGET).pef
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(C_OBJECTS:%.o=%.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
default: $(BUILD_DIR) $(TARGET).bin
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
#---------------------------------------------------------------------------------
# executable generation
#---------------------------------------------------------------------------------
$(TARGET).bin $(TARGET).APPL $(TARGET).dsk: $(TARGET).pef
$(REZ) $(REZFLAGS) \
"misc/macclassic/ppcAPPL.r" \
-t "APPL" -c "????" \
@ -35,5 +52,14 @@ $(TARGET).pef: $(TARGET).elf
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
# Dependency tracking
$(DEPFILES):
include $(wildcard $(DEPFILES))

View File

@ -7,7 +7,7 @@ TARGET := ClassiCube-n64
CFILES := $(notdir $(wildcard src/*.c))
OFILES := $(CFILES:.c=.o)
OBJS := $(addprefix $(BUILD_DIR)/,$(OFILES))
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types -Wno-error=maybe-uninitialized
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types
default: $(TARGET).z64

View File

@ -1,59 +1,59 @@
#--------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := ClassiCube
BUILD_DIR := build
SOURCE_DIR:= src
DATA := data
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
OBJECTS := $(C_OBJECTS) $(BUILD_DIR)/$(TARGET).res misc/os2/classicube.def
ENAME = ClassiCube
DEL = rm -f
APP_TITLE := ClassiCube
APP_AUTHOR := UnknownShadow200
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CC := gcc
CFLAGS := -pipe -fno-math-errno -O3 -g -mtune=pentium4 -msse2 -march=i686 -idirafter /@unixroot/usr/include/os2tk45 -DOS2
LDFLAGS := -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp -Zlinker DISABLE -Zlinker 1121
LIBS := -lcx -lmmpm2 -lpthread /@unixroot/usr/local/lib/kai.a
$(TARGET).exe: $(BUILD_DIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/$(TARGET).res: misc/os2/$(TARGET).rc misc/os2/$(TARGET).ico
wrc -r misc/os2/$(TARGET).rc -fo=$@
#--------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := ClassiCube
BUILD_DIR := build
SOURCE_DIR:= src
DATA := data
C_SOURCES := $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
OBJECTS := $(C_OBJECTS) $(BUILD_DIR)/$(TARGET).res misc/os2/classicube.def
ENAME = ClassiCube
DEL = rm -f
APP_TITLE := ClassiCube
APP_AUTHOR := UnknownShadow200
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CC := gcc
CFLAGS := -pipe -Wno-attributes -fno-math-errno -O3 -g -mtune=pentium4 -msse2 -march=i686 -idirafter /@unixroot/usr/include/os2tk45 -DOS2
LDFLAGS := -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp -Zlinker DISABLE -Zlinker 1121
LIBS := -lcx -lmmpm2 -lpthread /@unixroot/usr/local/lib/kai.a
$(TARGET).exe: $(BUILD_DIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/$(TARGET).res: misc/os2/$(TARGET).rc misc/os2/$(TARGET).ico
wrc -r misc/os2/$(TARGET).rc -fo=$@

View File

@ -11,11 +11,11 @@ project(
add_definitions(-DPLAT_PS1)
file(GLOB _sources ../../src/*.c)
psn00bsdk_add_executable(template GPREL ${_sources})
psn00bsdk_add_executable(ClassiCube-PS1 GPREL ${_sources})
psn00bsdk_add_cd_image(
iso # Target name
template # Output file name (= template.bin + template.cue)
iso.xml # Path to config file
DEPENDS template system.cnf
iso # Target name
ClassiCube-PS1 # Output file name (= ClassiCube-PS1.bin + ClassiCube-PS1.cue)
iso.xml # Path to config file
DEPENDS ClassiCube-PS1 system.cnf
)

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,7 @@
-->
<directory_tree>
<file name="SYSTEM.CNF" type="data" source="${PROJECT_SOURCE_DIR}/system.cnf" />
<file name="TEMPLATE.EXE" type="data" source="template.exe" />
<file name="CCUBEPS1.EXE" type="data" source="ClassiCube-PS1.exe" />
<!--
This file is only required if you are using dynamic linking
(see the system/dynlink example). It contains the executable's

View File

@ -1,4 +1,4 @@
BOOT=cdrom:\template.exe;1
BOOT=cdrom:\CCUBEPS1.exe;1
TCB=4
EVENT=10
STACK=801FFFF0

View File

@ -1,17 +1,24 @@
ifeq ($(strip $(PS2SDK)),)
$(error "PS2SDK must be set in your environment")
endif
SOURCE_DIRS := src third_party/bearssl/src misc/ps2
BUILD_DIR = build-ps2
CFILES := $(wildcard src/*.c)
OBJS := $(patsubst src/%.c, $(BUILD_DIR)/%.o, $(CFILES))
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(OBJS:%.o=%.d)
IOP_MODS:= DEV9_irx.o NETMAN_irx.o SMAP_irx.o USBD_irx.o BDM_irx.o BDMFS_FATFS_irx.o USBMASS_BD_irx.o USBHDFSD_irx.o USBMOUSE_irx.o USBKBD_irx.o
EE_BIN = ClassiCube-ps2.elf
EE_OBJS = $(OBJS) $(patsubst %.o, $(BUILD_DIR)/%.o, $(IOP_MODS))
EE_LIBS = -lpatches -lpad -lpacket -ldma -lgraph -ldraw -lc -lps2ip -lnetman -lmc -lmouse -lkbd
EE_INCS := -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include
EE_INCS := -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include -Ithird_party/bearssl/inc
EE_CFLAGS := -D_EE -G0 -O2 -Wall -gdwarf-2 -gz -DPLAT_PS2
EE_LDFLAGS := -L$(PS2SDK)/ee/lib -Wl,-zmax-page-size=128
EE_LINKFILE := $(PS2SDK)/ee/startup/linkfile
@ -23,6 +30,8 @@ clean:
$(BUILD_DIR):
mkdir -p $@
include $(PS2SDK)/samples/Makefile.pref
# Networking IRX modules
$(BUILD_DIR)/DEV9_irx.c: $(PS2SDK)/iop/irx/ps2dev9.irx
@ -58,17 +67,30 @@ $(BUILD_DIR)/USBKBD_irx.c: $(PS2SDK)/iop/irx/ps2kbd.irx
bin2c $< $@ USBKBD_irx
include $(PS2SDK)/samples/Makefile.pref
#---------------------------------------------------------------------------------
# executable generation
#---------------------------------------------------------------------------------
$(EE_BIN): $(EE_OBJS)
$(EE_CC) -T$(EE_LINKFILE) -O2 -o $(EE_BIN) $(EE_OBJS) $(EE_LDFLAGS) $(EE_LIBS)
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(BUILD_DIR)/%.o: src/%.c
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(EE_CC) $(DEPFLAGS) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
$(EE_CC) $(DEPFLAGS) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(BUILD_DIR)/%.o: misc/ps2/%.S
$(EE_CC) $(DEPFLAGS) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c # IOP modules
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(BUILD_DIR)/%.o: %.S
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
# Dependency tracking
$(DEPFILES):
$(EE_BIN): $(EE_OBJS)
$(EE_CC) -T$(EE_LINKFILE) -O2 -o $(EE_BIN) $(EE_OBJS) $(EE_LDFLAGS) $(EE_LIBS)
include $(wildcard $(DEPFILES))

246
misc/ps2/VertexTransform.S Normal file
View File

@ -0,0 +1,246 @@
# REGISTER USAGE
# vf0 = hardware coded to (0,0,0,1)
# vf1 = mvp.row1
# vf2 = mvp.row2
# vf3 = mvp.row3
# vf4 = mvp.row4
# vf5 = clipping scale adjustments to match guardbands
# vf6 = viewport origin
# vf7 = viewport scale
# NOTE: vclipw.xyz takes 4 cycles to produce result, which must be accounted for
.align 4
.global LoadMvpMatrix
.type LoadMvpMatrix,%function
.global LoadClipScaleFactors
.type LoadClipScaleFactors,%function
.global LoadViewportOrigin
.type LoadViewportOrigin,%function
.global LoadViewportScale
.type LoadViewportScale,%function
.global TransformTexturedQuad
.type TransformTexturedQuad,%function
.global TransformColouredQuad
.type TransformColouredQuad,%function
.global ViewportTransform
.type ViewportTransform,%function
# Loads matrix into VU0 registers
# $a0 = addresss of mvp
LoadMvpMatrix:
lqc2 $vf1, 0x00($a0) # vf1 = mvp.row1
lqc2 $vf2, 0x10($a0) # vf2 = mvp.row2
lqc2 $vf3, 0x20($a0) # vf3 = mvp.row3
lqc2 $vf4, 0x30($a0) # vf4 = mvp.row4
jr $ra
nop
# Loads clipping scaling factors into VU0 registers
# $a0 = addresss of factors
LoadClipScaleFactors:
lqc2 $vf5, 0x00($a0) # vf5 = factors
jr $ra
nop
# Loads viewport origin into VU0 registers
# $a0 = addresss of origin
LoadViewportOrigin:
lqc2 $vf6, 0x00($a0) # vf6 = origin
jr $ra
nop
# Loads viewport scale into VU0 registers
# $a0 = addresss of scale
LoadViewportScale:
lqc2 $vf7, 0x00($a0) # vf7 = scale
jr $ra
nop
.macro TransformVertex1
# LOAD VERTEX 1
lqc2 $vf10, 0x00($a2) # IN = tmp
# TRANSFORM VERTEX 1
vmulaw $ACC, $vf4, $vf0 # ACC[xyzw] = mvp.row3[xyzw] * 1.0f; (vf0.w is 1)
vmaddax $ACC, $vf1, $vf10 # ACC[xyzw] = ACC[xyzw] + mvp.row0[xyzw] * IN.x
vmadday $ACC, $vf2, $vf10 # ACC[xyzw] = ACC[xyzw] + mvp.row1[xyzw] * IN.y
vmaddz $vf11, $vf3, $vf10 # OUT[xyzw] = ACC[xyzw] + mvp.row2[xyzw] * IN.z
sqc2 $vf11, 0x00($a1) # dst[0] = TRANSFORMED(V0)
vmul $vf10, $vf11, $vf5 # TMP = TRANSFORMED(V0) * CLIP_PLANES_ADJUST
# BEGIN CLIP FLAGS CALCULATION VERTEX 1
vclipw.xyz $vf10, $vf10 # CLIP_FLAGS.append(CLIP(TMP.xyz, TMP.w))
.endm
.macro TransformVertex2
# LOAD VERTEX 2
lqc2 $vf12, 0x00($a2) # IN = tmp
# TRANSFORM VERTEX 2
vmulaw $ACC, $vf4, $vf0 # ACC[xyzw] = mvp.row3[xyzw] * 1.0f; (vf0.w is 1)
vmaddax $ACC, $vf1, $vf12 # ACC[xyzw] = ACC[xyzw] + mvp.row0[xyzw] * IN.x
vmadday $ACC, $vf2, $vf12 # ACC[xyzw] = ACC[xyzw] + mvp.row1[xyzw] * IN.y
vmaddz $vf13, $vf3, $vf12 # OUT[xyzw] = ACC[xyzw] + mvp.row2[xyzw] * IN.z
sqc2 $vf13, 0x10($a1) # dst[1] = TRANSFORMED(V1)
vmul $vf12, $vf13, $vf5 # TMP = TRANSFORMED(V1) * CLIP_PLANES_ADJUST
# STORE CLIP FLAGS VERTEX 1 RESULT
cfc2 $t0, $18 # t0 = VP0_REGS[CLIP_FLAGS]
sw $t0,0x00($a3) # clip_flags[0] = t0
# BEGIN CLIP FLAGS CALCULATION VERTEX 2
vclipw.xyz $vf12, $vf12 # CLIP_FLAGS.append(CLIP(TMP.xyz, TMP.w))
.endm
.macro TransformVertex3
# LOAD VERTEX 3
lqc2 $vf14, 0x00($a2) # IN = tmp
# TRANSFORM VERTEX 3
vmulaw $ACC, $vf4, $vf0 # ACC[xyzw] = mvp.row3[xyzw] * 1.0f; (vf0.w is 1)
vmaddax $ACC, $vf1, $vf14 # ACC[xyzw] = ACC[xyzw] + mvp.row0[xyzw] * IN.x
vmadday $ACC, $vf2, $vf14 # ACC[xyzw] = ACC[xyzw] + mvp.row1[xyzw] * IN.y
vmaddz $vf15, $vf3, $vf14 # OUT[xyzw] = ACC[xyzw] + mvp.row2[xyzw] * IN.z
sqc2 $vf15, 0x20($a1) # dst[2] = TRANSFORMED(V2)
vmul $vf14, $vf15, $vf5 # TMP = TRANSFORMED(V2) * CLIP_PLANES_ADJUST
# STORE CLIP FLAGS VERTEX 2 RESULT
cfc2 $t0, $18 # t0 = VP0_REGS[CLIP_FLAGS]
sw $t0,0x04($a3) # clip_flags[1] = t0
# BEGIN CLIP FLAGS CALCULATION VERTEX 3
vclipw.xyz $vf14, $vf14 # CLIP_FLAGS.append(CLIP(TMP.xyz, TMP.w))
.endm
.macro TransformVertex4
# LOAD VERTEX 4
lqc2 $vf16, 0x00($a2) # IN = tmp
# TRANSFORM VERTEX 4
vmulaw $ACC, $vf4, $vf0 # ACC[xyzw] = mvp.row3[xyzw] * 1.0f; (vf0.w is 1)
vmaddax $ACC, $vf1, $vf16 # ACC[xyzw] = ACC[xyzw] + mvp.row0[xyzw] * IN.x
vmadday $ACC, $vf2, $vf16 # ACC[xyzw] = ACC[xyzw] + mvp.row1[xyzw] * IN.y
vmaddz $vf17, $vf3, $vf16 # OUT[xyzw] = ACC[xyzw] + mvp.row2[xyzw] * IN.z
vmul $vf16, $vf17, $vf5 # TMP = TRANSFORMED(V3) * CLIP_PLANES_ADJUST
# STORE CLIP FLAGS VERTEX 3 RESULT
cfc2 $t0, $18 # t0 = VP0_REGS[CLIP_FLAGS]
sw $t0,0x08($a3) # clip_flags[2] = t0
# BEGIN CLIP FLAGS CALCULATION VERTEX 4
vclipw.xyz $vf16, $vf16 # CLIP_FLAGS.append(CLIP(TMP.xyz, TMP.w))
.endm
.macro TransformFinish
# Vertex output
# dst[0] = V0 (done by TransformVertex1)
# dst[1] = V1 (done by TransformVertex2)
# dst[2] = V2 (done by TransformVertex3)
# dst[3] = V2
# dst[4] = V3
# dst[5] = V0
sqc2 $vf15, 0x30($a1) # dst[3] = TRANSFORMED(V2)
sqc2 $vf17, 0x40($a1) # dst[4] = TRANSFORMED(V3)
sqc2 $vf11, 0x50($a1) # dst[5] = TRANSFORMED(V0)
vnop # adjust for delay
# STORE CLIP FLAGS 4 RESULT
cfc2 $t0, $18 # t0 = VP0_REGS[CLIP_FLAGS]
sw $t0,0x0C($a3) # clip_flags[3] = t0
.endm
# Transforms 4 vertices with size of 24 bytes
# $a0 = addresss of src vertices
# $a1 = addresss of dst vertices
# $a2 = address of tmp vertex
# $a3 = address of clip flags
TransformTexturedQuad:
# LOAD 1.0 into W
lw $t0,ONE_VALUE # t0 = 1.0f
sw $t0,0x0C($a2) # tmp.w = f5
# LOAD VERTEX 1
ld $t0,0x00($a0) # t0 = src[0].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x08($a0) # t0 = src[0].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex1
# LOAD VERTEX 2
ld $t0,0x18($a0) # t0 = src[1].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x20($a0) # t0 = src[1].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex2
# LOAD VERTEX 3
ld $t0,0x30($a0) # t0 = src[2].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x38($a0) # t0 = src[2].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex3
# LOAD VERTEX 4
ld $t0,0x48($a0) # t0 = src[3].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x50($a0) # t0 = src[3].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex4
TransformFinish
jr $ra
nop
# Transforms 4 vertices with size of 16 bytes
# $a0 = addresss of src vertices
# $a1 = addresss of dst vertices
# $a2 = address of tmp vertex
# $a3 = address of clip flags
TransformColouredQuad:
# LOAD 1.0 into W
lw $t0,ONE_VALUE # t0 = 1.0f
sw $t0,0x0C($a2) # tmp.w = f5
# LOAD VERTEX 1
ld $t0,0x00($a0) # t0 = src[0].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x08($a0) # t0 = src[0].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex1
# LOAD VERTEX 2
ld $t0,0x10($a0) # t0 = src[1].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x18($a0) # t0 = src[1].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex2
# LOAD VERTEX 3
ld $t0,0x20($a0) # t0 = src[2].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x28($a0) # t0 = src[2].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex3
# LOAD VERTEX 4
ld $t0,0x30($a0) # t0 = src[3].x,y
sd $t0,0x00($a2) # tmp.x,y = t0
lw $t0,0x38($a0) # t0 = src[3].z
sw $t0,0x08($a2) # tmp.z = t0
TransformVertex4
TransformFinish
jr $ra
nop
.global ONE_VALUE
ONE_VALUE: .float 1.0
# $a0 = addresss of src
# $a1 = addresss of dst
ViewportTransform:
lqc2 $vf16, 0x00($a0) # IN = src
vmulw $vf17, $vf16, $vf16 # TMP = IN[xyzw] * IN.w (inverse W)
vmul $vf18, $vf17, $vf7 # TMP = TMP * viewport_scale
vadd $vf19, $vf18, $vf6 # TMP = TMP + viewport_origin
vftoi0 $vf19, $vf19 # TMP = int(TMP)
sqc2 $vf19, 0x00($a1) # dst = TMP
jr $ra
nop

BIN
misc/psp/ICON0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,6 +1,12 @@
TARGET = ClassiCube-psp
SOURCES = $(wildcard src/*.c) $(wildcard third_party/bearssl/src/*.c)
OBJS = $(patsubst %.c, %.o, $(SOURCES))
TARGET = ClassiCube-psp
PSP_EBOOT_TITLE = ClassiCube
PSP_EBOOT_ICON = misc/psp/ICON0.png
BUILD_DIR := build-psp
SOURCE_DIRS := src third_party/bearssl/src
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
INCDIR = third_party/bearssl/inc
CFLAGS = -g -O1 -fno-math-errno
@ -10,10 +16,38 @@ LIBDIR =
LDFLAGS =
LIBS = -lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl
BUILD_PRX = 1
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(OBJS:%.o=%.d)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = ClassiCube
BUILD_PRX = 1
EXTRA_TARGETS = $(BUILD_DIR) EBOOT.PBP
ifeq ($(strip $(PSPSDK)),)
$(warning "Please set PSPSDK variables in your environment. For example:")
$(warning export PSPSDK=/usr/local/pspsk/psp/sdk)
$(warning export PATH=/usr/local/pspsk/bin:$$PATH)
$(warning Or)
$(warning export PSPSDK=$$(shell psp-config --pspsdk-path))
$(error Failed to find PSPSDK installation)
endif
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
#---------------------------------------------------------------------------------
# object generation
#---------------------------------------------------------------------------------
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o : third_party/bearssl/src/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Dependency tracking
$(DEPFILES):
include $(wildcard $(DEPFILES))

View File

@ -83,7 +83,7 @@ SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) \
$(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.gsh)))
export LD := $(CXX)
export LD := $(CC)
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

View File

@ -0,0 +1,83 @@
#ifndef _WIN64
#include <pshpack1.h>
#endif
#define COMMDLGAPI DECLSPEC_IMPORT
typedef UINT_PTR (CALLBACK *LPOFNHOOKPROC)(HWND, UINT, WPARAM, LPARAM);
#define OFN_READONLY 0x00000001
#define OFN_OVERWRITEPROMPT 0x00000002
#define OFN_HIDEREADONLY 0x00000004
#define OFN_NOCHANGEDIR 0x00000008
#define OFN_NOVALIDATE 0x00000100
#define OFN_ALLOWMULTISELECT 0x00000200
#define OFN_EXTENSIONDIFFERENT 0x00000400
#define OFN_PATHMUSTEXIST 0x00000800
#define OFN_FILEMUSTEXIST 0x00001000
#define OFN_CREATEPROMPT 0x00002000
#define OFN_SHAREAWARE 0x00004000
#define OFN_NOREADONLYRETURN 0x00008000
#define OFN_NOTESTFILECREATE 0x00010000
typedef struct _OPENFILENAMEA {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCSTR lpstrFilter;
LPSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPSTR lpstrFile;
DWORD nMaxFile;
LPSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCSTR lpstrInitialDir;
LPCSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCSTR lpstrDefExt;
LPARAM lCustData;
LPOFNHOOKPROC lpfnHook;
LPCSTR lpTemplateName;
} OPENFILENAMEA;
typedef struct _OPENFILENAMEW {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCWSTR lpstrFilter;
LPWSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPWSTR lpstrFile;
DWORD nMaxFile;
LPWSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCWSTR lpstrInitialDir;
LPCWSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCWSTR lpstrDefExt;
LPARAM lCustData;
LPOFNHOOKPROC lpfnHook;
LPCWSTR lpTemplateName;
} OPENFILENAMEW;
/* Version of OPENFILENAMEA/W defined above is older NT 4 version */
/* of the struct without the new fields introduced in 2000 and later */
#define OPENFILENAME_SIZE_VERSION_400 sizeof(OPENFILENAMEW)
COMMDLGAPI BOOL APIENTRY GetOpenFileNameA(OPENFILENAMEA* ofn);
COMMDLGAPI BOOL APIENTRY GetOpenFileNameW(OPENFILENAMEW* ofn);
COMMDLGAPI BOOL APIENTRY GetSaveFileNameA(OPENFILENAMEA* ofn);
COMMDLGAPI BOOL APIENTRY GetSaveFileNameW(OPENFILENAMEW* ofn);
COMMDLGAPI DWORD APIENTRY CommDlgExtendedError(VOID);
#ifndef _WIN64
#include <poppack.h>
#endif

View File

@ -0,0 +1,48 @@
#ifndef CC_IMAGEHLP_FUNC
#define CC_IMAGEHLP_FUNC
#endif
/*Not available on older SDKs */
typedef cc_uintptr _DWORD_PTR;
CC_IMAGEHLP_FUNC _DWORD_PTR (WINAPI *_SymGetModuleBase)(HANDLE process, _DWORD_PTR addr);
CC_IMAGEHLP_FUNC PVOID (WINAPI *_SymFunctionTableAccess)(HANDLE process, _DWORD_PTR addr);
CC_IMAGEHLP_FUNC BOOL (WINAPI *_SymInitialize)(HANDLE process, PCSTR userSearchPath, BOOL fInvadeProcess);
CC_IMAGEHLP_FUNC BOOL (WINAPI *_SymGetSymFromAddr)(HANDLE process, _DWORD_PTR addr, _DWORD_PTR* displacement, IMAGEHLP_SYMBOL* sym);
CC_IMAGEHLP_FUNC BOOL (WINAPI *_SymGetModuleInfo) (HANDLE process, _DWORD_PTR addr, IMAGEHLP_MODULE* module);
CC_IMAGEHLP_FUNC BOOL (WINAPI *_SymGetLineFromAddr)(HANDLE hProcess, _DWORD_PTR addr, DWORD* displacement, IMAGEHLP_LINE* line); /* displacement is intentionally DWORD */
CC_IMAGEHLP_FUNC BOOL (WINAPI *_EnumerateLoadedModules)(HANDLE process, PENUMLOADED_MODULES_CALLBACK callback, PVOID userContext);
CC_IMAGEHLP_FUNC BOOL (WINAPI *_StackWalk)(DWORD machineType, HANDLE process, HANDLE thread, STACKFRAME* stackFrame, PVOID contextRecord,
PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, PTRANSLATE_ADDRESS_ROUTINE TranslateAddress);
static void ImageHlp_LoadDynamicFuncs(void) {
static const struct DynamicLibSym funcs[] = {
#ifdef _IMAGEHLP64
{ "EnumerateLoadedModules64", (void**)&_EnumerateLoadedModules},
{ "SymFunctionTableAccess64", (void**)&_SymFunctionTableAccess},
{ "SymInitialize", (void**)&_SymInitialize },
{ "SymGetModuleBase64", (void**)&_SymGetModuleBase },
{ "SymGetModuleInfo64", (void**)&_SymGetModuleInfo },
{ "SymGetLineFromAddr64", (void**)&_SymGetLineFromAddr },
{ "SymGetSymFromAddr64", (void**)&_SymGetSymFromAddr },
{ "StackWalk64", (void**)&_StackWalk },
#else
{ "EnumerateLoadedModules", (void**)&_EnumerateLoadedModules },
{ "SymFunctionTableAccess", (void**)&_SymFunctionTableAccess },
{ "SymInitialize", (void**)&_SymInitialize },
{ "SymGetModuleBase", (void**)&_SymGetModuleBase },
{ "SymGetModuleInfo", (void**)&_SymGetModuleInfo },
{ "SymGetLineFromAddr", (void**)&_SymGetLineFromAddr },
{ "SymGetSymFromAddr", (void**)&_SymGetSymFromAddr },
{ "StackWalk", (void**)&_StackWalk },
#endif
};
static const cc_string imagehlp = String_FromConst("IMAGEHLP.DLL");
void* lib;
DynamicLib_LoadAll(&imagehlp, funcs, Array_Elems(funcs), &lib);
}

View File

@ -0,0 +1,31 @@
#ifndef CC_KERN32_FUNC
#define CC_KERN32_FUNC
#endif
CC_KERN32_FUNC void (WINAPI *_GetSystemTimeAsFileTime)(LPFILETIME sysTime);
/* Fallback support for NT 3.5 */
static void WINAPI Fallback_GetSystemTimeAsFileTime(LPFILETIME sysTime) {
SYSTEMTIME curTime;
GetSystemTime(&curTime);
SystemTimeToFileTime(&curTime, sysTime);
}
CC_KERN32_FUNC BOOL (WINAPI *_AttachConsole)(DWORD processId);
CC_KERN32_FUNC BOOL (WINAPI *_IsDebuggerPresent)(void);
CC_KERN32_FUNC void (NTAPI *_RtlCaptureContext)(CONTEXT* ContextRecord);
static void Kernel32_LoadDynamicFuncs(void) {
static const struct DynamicLibSym funcs[] = {
DynamicLib_Sym(AttachConsole),
DynamicLib_Sym(IsDebuggerPresent),
DynamicLib_Sym(GetSystemTimeAsFileTime),
DynamicLib_Sym(RtlCaptureContext)
};
static const cc_string kernel32 = String_FromConst("KERNEL32.DLL");
void* lib;
DynamicLib_LoadAll(&kernel32, funcs, Array_Elems(funcs), &lib);
/* Not present on Windows NT 3.5 */
if (!_GetSystemTimeAsFileTime) _GetSystemTimeAsFileTime = Fallback_GetSystemTimeAsFileTime;
}

View File

@ -0,0 +1,58 @@
typedef void* HCERTSTORE;
typedef struct _CERT_CONTEXT {
DWORD dwCertEncodingType;
BYTE* pbCertEncoded;
DWORD cbCertEncoded;
CERT_INFO* pCertInfo;
HCERTSTORE hCertStore;
} CERT_CONTEXT, *PCERT_CONTEXT;
#define UNISP_NAME_A "Microsoft Unified Security Protocol Provider"
#define UNISP_NAME_W L"Microsoft Unified Security Protocol Provider"
#define SCH_CRED_NO_SYSTEM_MAPPER 0x00000002
#define SCH_CRED_NO_SERVERNAME_CHECK 0x00000004
#define SCH_CRED_MANUAL_CRED_VALIDATION 0x00000008
#define SCH_CRED_NO_DEFAULT_CREDS 0x00000010
#define SCH_CRED_AUTO_CRED_VALIDATION 0x00000020
#define SCH_CRED_USE_DEFAULT_CREDS 0x00000040
#define SCH_CRED_DISABLE_RECONNECTS 0x00000080
#define SCH_CRED_REVOCATION_CHECK_END_CERT 0x00000100
#define SCH_CRED_REVOCATION_CHECK_CHAIN 0x00000200
#define SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00000400
#define SCH_CRED_IGNORE_NO_REVOCATION_CHECK 0x00000800
#define SCH_CRED_IGNORE_REVOCATION_OFFLINE 0x00001000
#define SCH_CRED_REVOCATION_CHECK_CACHE_ONLY 0x00004000
#define SP_PROT_SSL3_CLIENT 0x00000020
#define SP_PROT_TLS1_CLIENT 0x00000080
#define SP_PROT_TLS1_1_CLIENT 0x00000200
#define SP_PROT_TLS1_2_CLIENT 0x00000800
#define SCH_CRED_V1 0x00000001
#define SCH_CRED_V2 0x00000002
#define SCH_CRED_VERSION 0x00000002
#define SCH_CRED_V3 0x00000003
#define SCHANNEL_CRED_VERSION 0x00000004
struct _HMAPPER;
typedef struct _SCHANNEL_CRED {
DWORD dwVersion;
DWORD cCreds;
PCCERT_CONTEXT* paCred;
HCERTSTORE hRootStore;
DWORD cMappers;
struct _HMAPPER **aphMappers;
DWORD cSupportedAlgs;
ALG_ID* palgSupportedAlgs;
DWORD grbitEnabledProtocols;
DWORD dwMinimumCipherStrength;
DWORD dwMaximumCipherStrength;
DWORD dwSessionLifespan;
DWORD dwFlags;
DWORD dwCredFormat;
} SCHANNEL_CRED;

View File

@ -0,0 +1,4 @@
#define SHELLAPI DECLSPEC_IMPORT
SHELLAPI HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR parameters, LPCWSTR directory, INT showCmd);
SHELLAPI HINSTANCE WINAPI ShellExecuteA(HWND hwnd, LPCSTR operation, LPCSTR file, LPCSTR parameters, LPCSTR directory, INT showCmd);

View File

@ -0,0 +1,23 @@
#ifndef CC_CRYPT32_FUNC
#define CC_CRYPT32_FUNC
#endif
typedef struct _CRYPTOAPI_BLOB {
DWORD cbData;
BYTE* pbData;
} DATA_BLOB;
CC_CRYPT32_FUNC BOOL (WINAPI *_CryptProtectData )(DATA_BLOB* dataIn, PCWSTR dataDescr, PVOID entropy, PVOID reserved, PVOID promptStruct, DWORD flags, DATA_BLOB* dataOut);
CC_CRYPT32_FUNC BOOL (WINAPI *_CryptUnprotectData)(DATA_BLOB* dataIn, PWSTR* dataDescr, PVOID entropy, PVOID reserved, PVOID promptStruct, DWORD flags, DATA_BLOB* dataOut);
static void Crypt32_LoadDynamicFuncs(void) {
static const struct DynamicLibSym funcs[] = {
DynamicLib_Sym(CryptProtectData), DynamicLib_Sym(CryptUnprotectData)
};
static const cc_string crypt32 = String_FromConst("CRYPT32.DLL");
static void* crypt32_lib;
if (crypt32_lib) return;
DynamicLib_LoadAll(&crypt32, funcs, Array_Elems(funcs), &crypt32_lib);
}

46
misc/windows/min-winmm.h Normal file
View File

@ -0,0 +1,46 @@
/* Not available on older SDKs */
typedef cc_uintptr _DWORD_PTR;
/* === BEGIN mmsyscom.h === */
#define CALLBACK_NULL 0x00000000l
typedef UINT MMRESULT;
#define WINMMAPI DECLSPEC_IMPORT
#define MMSYSERR_BADDEVICEID 2
/* === BEGIN mmeapi.h === */
typedef struct WAVEHDR_ {
LPSTR lpData;
DWORD dwBufferLength;
DWORD dwBytesRecorded;
_DWORD_PTR dwUser;
DWORD dwFlags;
DWORD dwLoops;
struct WAVEHDR_* lpNext;
DWORD_PTR reserved;
} WAVEHDR;
typedef struct WAVEFORMATEX_ {
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
WORD wBitsPerSample;
WORD cbSize;
} WAVEFORMATEX;
typedef void* HWAVEOUT;
#define WAVE_MAPPER ((UINT)-1)
#define WAVE_FORMAT_PCM 1
#define WHDR_DONE 0x00000001
#define WHDR_PREPARED 0x00000002
WINMMAPI MMRESULT WINAPI waveOutOpen(HWAVEOUT* phwo, UINT deviceID, const WAVEFORMATEX* fmt, _DWORD_PTR callback, _DWORD_PTR instance, DWORD flags);
WINMMAPI MMRESULT WINAPI waveOutClose(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize);
WINMMAPI MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize);
WINMMAPI MMRESULT WINAPI waveOutWrite(HWAVEOUT hwo, WAVEHDR* hdr, UINT hdrSize);
WINMMAPI MMRESULT WINAPI waveOutReset(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutGetErrorTextA(MMRESULT err, LPSTR text, UINT textLen);
WINMMAPI UINT WINAPI waveOutGetNumDevs(void);
/* === END mmeapi.h === */

166
misc/windows/min-winsock2.h Normal file
View File

@ -0,0 +1,166 @@
#ifndef CC_WINSOCK_FUNC
#define CC_WINSOCK_FUNC
#endif
/* Not available on older SDKs */
typedef cc_uintptr _UINT_PTR;
/* IP addresses */
typedef struct sockaddr {
USHORT sa_family;
char sa_data[14];
} SOCKADDR;
typedef struct in_addr {
union in_data {
struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { USHORT s_w1,s_w2; } S_un_w;
ULONG S_addr;
} S_un;
} IN_ADDR;
typedef struct sockaddr_in {
SHORT sin_family;
USHORT sin_port;
struct in_addr sin_addr;
char sin_zero[8];
} SOCKADDR_IN;
typedef struct in6_addr {
union in6_data {
UCHAR Byte[16];
USHORT Word[8];
} u;
} IN6_ADDR;
typedef struct sockaddr_in6 {
USHORT sin6_family;
USHORT sin6_port;
ULONG sin6_flowinfo;
IN6_ADDR sin6_addr;
ULONG sin6_scope_id;
} SOCKADDR_IN6;
typedef struct sockaddr_storage {
short ss_family;
CHAR ss_pad[126];
} SOCKADDR_STORAGE;
/* Type declarations */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef _UINT_PTR SOCKET;
/* Constants */
#define AF_INET 2
#define AF_INET6 23
#define SOCK_STREAM 1
#define IPPROTO_TCP 6
#define SOL_SOCKET 0xffff
#define SO_ERROR 0x1007
#define SD_BOTH 0x02
#define IOC_IN 0x80000000
/* has input parameters | input size| func group | command */
#define FIONBIO (IOC_IN | (4 << 16) | ('f' << 8) | 126)
/* Struct declarations */
#define FD_SETSIZE 64
typedef struct fd_set {
u_int fd_count;
SOCKET fd_array[FD_SETSIZE];
} fd_set;
struct timeval {
long tv_sec;
long tv_usec;
};
struct hostent {
char* h_name;
char** h_aliases;
short h_addrtype;
short h_length;
char** h_addr_list;
};
typedef struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char * ai_canonname;
struct sockaddr * ai_addr;
struct addrinfo * ai_next;
} ADDRINFOA;
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
typedef struct WSAData {
WORD wVersion;
WORD wHighVersion;
#ifdef _WIN64
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char* lpVendorInfo;
char szDescription[WSADESCRIPTION_LEN + 1];
char szSystemStatus[WSASYS_STATUS_LEN + 1];
#else
char szDescription[WSADESCRIPTION_LEN + 1];
char szSystemStatus[WSASYS_STATUS_LEN + 1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char* lpVendorInfo;
#endif
} WSADATA;
/* Function declarations */
CC_WINSOCK_FUNC int (WINAPI *_WSAStartup)(WORD versionRequested, WSADATA* wsaData);
CC_WINSOCK_FUNC int (WINAPI *_WSACleanup)(void);
CC_WINSOCK_FUNC int (WINAPI *_WSAGetLastError)(void);
CC_WINSOCK_FUNC int (WINAPI *_WSAStringToAddressW)(LPWSTR addressString, INT addressFamily, LPVOID protocolInfo, LPVOID address, LPINT addressLength);
CC_WINSOCK_FUNC int (WINAPI *_socket)(int af, int type, int protocol);
CC_WINSOCK_FUNC int (WINAPI *_closesocket)(SOCKET s);
CC_WINSOCK_FUNC int (WINAPI *_connect)(SOCKET s, const struct sockaddr* name, int namelen);
CC_WINSOCK_FUNC int (WINAPI *_shutdown)(SOCKET s, int how);
CC_WINSOCK_FUNC int (WINAPI *_ioctlsocket)(SOCKET s, long cmd, u_long* argp);
CC_WINSOCK_FUNC int (WINAPI *_getsockopt)(SOCKET s, int level, int optname, char* optval, int* optlen);
CC_WINSOCK_FUNC int (WINAPI *_recv)(SOCKET s, char* buf, int len, int flags);
CC_WINSOCK_FUNC int (WINAPI *_send)(SOCKET s, const char FAR * buf, int len, int flags);
CC_WINSOCK_FUNC int (WINAPI *_select)(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timeval* timeout);
CC_WINSOCK_FUNC struct hostent* (WINAPI *_gethostbyname)(const char* name);
CC_WINSOCK_FUNC unsigned short (WINAPI *_htons)(u_short hostshort);
CC_WINSOCK_FUNC int (WINAPI *_getaddrinfo )(PCSTR nodeName, PCSTR serviceName, const ADDRINFOA* hints, ADDRINFOA** result);
CC_WINSOCK_FUNC void (WINAPI* _freeaddrinfo)(ADDRINFOA* addrInfo);
static void Winsock_LoadDynamicFuncs(void) {
static const struct DynamicLibSym funcs[] = {
DynamicLib_Sym(WSAStartup), DynamicLib_Sym(WSACleanup),
DynamicLib_Sym(WSAGetLastError), DynamicLib_Sym(WSAStringToAddressW),
DynamicLib_Sym(socket), DynamicLib_Sym(closesocket),
DynamicLib_Sym(connect), DynamicLib_Sym(shutdown),
DynamicLib_Sym(ioctlsocket), DynamicLib_Sym(getsockopt),
DynamicLib_Sym(gethostbyname), DynamicLib_Sym(htons),
DynamicLib_Sym(getaddrinfo), DynamicLib_Sym(freeaddrinfo),
DynamicLib_Sym(recv), DynamicLib_Sym(send), DynamicLib_Sym(select)
};
static const cc_string winsock1 = String_FromConst("wsock32.DLL");
static const cc_string winsock2 = String_FromConst("WS2_32.DLL");
void* lib;
DynamicLib_LoadAll(&winsock2, funcs, Array_Elems(funcs), &lib);
/* Windows 95 is missing WS2_32 dll */
if (!_WSAStartup) DynamicLib_LoadAll(&winsock1, funcs, Array_Elems(funcs), &lib);
}

View File

@ -0,0 +1,58 @@
#ifndef CC_USER32_FUNC
#define CC_USER32_FUNC
#endif
/* Not available on older SDKs */
typedef cc_uintptr _SIZE_T;
/* Only present if WIN32_WINNT >= 0x0500 */
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x020B
#define WM_XBUTTONUP 0x020C
#endif
/* Only present if WIN32_WINNT >= 0x0501 */
#ifndef WM_INPUT
#define WM_INPUT 0x00FF
#endif
/* Only present if WIN32_WINNT >= 0x0600 */
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
/* Only present if WIN32_WINNT >= 0x0500 */
#ifndef SM_CXVIRTUALSCREEN
#define SM_CXVIRTUALSCREEN 78
#define SM_CYVIRTUALSCREEN 79
#endif
/* Only present if WIN32_WINNT >= 0x0501 */
#ifndef MOUSE_MOVE_RELATIVE
#define MOUSE_MOVE_RELATIVE 0
#define MOUSE_MOVE_ABSOLUTE 1
#define MOUSE_VIRTUAL_DESKTOP 0x02
#endif
/* Only present if WIN32_WINNT >= 0x0501 */
#ifndef RIM_TYPEMOUSE
#define RIM_TYPEMOUSE 0
#define RIDEV_INPUTSINK 0x00000100
#endif
CC_USER32_FUNC BOOL (WINAPI *_RegisterRawInputDevices)(PCRAWINPUTDEVICE devices, UINT numDevices, UINT size);
CC_USER32_FUNC UINT (WINAPI *_GetRawInputData)(HRAWINPUT hRawInput, UINT cmd, void* data, UINT* size, UINT headerSize);
CC_USER32_FUNC BOOL (WINAPI *_SetProcessDPIAware)(void);
static void User32_LoadDynamicFuncs(void) {
static const struct DynamicLibSym funcs[] = {
DynamicLib_Sym(RegisterRawInputDevices),
DynamicLib_Sym(GetRawInputData),
DynamicLib_Sym(SetProcessDPIAware)
};
static const cc_string user32 = String_FromConst("USER32.DLL");
void* lib;
DynamicLib_LoadAll(&user32, funcs, Array_Elems(funcs), &lib);
}

View File

@ -1,4 +1,4 @@
/* Generated using misc/linux_icon_gen.cs */
/* Generated using misc/x11_icon_gen.cs */
static const unsigned long CCIcon_Data[] = {
64,64,

View File

@ -0,0 +1,78 @@
{
"id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "ClassiCubeLauncher",
"finish-args": [
"--socket=wayland",
"--socket=fallback-x11",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=pulseaudio"
],
"modules": [
{
"name": "SDL3",
"buildsystem": "cmake-ninja",
"builddir": true,
"sources": [
{
"type": "git",
"url": "https://github.com/libsdl-org/SDL.git",
"branch": "main"
}
],
"cleanup": [
"/bin/sdl3-config",
"/include",
"/lib/libSDL3.la",
"/lib/libSDL3main.a",
"/lib/libSDL3main.la",
"/lib/libSDL3_test.a",
"/lib/libSDL3_test.la",
"/lib/cmake",
"/share/aclocal",
"/lib/pkgconfig"
],
"modules": [
{
"name": "libdecor",
"buildsystem": "meson",
"config-opts": [
"-Ddemo=false"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.freedesktop.org/libdecor/libdecor.git"
}
],
"cleanup": [
"/include",
"/lib/pkgconfig"
]
}
]
},
{
"name": "ClassiCube",
"buildsystem": "simple",
"build-commands": [
"gcc -fno-math-errno src/*.c -o src/ClassiCube -rdynamic -lpthread -lGL -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3 -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -DCC_BUILD_FLATPAK -L /app/lib -lSDL3",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ClassiCube/ClassiCube.git"
}
]
}
]
}

View File

@ -0,0 +1,34 @@
{
"id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "ClassiCubeLauncher",
"finish-args": [
"--socket=x11",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=pulseaudio"
],
"modules": [
{
"name": "ClassiCube",
"buildsystem": "simple",
"build-commands": [
"gcc -fno-math-errno src/*.c -o src/ClassiCube -O1 -DCC_BUILD_FLATPAK -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -rdynamic -lm -lpthread -lX11 -lXi -lGL -ldl",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ClassiCube/ClassiCube.git"
}
]
}
]
}

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Name=ClassiCube
Exec=ClassiCubeLauncher
Comment=Sandbox building-block game
Type=Application
Icon=net.classicube.flatpak.client
Categories=Game;ActionGame;
Terminal=false
MimeType=x-scheme-handler/mc;
StartupWMClass=net.classicube.flatpak.client

View File

@ -0,0 +1,133 @@
<?xml version='1.0' encoding='utf-8'?>
<component type="desktop-application">
<id>net.classicube.flatpak.client</id>
<name>ClassiCube</name>
<summary>Sandbox building-block game</summary>
<developer id="net.classicube">
<name>The ClassiCube Project</name>
</developer>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-3-Clause</project_license>
<description>
<p>ClassiCube brings you back to the days of 2009 where one block game ruled them all, it includes such features as:</p>
<ul>
<li>Loads of blocks and items to choose from</li>
<li>Chatting with other players</li>
<li>An extremely simple network protocol to tinker with</li>
<li>Hundreds of creative and inventive worlds to explore online</li>
<li>A growing community</li>
<li>Hundreds of hours of entertainment</li>
</ul>
</description>
<screenshots>
<screenshot type="default">
<caption>Classic mode features faithful classic gameplay</caption>
<image type="source">https://github.com/ClassiCube/ClassiCube/assets/6509348/eedee53f-f53e-456f-b51c-92c62079eee0</image>
</screenshot>
<screenshot>
<caption>Enhanced mode allows hacks like flying and noclipping, it also allows servers to provide many custom features</caption>
<image type="source">https://github.com/ClassiCube/ClassiCube/assets/6509348/b2fe0e2b-5d76-41ab-909f-048d0ad15f37</image>
</screenshot>
</screenshots>
<releases>
<release version="1.3.6" date="2023-08-28" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.6</url>
</release>
<release version="1.3.5" date="2023-01-06" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.5</url>
</release>
<release version="1.3.4" date="2022-11-01" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.4</url>
</release>
<release version="1.3.3" date="2022-10-08" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.3</url>
</release>
<release version="1.3.2" date="2022-05-26" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.2</url>
</release>
<release version="1.3.1" date="2022-01-11" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.1</url>
</release>
<release version="1.3.0" date="2022-01-04" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.0</url>
</release>
<release version="1.2.9" date="2021-10-18" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.9</url>
</release>
<release version="1.2.8" date="2021-09-18" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.8</url>
</release>
<release version="1.2.7" date="2021-07-22" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.7</url>
</release>
<release version="1.2.6" date="2021-07-02" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.6</url>
</release>
<release version="1.2.5" date="2021-04-02" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.5</url>
</release>
<release version="1.2.4" date="2021-01-23" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.4</url>
</release>
<release version="1.2.3" date="2020-12-12" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.3</url>
</release>
<release version="1.2.2" date="2020-12-11" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.2</url>
</release>
<release version="1.2.1" date="2020-11-28" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.1</url>
</release>
<release version="1.2.0" date="2020-10-01" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.0</url>
</release>
<release version="1.1.9" date="2020-08-16" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.9</url>
</release>
<release version="1.1.8" date="2020-08-05" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.8</url>
</release>
<release version="1.1.7" date="2020-06-13" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.7</url>
</release>
<release version="1.1.6" date="2020-05-07" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.6</url>
</release>
<release version="1.1.5" date="2020-05-01" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.5</url>
</release>
<release version="1.1.4" date="2020-04-21" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.4</url>
</release>
<release version="1.1.3" date="2020-03-08" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.3</url>
</release>
<release version="1.1.2" date="2020-01-26" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.2</url>
</release>
<release version="1.1.1" date="2019-12-16" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.1</url>
</release>
</releases>
<url type="homepage">https://www.classicube.net/</url>
<url type="bugtracker">https://github.com/ClassiCube/ClassiCube/issues</url>
<url type="donation">https://www.patreon.com/ClassiCube</url>
<url type="vcs-browser">https://github.com/ClassiCube/ClassiCube</url>
<categories>
<category>Game</category>
<category>AdventureGame</category>
<category>ActionGame</category>
</categories>
<recommends>
<control>pointing</control>
<control>keyboard</control>
</recommends>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">moderate</content_attribute>
<content_attribute id="social-chat">intense</content_attribute>
</content_rating>
<launchable type="desktop-id">net.classicube.flatpak.client.desktop</launchable>
<provides>
<binary>ClassiCube</binary>
</provides>
</component>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="128"
height="127.99999"
viewBox="0 0 33.866667 33.866664"
version="1.1"
id="svg8"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="translate(5.8338447,-13.20144)">
<g
id="g4741"
transform="matrix(0.12177585,0,0,0.12056875,-1.6325083,12.971524)">
<path
id="path4737"
d="M -5.8338447,207.40561 V 78.28894 L 106.61407,13.20144 218.79741,78.28894 V 207.40561 L 106.61407,272.4931 Z"
style="fill:#f6f6f6;stroke:#000000;stroke-width:8.0626;stroke-dasharray:none;stroke-opacity:1" />
<path
id="path179"
d="m 104.07502,141.52929 110.68965,-60.9215 1.62598,125.47985 -109.78346,61.73499 z m 20.61272,94.64566 c 8.561,-1.36503 22.58979,-6.90566 34.77207,-13.73314 8.44846,-4.73489 17.45957,-10.82064 25.81752,-17.43613 8.72093,-6.90281 17.22731,-15.21726 18.55921,-18.14047 0.26981,-0.59217 0.24879,-0.77358 -0.13391,-1.15568 -0.36305,-0.36248 -0.91552,-0.44887 -2.7589,-0.43139 -3.71393,0.0352 -9.27509,1.35366 -16.28846,3.86168 -2.01562,0.7208 -3.69686,1.27297 -3.73608,1.22704 -0.16881,-0.19764 3.44601,-29.37179 6.84564,-55.24912 1.21398,-9.24057 2.15592,-16.89033 2.09321,-16.99948 -0.19747,-0.34365 -6.05941,-0.21541 -8.74964,0.19141 -11.67357,1.7653 -26.1385,9.31897 -38.83406,20.27938 -3.00232,2.59198 -8.66363,8.37481 -10.38554,10.60847 l -1.13332,1.47013 1.06078,5.78494 c 1.66864,9.09991 3.21014,18.62874 5.55847,34.35994 1.6265,10.89577 2.70193,17.7159 2.81167,17.83099 0.23021,0.24143 9.15704,-3.22834 13.96159,-5.42672 4.01374,-1.83655 7.38001,-3.77497 13.6069,-7.83534 5.39432,-3.51748 6.57616,-4.09382 7.18285,-3.50281 1.32604,1.29178 -3.92898,6.46583 -11.75312,11.57204 -5.59387,3.65069 -11.90727,6.67998 -18.54423,8.8979 -3.61228,1.20714 -3.99351,1.40207 -6.48521,3.316 -7.13359,5.47947 -15.77323,13.5129 -18.33378,17.04736 -1.39429,1.92461 -1.60126,3.07547 -0.62376,3.46838 0.81553,0.3278 3.41645,0.32525 5.4901,-0.005 z"
style="fill:#cbcbcb;fill-opacity:1;stroke-width:0.264583" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,34 @@
DESKTOP_FILE=ClassiCube.desktop
GAME_DIR=`pwd`
# remove existing ClassiCube desktop entry file
rm $DESKTOP_FILE
# download ClassiCube icon from github if necessary
if [ -f "CCicon.png" ]
then
echo "CCicon.png exists already. Skipping download."
else
echo "CCicon.png doesn't exist. Attempting to download it.."
wget "https://raw.githubusercontent.com/ClassiCube/classicube/master/misc/CCicon.png"
fi
# create ClassiCube desktop entry
echo 'Creating ClassiCube.desktop..'
cat >> $DESKTOP_FILE << EOF
[Desktop Entry]
Type=Application
Comment=Minecraft Classic inspired sandbox game
Name=ClassiCube
Exec=$GAME_DIR/ClassiCube
Icon=$GAME_DIR/CCicon.png
Path=$GAME_DIR
Terminal=false
Categories=Game
EOF
chmod +x $DESKTOP_FILE
echo 'Installing ClassiCube.desktop..'
# install ClassiCube desktop entry into the system
sudo desktop-file-install --dir=/usr/share/applications ClassiCube.desktop
sudo update-desktop-database /usr/share/applications

457
misc/x11/min-X.h Normal file
View File

@ -0,0 +1,457 @@
/* Definitions for the X window system likely to be used by applications */
#ifndef X_H
#define X_H
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#define X_PROTOCOL 11 /* current protocol version */
#define X_PROTOCOL_REVISION 0 /* current minor version */
/* Resources */
/*
* _XSERVER64 must ONLY be defined when compiling X server sources on
* systems where unsigned long is not 32 bits, must NOT be used in
* client or library code.
*/
#ifndef _XSERVER64
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
typedef unsigned long XID;
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
typedef unsigned long Mask;
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
typedef unsigned long Atom; /* Also in Xdefs.h */
# endif
typedef unsigned long VisualID;
typedef unsigned long Time;
#else
# include <X11/Xmd.h>
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
typedef CARD32 XID;
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
typedef CARD32 Mask;
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
typedef CARD32 Atom;
# endif
typedef CARD32 VisualID;
typedef CARD32 Time;
#endif
typedef XID Window;
typedef XID Drawable;
#ifndef _XTYPEDEF_FONT
# define _XTYPEDEF_FONT
typedef XID Font;
#endif
typedef XID Pixmap;
typedef XID Cursor;
typedef XID Colormap;
typedef XID GContext;
typedef XID KeySym;
typedef unsigned char KeyCode;
/*****************************************************************
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
*****************************************************************/
#ifndef None
#define None 0L /* universal null resource or null atom */
#endif
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
#define CopyFromParent 0L /* border pixmap in CreateWindow
and ChangeWindowAttributes
special VisualID and special window
class passed to CreateWindow */
#define PointerWindow 0L /* destination window in SendEvent */
#define InputFocus 1L /* destination window in SendEvent */
#define PointerRoot 1L /* focus window in SetInputFocus */
#define AnyPropertyType 0L /* special Atom, passed to GetProperty */
#define AnyKey 0L /* special Key Code, passed to GrabKey */
#define AnyButton 0L /* special Button Code, passed to GrabButton */
#define AllTemporary 0L /* special Resource ID passed to KillClient */
#define CurrentTime 0L /* special Time */
#define NoSymbol 0L /* special KeySym */
/*****************************************************************
* EVENT DEFINITIONS
*****************************************************************/
/* Input Event Masks. Used as event-mask window attribute and as arguments
to Grab requests. Not to be confused with event names. */
#define NoEventMask 0L
#define KeyPressMask (1L<<0)
#define KeyReleaseMask (1L<<1)
#define ButtonPressMask (1L<<2)
#define ButtonReleaseMask (1L<<3)
#define EnterWindowMask (1L<<4)
#define LeaveWindowMask (1L<<5)
#define PointerMotionMask (1L<<6)
#define PointerMotionHintMask (1L<<7)
#define Button1MotionMask (1L<<8)
#define Button2MotionMask (1L<<9)
#define Button3MotionMask (1L<<10)
#define Button4MotionMask (1L<<11)
#define Button5MotionMask (1L<<12)
#define ButtonMotionMask (1L<<13)
#define KeymapStateMask (1L<<14)
#define ExposureMask (1L<<15)
#define VisibilityChangeMask (1L<<16)
#define StructureNotifyMask (1L<<17)
#define ResizeRedirectMask (1L<<18)
#define SubstructureNotifyMask (1L<<19)
#define SubstructureRedirectMask (1L<<20)
#define FocusChangeMask (1L<<21)
#define PropertyChangeMask (1L<<22)
#define ColormapChangeMask (1L<<23)
#define OwnerGrabButtonMask (1L<<24)
/* Event names. Used in "type" field in XEvent structures. Not to be
confused with event masks above. They start from 2 because 0 and 1
are reserved in the protocol for errors and replies. */
#define KeyPress 2
#define KeyRelease 3
#define ButtonPress 4
#define ButtonRelease 5
#define MotionNotify 6
#define EnterNotify 7
#define LeaveNotify 8
#define FocusIn 9
#define FocusOut 10
#define KeymapNotify 11
#define Expose 12
#define GraphicsExpose 13
#define NoExpose 14
#define VisibilityNotify 15
#define CreateNotify 16
#define DestroyNotify 17
#define UnmapNotify 18
#define MapNotify 19
#define MapRequest 20
#define ReparentNotify 21
#define ConfigureNotify 22
#define ConfigureRequest 23
#define GravityNotify 24
#define ResizeRequest 25
#define CirculateNotify 26
#define CirculateRequest 27
#define PropertyNotify 28
#define SelectionClear 29
#define SelectionRequest 30
#define SelectionNotify 31
#define ColormapNotify 32
#define ClientMessage 33
#define MappingNotify 34
#define GenericEvent 35
#define LASTEvent 36 /* must be bigger than any event # */
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
state in various key-, mouse-, and button-related events. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
#define ControlMask (1<<2)
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
#define Mod4Mask (1<<6)
#define Mod5Mask (1<<7)
/* modifier names. Used to build a SetModifierMapping request or
to read a GetModifierMapping request. These correspond to the
masks defined above. */
#define ShiftMapIndex 0
#define LockMapIndex 1
#define ControlMapIndex 2
#define Mod1MapIndex 3
#define Mod2MapIndex 4
#define Mod3MapIndex 5
#define Mod4MapIndex 6
#define Mod5MapIndex 7
/* button masks. Used in same manner as Key masks above. Not to be confused
with button names below. */
#define Button1Mask (1<<8)
#define Button2Mask (1<<9)
#define Button3Mask (1<<10)
#define Button4Mask (1<<11)
#define Button5Mask (1<<12)
#define AnyModifier (1<<15) /* used in GrabButton, GrabKey */
/* button names. Used as arguments to GrabButton and as detail in ButtonPress
and ButtonRelease events. Not to be confused with button masks above.
Note that 0 is already defined above as "AnyButton". */
#define Button1 1
#define Button2 2
#define Button3 3
#define Button4 4
#define Button5 5
/* Notify modes */
#define NotifyNormal 0
#define NotifyGrab 1
#define NotifyUngrab 2
#define NotifyWhileGrabbed 3
#define NotifyHint 1 /* for MotionNotify events */
/* Notify detail */
#define NotifyAncestor 0
#define NotifyVirtual 1
#define NotifyInferior 2
#define NotifyNonlinear 3
#define NotifyNonlinearVirtual 4
#define NotifyPointer 5
#define NotifyPointerRoot 6
#define NotifyDetailNone 7
/* Visibility notify */
#define VisibilityUnobscured 0
#define VisibilityPartiallyObscured 1
#define VisibilityFullyObscured 2
/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
#define GrabModeSync 0
#define GrabModeAsync 1
/* GrabPointer, GrabKeyboard reply status */
#define GrabSuccess 0
#define AlreadyGrabbed 1
#define GrabInvalidTime 2
#define GrabNotViewable 3
#define GrabFrozen 4
/* AllowEvents modes */
#define AsyncPointer 0
#define SyncPointer 1
#define ReplayPointer 2
#define AsyncKeyboard 3
#define SyncKeyboard 4
#define ReplayKeyboard 5
#define AsyncBoth 6
#define SyncBoth 7
/* Used in SetInputFocus, GetInputFocus */
#define RevertToNone (int)None
#define RevertToPointerRoot (int)PointerRoot
#define RevertToParent 2
/*****************************************************************
* ERROR CODES
*****************************************************************/
#define Success 0 /* everything's okay */
#define BadRequest 1 /* bad request code */
#define BadValue 2 /* int parameter out of range */
#define BadWindow 3 /* parameter not a Window */
#define BadPixmap 4 /* parameter not a Pixmap */
#define BadAtom 5 /* parameter not an Atom */
#define BadCursor 6 /* parameter not a Cursor */
#define BadFont 7 /* parameter not a Font */
#define BadMatch 8 /* parameter mismatch */
#define BadDrawable 9 /* parameter not a Pixmap or Window */
#define BadAccess 10 /* depending on context:
- key/button already grabbed
- attempt to free an illegal
cmap entry
- attempt to store into a read-only
color map entry.
- attempt to modify the access control
list from other than the local host.
*/
#define BadAlloc 11 /* insufficient resources */
#define BadColor 12 /* no such colormap */
#define BadGC 13 /* parameter not a GC */
#define BadIDChoice 14 /* choice not in range or already used */
#define BadName 15 /* font or color name doesn't exist */
#define BadLength 16 /* Request length incorrect */
#define BadImplementation 17 /* server is defective */
#define FirstExtensionError 128
#define LastExtensionError 255
/*****************************************************************
* WINDOW DEFINITIONS
*****************************************************************/
/* Window classes used by CreateWindow */
/* Note that CopyFromParent is already defined as 0 above */
#define InputOutput 1
#define InputOnly 2
/* Window attributes for CreateWindow and ChangeWindowAttributes */
#define CWBackPixmap (1L<<0)
#define CWBackPixel (1L<<1)
#define CWBorderPixmap (1L<<2)
#define CWBorderPixel (1L<<3)
#define CWBitGravity (1L<<4)
#define CWWinGravity (1L<<5)
#define CWBackingStore (1L<<6)
#define CWBackingPlanes (1L<<7)
#define CWBackingPixel (1L<<8)
#define CWOverrideRedirect (1L<<9)
#define CWSaveUnder (1L<<10)
#define CWEventMask (1L<<11)
#define CWDontPropagate (1L<<12)
#define CWColormap (1L<<13)
#define CWCursor (1L<<14)
/* Property modes */
#define PropModeReplace 0
#define PropModePrepend 1
#define PropModeAppend 2
/*****************************************************************
* IMAGING
*****************************************************************/
/* ImageFormat -- PutImage, GetImage */
#define XYBitmap 0 /* depth 1, XYFormat */
#define XYPixmap 1 /* depth == drawable depth */
#define ZPixmap 2 /* depth == drawable depth */
/*****************************************************************
* COLOR MAP STUFF
*****************************************************************/
/* For CreateColormap */
#define AllocNone 0 /* create map with no entries */
#define AllocAll 1 /* allocate entire map writeable */
/* Flags used in StoreNamedColor, StoreColors */
#define DoRed (1<<0)
#define DoGreen (1<<1)
#define DoBlue (1<<2)
/*****************************************************************
* CURSOR STUFF
*****************************************************************/
/* QueryBestSize Class */
#define CursorShape 0 /* largest size that can be displayed */
#define TileShape 1 /* size tiled fastest */
#define StippleShape 2 /* size stippled fastest */
/*****************************************************************
* KEYBOARD/POINTER STUFF
*****************************************************************/
#define MappingSuccess 0
#define MappingBusy 1
#define MappingFailed 2
#define MappingModifier 0
#define MappingKeyboard 1
#define MappingPointer 2
/*****************************************************************
* HOSTS AND CONNECTIONS
*****************************************************************/
/* Display classes used in opening the connection
* Note that the statically allocated ones are even numbered and the
* dynamically changeable ones are odd numbered */
#define StaticGray 0
#define GrayScale 1
#define StaticColor 2
#define PseudoColor 3
#define TrueColor 4
#define DirectColor 5
/* Byte order used in imageByteOrder and bitmapBitOrder */
#define LSBFirst 0
#define MSBFirst 1
#endif /* X_H */

49
misc/x11/min-XF86keysym.h Normal file
View File

@ -0,0 +1,49 @@
/*
* XFree86 vendor specific keysyms.
*
* The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
*
* The XF86 set of keysyms is a catch-all set of defines for keysyms found
* on various multimedia keyboards. Originally specific to XFree86 they have
* been been adopted over time and are considered a "standard" part of X
* keysym definitions.
* XFree86 never properly commented these keysyms, so we have done our
* best to explain the semantic meaning of these keys.
*
* XFree86 has removed their mail archives of the period, that might have
* shed more light on some of these definitions. Until/unless we resurrect
* these archives, these are from memory and usage.
*/
/*
* Keys found on some "Internet" keyboards.
*/
#define XF86XK_Standby 0x1008FF10 /* System into standby mode */
#define XF86XK_AudioLowerVolume 0x1008FF11 /* Volume control down */
#define XF86XK_AudioMute 0x1008FF12 /* Mute sound from the system */
#define XF86XK_AudioRaiseVolume 0x1008FF13 /* Volume control up */
#define XF86XK_AudioPlay 0x1008FF14 /* Start playing of audio > */
#define XF86XK_AudioStop 0x1008FF15 /* Stop playing audio */
#define XF86XK_AudioPrev 0x1008FF16 /* Previous track */
#define XF86XK_AudioNext 0x1008FF17 /* Next track */
#define XF86XK_HomePage 0x1008FF18 /* Display user's home page */
#define XF86XK_Mail 0x1008FF19 /* Invoke user's mail program */
#define XF86XK_Start 0x1008FF1A /* Start application */
#define XF86XK_Search 0x1008FF1B /* Search */
/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */
#define XF86XK_Calculator 0x1008FF1D /* Invoke calculator program */
/* Some more "Internet" keyboard symbols */
#define XF86XK_Back 0x1008FF26 /* Like back on a browser */
#define XF86XK_Forward 0x1008FF27 /* Like forward on a browser */
#define XF86XK_Stop 0x1008FF28 /* Stop current operation */
#define XF86XK_Refresh 0x1008FF29 /* Refresh the page */
#define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */
#define XF86XK_WakeUp 0x1008FF2B /* Wake up system from sleep */
#define XF86XK_Sleep 0x1008FF2F /* Put system to sleep */
#define XF86XK_Favorites 0x1008FF30 /* Show favorite locations */
#define XF86XK_AudioPause 0x1008FF31 /* Pause audio playing */
#define XF86XK_AudioMedia 0x1008FF32 /* Launch media collection app */
#define XF86XK_MyComputer 0x1008FF33 /* Display "My Computer" window */

View File

@ -27,7 +27,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef _X11_XKBLIB_H_
#define _X11_XKBLIB_H_
#include <X11/Xlib.h>
#include "min-xlib.h"
extern Bool XkbSetDetectableAutoRepeat(
Display * /* dpy */,

1778
misc/x11/min-xlib.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ SOFTWARE.
#define _X11_XUTIL_H_
/* You must include <X11/Xlib.h> before including this file */
#include <X11/Xlib.h>
#include "min-xlib.h"
/* The Xlib structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
@ -100,53 +100,6 @@ typedef struct {
/* obsolete */
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
typedef struct {
long flags; /* marks which fields in this structure are defined */
Bool input; /* does this application rely on the window manager to
get keyboard input? */
int initial_state; /* see below */
Pixmap icon_pixmap; /* pixmap to be used as icon */
Window icon_window; /* window to be used as icon */
int icon_x, icon_y; /* initial position of icon */
Pixmap icon_mask; /* icon mask bitmap */
XID window_group; /* id of related window group */
/* this structure may be extended in the future */
} XWMHints;
/* definition for flags of XWMHints */
#define InputHint (1L << 0)
#define StateHint (1L << 1)
#define IconPixmapHint (1L << 2)
#define IconWindowHint (1L << 3)
#define IconPositionHint (1L << 4)
#define IconMaskHint (1L << 5)
#define WindowGroupHint (1L << 6)
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
IconPositionHint|IconMaskHint|WindowGroupHint)
#define XUrgencyHint (1L << 8)
/* definitions for initial window state */
#define WithdrawnState 0 /* for windows that are not mapped */
#define NormalState 1 /* most applications want to start this way */
#define IconicState 3 /* application wants to start as an icon */
/*
* Obsolete states no longer defined by ICCCM
*/
#define DontCareState 0 /* don't know or care */
#define ZoomState 2 /* application wants to start zoomed */
#define InactiveState 4 /* application believes it is seldom used; */
/* some wm's may put it on inactive menu */
typedef struct {
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
} XIconSize;
typedef struct {
char *res_name;
char *res_class;
@ -240,6 +193,15 @@ typedef struct {
#define VisualBitsPerRGBMask 0x100
#define VisualAllMask 0x1FF
/*
* Compose sequence status structure, used in calling XLookupString.
*/
typedef struct _XComposeStatus {
XPointer compose_ptr; /* state table pointer */
int chars_matched; /* match state */
} XComposeStatus;
_XFUNCPROTOBEGIN
/* The following declarations are alphabetized. */
@ -271,12 +233,6 @@ extern int XSetSizeHints(
Atom /* property */
);
extern int XSetWMHints(
Display* /* display */,
Window /* w */,
XWMHints* /* wm_hints */
);
extern void XSetWMNormalHints(
Display* /* display */,
Window /* w */,
@ -290,6 +246,14 @@ extern void XSetWMSizeHints(
Atom /* property */
);
extern int XLookupString(
XKeyEvent* /* event_struct */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
XComposeStatus* /* status_in_out */
);
#ifdef __clang__
#pragma clang diagnostic pop
#endif

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