From 8cb979877f1340dca0c4ee69e7be6170486e517c Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Tue, 19 Mar 2019 17:16:38 -0500 Subject: [PATCH] Just updating the repo. --- README.md | 2 +- joeylib/build-IIgs.helper.sh | 69 ++++++++++++++++++++++++++++++++++++ joeylib/build-IIgs.sh | 1 + joeylib/build-PC.sh | 42 +++++++++++++--------- joeylib/joeylib.pro | 16 ++++----- joeylib/src/jIIgs.c | 3 +- joeylib/src/jPC.c | 11 ++++-- joeylib/src/joey.c | 30 +++++++++++++++- joeylib/src/joey.h | 7 ++-- joeylib/src/test.c | 13 ++++--- 10 files changed, 156 insertions(+), 38 deletions(-) create mode 100755 joeylib/build-IIgs.helper.sh diff --git a/README.md b/README.md index d6e9747..0612267 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ Cross-Platform Game Development Library Targets 16 bit systems like the Apple IIgs, Commodore Amiga, and Atari ST along with modern PCs running Windows, macOS, and Linux. -https://https://skunkworks.kangaroopunch.com/skunkworks/joeylib +https://skunkworks.kangaroopunch.com/skunkworks/joeylib diff --git a/joeylib/build-IIgs.helper.sh b/joeylib/build-IIgs.helper.sh new file mode 100755 index 0000000..a099682 --- /dev/null +++ b/joeylib/build-IIgs.helper.sh @@ -0,0 +1,69 @@ +# --- HERE BE DRAGONS --- + +TARGET=${JOEY}/sdks/iix/IIgs/out/${PROJECT} +GSTARGET=31:/out/${PROJECT} +CADIUS=${JOEY}/sdks/iix/cadius-git/bin/release/cadius +VOL=Import +IMPORT=/tmp/IIgs/import.po + +if [ -d ${TARGET} ]; then + rm -rf ${TARGET} +fi +mkdir -p ${TARGET} + +rm /tmp/IIgs/_FileInformation.txt || true 2> /dev/null +rm /tmp/IIgs/JLSTATS#040000 || true 2> /dev/null +rm ${IMPORT} || true 2> /dev/null + +cp -f ${JOEY}/dist/joey.h . +CFILES=($(ls -1 *.c)) +OFILES="" +for F in "${CFILES[@]}"; do + O=${F%.*} + if [ "${O}" != "main" ]; then + OFILES="${OFILES} ${GSTARGET}/${O}" + fi + echo "Compiling ${F}..." + iix compile ${F} keep=${GSTARGET}/${O} +done +rm joey.h +OFILES="${GSTARGET}/main ${OFILES} 13:joeylib" + +cp -f ${JOEY}/dist/IIgs/joeylib#b20000 ${JOEY}/sdks/iix/IIgs/Libraries/joeylib +iix chtyp -t lib ${JOEY}/sdks/iix/IIgs/Libraries/joeylib +iix -DKeepType=S16 link +L ${OFILES} keep=${GSTARGET}/${PROJECT}#b30000 > ${PROJECT}.map +iix dumpobj +D ${GSTARGET}/${PROJECT}#b30000 &> ${PROJECT}.dis || true +echo ${OFILES} > ${PROJECT}.lnk + +if [ ! -z $1 ]; then + mkdir -p /tmp/IIgs + ${CADIUS} createvolume ${IMPORT} ${VOL} 32MB > /dev/null + ${CADIUS} createfolder ${IMPORT} ${VOL}/data > /dev/null + ${CADIUS} addfile ${IMPORT} ${VOL} ${TARGET}/${PROJECT}#b30000 > /dev/null + mkdir -p /tmp/IIgs/data + for F in "${DATA[@]}"; do + N=/tmp/IIgs/data/`basename ${F}`#060000 + cp -f ${F} ${N} + ${CADIUS} addfile ${IMPORT} ${VOL}/data ${N} > /dev/null + rm ${N} + done + + mkdir -p /tmp/IIgs/source + for S in "${SOURCE[@]}"; do + for F in `ls -1 ${S}`; do + tr "\n" "\r" < ${F} > /tmp/IIgs/source/${F}#040000 + ${CADIUS} addfile ${IMPORT} ${VOL} ${F}#040000 > /dev/null + rm /tmp/IIgs/source/${F}#040000 + done + done + + pushd ${JOEY}/sdks/iix/gsplus + ./gsplus -config IIgsTest.cfg || true + popd + ${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS /tmp/IIgs/. > /dev/null + if [ -e /tmp/IIgs/JLSTATS#040000 ]; then + echo "" + cat /tmp/IIgs/JLSTATS#040000 | tr "\r" "\n" 2> /dev/null + echo "" + fi +fi diff --git a/joeylib/build-IIgs.sh b/joeylib/build-IIgs.sh index 339e532..2a96df9 100755 --- a/joeylib/build-IIgs.sh +++ b/joeylib/build-IIgs.sh @@ -25,6 +25,7 @@ iix dumpobj +D 31:/out/joey/test &> test.dis || true php ${JOEY}/sdks/iix/ntconverter.php *.mod popd +mkdir -p ${JOEY}/dist/IIgs cp -f ${JOEY}/joeylib/joeylib/lib/IIgs/Tool221#ba0000 ${JOEY}/dist/IIgs/. cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/. cp -f ${OUT}/joeylib ${JOEY}/dist/IIgs/joeylib#b20000 diff --git a/joeylib/build-PC.sh b/joeylib/build-PC.sh index 6f77a81..7263f35 100755 --- a/joeylib/build-PC.sh +++ b/joeylib/build-PC.sh @@ -6,6 +6,9 @@ SRC="${JOEY}/joeylib/joeylib/src" function doBuild() { + + G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -c" + echo "*** Starting ${DIST}" if [ -d "${BUILD}" ]; then rm -rf "${BUILD}" @@ -17,17 +20,14 @@ function doBuild() { mkdir -p "${DIST}" pushd "${BUILD}" - ${CC} ${CFLAGS} -c -o jPC.o ${SRC}/jPC.c - ${CC} ${CFLAGS} -c -o joey.o ${SRC}/joey.c - cp -f *.o "${DIST}"/. - popd + ${CC} ${CFLAGS} ${G_CFLAGS} -o jPC.o ${SRC}/jPC.c + ${CC} ${CFLAGS} ${G_CFLAGS} -o joey.o ${SRC}/joey.c - pushd ${DIST} - ar -x ${INSTALLED}/libSDL2.a - ar -x ${INSTALLED}/libSDL2_mixer.a - ar -x ${INSTALLED}/libmikmod.a - ar rcs joeylib.a *.o - rm *.o + ar x ${INSTALLED}/libSDL2.a + ar x ${INSTALLED}/libSDL2_mixer.a + ar x ${INSTALLED}/libmodplug.a + + ar rcs ${DIST}/libjoeylib.a *.o popd if [ -d "${BUILD}" ]; then @@ -36,37 +36,47 @@ function doBuild() { } CC="gcc" -CFLAGS="-Wall -D_REENTRANT -I${SRC}" +CFLAGS="" +LDFLAGS="" DIST="${JOEY}/dist/linux/x64" INSTALLED="${JOEY}/SDL2/installed/linux/x64/lib" doBuild +:< 0) { - _jlNumKeysDown++; + //***FIX*** + //_jlNumKeysDown++; + _jlNumKeysDown = 1; } } break; case SDL_KEYUP: if (_jlUtilIdleCheckKey(event.key.keysym.sym) > 0) { - _jlNumKeysDown--; + //***FIX*** + //_jlNumKeysDown--; + _jlNumKeysDown = 0; } break; @@ -451,6 +454,8 @@ void jlUtilIdle(void) { } } + //printf("Keys down: %d\n", _jlNumKeysDown); + SDL_Delay(1); } diff --git a/joeylib/src/joey.c b/joeylib/src/joey.c index 3b329e6..a53a4a8 100644 --- a/joeylib/src/joey.c +++ b/joeylib/src/joey.c @@ -26,13 +26,17 @@ #include -#define JOEY_LIBRARY #include "joey.h" #include "stddclmr.h" +#ifdef JOEY_IIGS +segment "joeylib"; +#endif + + // Vector image file command bytes #define COMMAND_COLOR 1 // C #define COMMAND_CLEAR 2 // E @@ -167,6 +171,30 @@ void jlDisplayBorder(jlBorderColorsE color) { } +void jlDrawBlitMap(byte startX, byte startY, byte width, byte height, byte *mapData, juint16 stride, jlStaT *tiles) { + // startX = start tile for drawing + // startY = start tile for drawing + // width = tiles to draw horizontally + // height = tiles to draw vertically + // mapData = pointer to tile x/y pairs to draw + // stride = number of tiles to skip in the mapData for every horizontal line + // tiles = sta to fetch tile data from + byte x; + byte y; + byte tileX; + byte tileY; + juint16 offset = 0; + + for (y=startY; y +#include // Determine platform and settings #ifdef __linux__ +#include + #define JOEY_LINUX #define JOEY_PC #define JOEY_LITLE_ENDIAN @@ -67,9 +70,8 @@ typedef unsigned short juint16; #define __attribute__(x) typedef int jint16; typedef unsigned int juint16; -#ifdef JOEY_LIBRARY +#ifndef JOEY_MAIN #pragma noroot -segment "joeylib"; #endif #pragma memorymodel 1 #pragma optimize -1 @@ -205,6 +207,7 @@ void jlDisplayBorder(jlBorderColorsE color); void jlDisplayPresent(void); void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2); +void jlDrawBlitMap(byte startX, byte startY, byte width, byte height, byte *mapData, juint16 stride, jlStaT *tiles); void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2); void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2); void jlDrawCircle(jint16 x, jint16 y, jint16 radius); diff --git a/joeylib/src/test.c b/joeylib/src/test.c index 4934fe9..61fb538 100644 --- a/joeylib/src/test.c +++ b/joeylib/src/test.c @@ -32,7 +32,7 @@ segment "testapp"; #endif - +/* // Font hacking! __attribute__((__format__ (__printf__, 4, 0))) void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) { @@ -52,18 +52,21 @@ void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) { jlDrawBlit8x8(font, x, y, counter + cx, cy); } } - +*/ int main(void) { + /* jlStaT *kanga = NULL; jlStaT *font = NULL; jint16 y; jint16 color = 15; jint16 nextColor = 1; + */ jlUtilStartup("JoeyLib Test"); + /* if (!jlStaLoad(kanga, "kanga")) jlUtilDie("Unable to load kanga.sta!"); if (!jlStaLoad(font, "font")) jlUtilDie("Unable to load font.sta!"); @@ -71,7 +74,7 @@ int main(void) { jlDrawColor(1); jlDrawBox(0, 0, 319, 199); - //jlSoundMusicPlay("music"); + jlSoundMusicPlay("music"); jlPaletteSet(15, 15, 15, 15); printAt(font, 1, 16, "X"); @@ -88,11 +91,11 @@ int main(void) { } jlKeyRead(); - //jlSoundMusicStop(); + jlSoundMusicStop(); jlStaFree(font); jlStaFree(kanga); + */ jlUtilShutdown(); - }