Starting palette enhancements. Beginning of BeOS support.

This commit is contained in:
Scott Duensing 2022-10-24 15:49:18 -05:00
parent fe87646e62
commit db2b3ed749
3 changed files with 193 additions and 12 deletions

View file

@ -262,6 +262,8 @@ static void _jlAudioCallback(void *userdata, Uint8 *buffer, int bytes) {
void jlDisplayPresent(void) {
int i = 0;
int j = 0;
int x;
int y;
int pitch = 0;
void *pixelData = NULL;
Uint32 *pixels = NULL;
@ -273,8 +275,8 @@ void jlDisplayPresent(void) {
// This extra step preserves palette effects.
SDL_LockTexture(_jlTexture, NULL, &pixelData, &pitch);
pixels = (Uint32 *)pixelData;
for (int y=0; y<200; y++) {
for (int x=0; x<160; x++) {
for (y=0; y<200; y++) {
for (x=0; x<160; x++) {
// We decode this R/L instead of L/R for some reason. NO idea why yet. Endians?
pixels[i++] = SDL_MapRGBA(_jlPixelFormat,
_jlBackingStore->palette[_jlBackingStore->pixels[j].r].r * 16,

View file

@ -451,9 +451,20 @@ void jlModPlay(jlModT *mod);
void jlModStop(void);
void jlModVolume(jbyte volume);
void jlPaletteDefault(void); //***TODO*** Treat palettes like we do "surfaces" - allow changing STAs or display
void jlPaletteSet(jbyte index, jbyte r, jbyte g, jbyte b); //***TODO*** Really need a matching "get"
void jlPaletteDefault(void); // ***TODO*** Treat palettes like we do "surfaces" - allow changing STAs or display
void jlPaletteSet(jbyte index, jbyte r, jbyte g, jbyte b); // ***TODO*** Really need a matching "get"
void jlPaletteSetFromImg(jlImgT *img);
/*
void jlPaletteAssign(jbyte rowStart, jbyte rowEnd, jbyte palette);
void jlPaletteCopy(jbyte paletteTarget, jbyte paletteSource);
void jlPaletteDefault(jbyte palette);
void jlPaletteGet(jbyte palette, jbyte index, jbyte *r, jbyte *g, jbyte *b);
void jlPaletteLoad(char *file, juint16 mask);
void jlPaletteSave(char *file, juint16 mask);
void jlPaletteSet(jbyte palette, jbyte index, jbyte r, jbyte g, jbyte b);
void jlPaletteSetFromImg(jbyte palette, jlImgT *img);
*/
void jlSoundFree(jlSoundT *sound);
jbool jlSoundIsPlaying(jlSoundT *sound);

View file

@ -48,6 +48,9 @@ OLD_PATH=${PATH}
#export CFLAGS=
#export LD_LIBRARY_PATH=
#export LDFLAGS=
#export WATCOM=
#export EDPATH=
#export INCLUDE=
export GOLDEN_GATE=${IIGS}/ORCA
@ -68,7 +71,48 @@ function addBuildUser() {
}
function buildIIgsSDK() {
function buildBeOSToolchain() {
[[ ! -d cross-compiler ]] && git clone --depth 1 https://github.com/jessicah/cross-compiler.git
# Build BeOS and Haiku cross-compilers.
pushd cross-compiler
./build-rootfs.sh x86_gcc2h --rootfsdir ${EHOME}/cross/beos
./build-rootfs.sh x86_gcc2h --rootfsdir ${EHOME}/cross/haiku32
./build-rootfs.sh x86_64 --rootfsdir ${EHOME}/cross/haiku64
popd
# ***TODO*** Need to download beos.tgz
# Add BeOS headers and libraries to BeOS toolchain folders.
pushd ${EHOME}/cross/beos
pushd generated/cross-tools-x86_gcc2/i586-pc-haiku
tar xzf ${EHOME}/beos.tgz
mv beos/headers/* include/.
mv beos/lib/x86/* lib/.
rm -rf beos
popd
rm -rf boot
rm -f fetch_packages.sh
rm -f package_extract.sh
popd
# Add Haiku 32 bit headers and libraries to Haiku toolchain folders.
pushd ${EHOME}/cross/haiku32
pushd generated/cross-tools-x86_gcc2/i586-pc-haiku
#mv ../../../boot/system/develop/headers/* include/.
#mv ../../../boot/system/develop/lib/x86/* lib/.
popd
rm -rf boot
rm -f fetch_packages.sh
rm -f package_extract.sh
popd
# ***TODO*** Haiku headers and libraries.
}
function buildIIgsToolchain() {
local GGATE=$1
local ORCA=$2
local PUBLIC=$3
@ -250,6 +294,21 @@ function buildJoeyLib() {
cp -f "${IIGS}/Tool222#ba0000" .
;;
SDL12)
export CFLAGS="${CFLAGS} -I${SRC} -I${INSTALLED}/include -c"
if [[ "${PASS}" == "debug" ]]; then
export CFLAGS="-DJOEY_DEBUG ${CFLAGS}"
fi
${CC} ${CFLAGS} -o jPixBuf.o ${SRC}/jPixBuf.c
${CC} ${CFLAGS} -o jSDL12.o ${SRC}/jSDL12.c
${CC} ${CFLAGS} -o joey.o ${SRC}/joey.c
${AR} x ${INSTALLED}/lib/libSDL.a
${AR} x ${INSTALLED}/lib/libSDLmain.a
${AR} rcs libjoeylib.a *.o
rm *.o
rm __.SYMDEF* || true
;;
SDL2)
export CFLAGS="${CFLAGS} -I${SRC} -I${INSTALLED}/include -c"
if [[ "${PASS}" == "debug" ]]; then
@ -278,7 +337,7 @@ function buildJoeyLib() {
}
function buildMacOSSDK() {
function buildMacOSXToolchain() {
local SDK=$1
local XCODE=$2
local PLATFORM=$3
@ -305,6 +364,43 @@ function buildMacOSSDK() {
}
function buildSDL12() {
if [[ ! -d SDL-1.2 ]]; then
git clone https://skunkworks.kangaroopunch.com/mirrors/SDL-1.2.git
pushd SDL-1.2/include
cp SDL_config.h.default SDL_config.h
popd
fi
if [[ "watcom" == *"${NAME}"* ]]; then
# ***TODO*** This does not work.
pushd SDL-1.2/watcom
wmake sdl tgt=static
mkdir -p ${INSTALLED}/lib
mkdir -p ${INSTALLED}/include
cp -f Release/SDL.lib ${INSTALLED}/lib/.
cp -f Release/SDLmain.lib ${INSTALLED}/lib/.
cp -f ../include/* ${INSTALLED}/include/.
popd
else
rm -rf build || true
mkdir -p build
pushd build
../SDL-1.2/configure \
--target=${TRIPLE} \
--host=${TRIPLE} \
--build=x86_64-linux \
--enable-static \
--disable-shared \
--disable-loadso \
--prefix=${INSTALLED}
make
make install
popd
fi
}
function buildSDL2() {
local TAG=$1
@ -336,6 +432,18 @@ function buildSDL2() {
}
function buildWatcomToolchain() {
local RESULT=
fetchGitHubRelease RESULT open-watcom open-watcom-v2 tar.xz
mkdir -p cross/watcom
pushd cross/watcom
tar xf ../../${RESULT}
unzip Watcom-Win32.zip
popd
}
function configureSFTP() {
if [[ ! -f /etc/ssh/sftponly_ready ]]; then
sudo addgroup sftponly || true
@ -410,6 +518,14 @@ function doBuild() {
CFILES=($(ls -1 *.c))
else
case ${LINE,,} in
beos)
setCompiler beos i386
TARGET="${SOURCE}/temp"
EXT=
export CFLAGS="${CFLAGS} -Wall"
export LDFLAGS="-lGL -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
;;
iigs)
setCompiler gsos 816
TARGET="${GOLDEN_GATE}/out/build"
@ -546,7 +662,7 @@ function doBuild() {
done
;;
SDL2)
SDL12 | SDL2)
export CFLAGS="${CFLAGS} -I${DIST}"
# Compile C files and generate object list.
OFILES=""
@ -587,9 +703,11 @@ function doInstall() {
updateSystem
configureSFTP
buildIIgsSDK "Golden Gate.msi" "Opus ][ The Software.iso" id_rsa id_rsa.pub "${GGUSER}" "${GGPASS}"
buildMacOSSDK MacOSX10.13.sdk.tar.xz Xcode_9.4.1.xip macos-intel
buildMacOSSDK MacOSX11.3.sdk.tar.xz Xcode_12.5.1.xip macos-apple
buildIIgsToolchain "Golden Gate.msi" "Opus ][ The Software.iso" id_rsa id_rsa.pub "${GGUSER}" "${GGPASS}"
buildMacOSXToolchain MacOSX10.13.sdk.tar.xz Xcode_9.4.1.xip macos-intel
buildMacOSXToolchain MacOSX11.3.sdk.tar.xz Xcode_12.5.1.xip macos-apple
buildWatcomToolchain
buildBeOSToolchain
setCompiler linux i386
buildSDL2 ${SDL2_NEW}
@ -612,6 +730,9 @@ function doInstall() {
setCompiler windows x86_64
buildSDL2 ${SDL2_NEW}
setCompiler beos i386
buildSDL12
rebuildJoeyLib
if [[ ! -f /etc/rc.local ]]; then
@ -681,6 +802,9 @@ function rebuildJoeyLib() {
setCompiler windows x86_64
buildJoeyLib
setCompiler beos i386
buildJoeyLib
rm -f dist.tar.bz2 || true
tar cJf dist.tar.bz2 dist
}
@ -689,8 +813,28 @@ function rebuildJoeyLib() {
function setCompiler() {
local OS=$1
local CPU=$2
local DIR=
local HEADERS=
case ${OS} in
beos)
case ${CPU} in
i386)
NAME="beos-intel"
ARCH=i386
TRIPLE="i586-pc-haiku"
DIR=${EHOME}/cross/beos/generated/cross-tools-x86_gcc2/bin
HEADERS=${EHOME}/cross/beos/generated/cross-tools-x86_gcc2/i586-pc-haiku/include
esac
BACKEND=SDL12
export CFLAGS="-I${HEADERS} -I${HEADERS}/be -I${HEADERS}/be/app -I${HEADERS}/be/kernel -I${HEADERS}/be/interface -I${HEADERS}/be/support -I${HEADERS}/be/storage -I${HEADERS}/be/game -I${HEADERS}/be/media -I${HEADERS}/be/device -I${HEADERS}/be/drivers -I${HEADERS}/be/opengl -I${HEADERS}/be/add-ons/graphics -I${HEADERS}/posix" \
export LDFLAGS=
export PATH=${DIR}:${OLD_PATH}
export LD_LIBRARY_PATH=
export CC=${TRIPLE}-gcc
export AR=${TRIPLE}-ar
;;
gsos)
case ${CPU} in
816)
@ -762,7 +906,22 @@ function setCompiler() {
sudo rm -f /usr/lib/llvm-10/lib/clang/10.0.0/lib/darwin || true
sudo ln -s ${EHOME}/cross/${NAME}/darwin /usr/lib/llvm-10/lib/clang/10.0.0/lib/.
;;
win32)
case ${CPU} in
i386)
NAME="win32-watcom"
ARCH="i386"
TRIPLE="win32-watcom-i386"
BACKEND=SDL12
export WATCOM=${EHOME}/cross/watcom
export PATH=${WATCOM}/binl64:${WATCOM}/binl:${OLD_PATH}
export EDPATH=${WATCOM}/eddat
export INCLUDE=${WATCOM}/lh
;;
esac
;;
windows)
case ${CPU} in
i386)
@ -923,12 +1082,16 @@ function updateSystem() {
sudo apt -y dist-upgrade
sudo dpkg --add-architecture i386
sudo apt -y install \
attr \
autoconf \
bison \
build-essential \
bzip2 \
clang \
cmake \
cpio \
flex \
gawk \
gcc-multilib \
gzip \
libbz2-dev \
@ -937,6 +1100,8 @@ function updateSystem() {
libxml2-dev \
llvm \
mingw-w64 \
mtools \
nasm \
patch \
php-cli \
sed \
@ -953,4 +1118,7 @@ function updateSystem() {
}
scriptIsDownloaded "$1" "$2" "$3"
#scriptIsDownloaded "$1" "$2" "$3"
setCompiler beos i386
buildJoeyLib