Still working on BeOS/Haiku support.

This commit is contained in:
Scott Duensing 2022-11-01 18:06:51 -05:00
parent 111b527f40
commit 35f437189e
4 changed files with 23 additions and 20 deletions

View file

@ -145,7 +145,7 @@ static int _pocketmod_clamp_volume(int x)
/* Zero out a block of memory */ /* Zero out a block of memory */
static void _pocketmod_zero(void *data, int size) static void _pocketmod_zero(void *data, int size)
{ {
char *byte = data, *end = byte + size; char *byte = (char *)data, *end = byte + size;
while (byte != end) { *byte++ = 0; } while (byte != end) { *byte++ = 0; }
} }
@ -584,12 +584,12 @@ static void _pocketmod_render_channel(pocketmod_context *c,
do { do {
/* Calculate how many samples we can write in one go */ /* Calculate how many samples we can write in one go */
num = (sample_end - chan->position) / chan->increment; num = (int)((sample_end - chan->position) / chan->increment);
num = _pocketmod_min(num, samples_to_write); num = _pocketmod_min(num, samples_to_write);
/* Resample and write 'num' samples */ /* Resample and write 'num' samples */
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
int x0 = chan->position; int x0 = (int)chan->position;
#ifdef POCKETMOD_NO_INTERPOLATION #ifdef POCKETMOD_NO_INTERPOLATION
float s = sample->data[x0]; float s = sample->data[x0];
#else #else

View file

@ -202,8 +202,8 @@ static void _jlAudioCallback(void *userdata, Uint8 *buffer, int bytes) {
out = (int16_t *)buffer; out = (int16_t *)buffer;
while (i < bytes) { while (i < bytes) {
i += pocketmod_render(&_jlModContext, mod, sizeof(float[2])); i += pocketmod_render(&_jlModContext, mod, sizeof(float[2]));
out[i] *= adjust; out[i] = (int16_t)((float)out[i] * adjust);
out[i + 1] *= adjust; out[i + 1] = (int16_t)((float)out[i + 1] * adjust);
} }
} }
@ -222,17 +222,17 @@ static void _jlAudioCallback(void *userdata, Uint8 *buffer, int bytes) {
out = (int16_t *)buffer; out = (int16_t *)buffer;
for (i=0; i<(int)(length / sizeof(int16_t)); i+=2) { for (i=0; i<(int)(length / sizeof(int16_t)); i+=2) {
// Combine channels into a mono sample. // Combine channels into a mono sample.
work = (data[i] + data[i + 1]) * 0.5; work = (int32_t)((data[i] + data[i + 1]) * 0.5);
// Determine channel. // Determine channel.
// ***TODO*** These should be channel bits that can be ORed together! // ***TODO*** These should be channel bits that can be ORed together!
isRight = (sound->channel & 0x01); isRight = (sound->channel & 0x01);
if (_jlSwapChannels) isRight = !isRight; if (_jlSwapChannels) isRight = !isRight;
if (isRight) { if (isRight) {
// Place sound in the right channel. // Place sound in the right channel.
out[i + 1] += (work * adjust); out[i + 1] += (int16_t)(work * adjust);
} else { } else {
// Place sound in left channel. // Place sound in left channel.
out[i] += (work * adjust); out[i] += (int16_t)(work * adjust);
} }
} }
sound->buffer += length; sound->buffer += length;
@ -597,7 +597,7 @@ void jlSoundPlay(jlSoundT *sound, jlSoundChannelE channel, jbyte volume) {
sp = (jlSoundPlayingT *)jlMalloc(sizeof(jlSoundPlayingT)); sp = (jlSoundPlayingT *)jlMalloc(sizeof(jlSoundPlayingT));
if (sp) { if (sp) {
SDL_LockAudio(); SDL_LockAudio();
sp->sound = sound; sp->sound = (jlPlatformSoundT *)sound;
sp->channel = channel; sp->channel = channel;
sp->volume = volume; sp->volume = volume;
sp->buffer = sp->sound->data; sp->buffer = sp->sound->data;
@ -638,8 +638,8 @@ void jlSoundStop(jlSoundT *sound) {
char _jlUtilIdleCheckKey(int sym) { char _jlUtilIdleCheckKey(int sym) {
char key = 0; char key;
SDLMod mod = 0; SDLMod mod;
// Do we even care about this key? // Do we even care about this key?
if ((sym < 8) || (sym > 127)) { if ((sym < 8) || (sym > 127)) {

View file

@ -471,11 +471,11 @@ void _jlDrawFillAddLine(jint16 startX, jint16 endX, jint16 y, jint16 ignoreStart
// Stole this from http://www.adammil.net/blog/v126_A_More_Efficient_Flood_Fill.html // Stole this from http://www.adammil.net/blog/v126_A_More_Efficient_Flood_Fill.html
void _jlDrawFill(jint16 x, jint16 y, jbool how) { void _jlDrawFill(jint16 x, jint16 y, jbool how) {
jint16 height = 200; jint16 height = 200;
jint16 width = 320; jint16 width = 320;
_jlScanDataT *r; _jlScanDataT *r;
jint16 startX; jint16 startX;
jint16 endX; jint16 endX;
// how == true; Fill on top of _jlDrawFillColor // how == true; Fill on top of _jlDrawFillColor
// how == false; Fill on top of any color until we encounter _jlDrawFillColor // how == false; Fill on top of any color until we encounter _jlDrawFillColor
@ -483,7 +483,7 @@ void _jlDrawFill(jint16 x, jint16 y, jbool how) {
jlDrawPixelSet(x, y); jlDrawPixelSet(x, y);
jlUtilStackPush(_jlFillStackTop, _jlDrawFillNewSegment(x, x+1, y, 0, jtrue, jtrue)); jlUtilStackPush(_jlFillStackTop, _jlDrawFillNewSegment(x, x+1, y, 0, jtrue, jtrue));
while ((r = jlUtilStackPop(_jlFillStackTop)) != NULL) { while ((r = (_jlScanDataT *)jlUtilStackPop(_jlFillStackTop)) != NULL) {
startX = r->StartX; startX = r->StartX;
endX = r->EndX; endX = r->EndX;
if (r->ScanLeft) { if (r->ScanLeft) {

View file

@ -444,7 +444,7 @@ function buildWatcomToolchain() {
mkdir -p cross/watcom mkdir -p cross/watcom
pushd cross/watcom pushd cross/watcom
tar xf ../../${RESULT} tar xf ../../${RESULT}
unzip Watcom-Win32.zip #unzip Watcom-Win32.zip
popd popd
} }
@ -725,6 +725,9 @@ function doInstall() {
updateSystem updateSystem
configureSFTP configureSFTP
git config --global user.email "no-reply@kangaroopunch.com"
git config --global user.name "JoeyBuild VM Installer"
buildIIgsToolchain "Golden Gate.msi" "Opus ][ The Software.iso" id_rsa id_rsa.pub "${GGUSER}" "${GGPASS}" 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 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 buildMacOSXToolchain MacOSX11.3.sdk.tar.xz Xcode_12.5.1.xip macos-apple
@ -901,11 +904,11 @@ function setCompiler() {
TRIPLE="x86_64-unknown-haiku" TRIPLE="x86_64-unknown-haiku"
DIR=${EHOME}/cross/haiku64/generated/cross-tools-x86_64/bin DIR=${EHOME}/cross/haiku64/generated/cross-tools-x86_64/bin
HEADERS=${EHOME}/cross/haiku64/generated/cross-tools-x86_64/x86_64-unknown-haiku/include HEADERS=${EHOME}/cross/haiku64/generated/cross-tools-x86_64/x86_64-unknown-haiku/include
export CFLAGS="-I${HEADERS}/c++/11.3.0" export CFLAGS="-I${HEADERS}/c++/11.3.0 -I${HEADERS}/c++"
BACKEND=SDL2 BACKEND=SDL2
;; ;;
esac esac
export CFLAGS="${CFLAGS} -I${HEADERS} -I${HEADERS}/glibc -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 CFLAGS="${CFLAGS} -I${HEADERS} -I${HEADERS}/glibc -I${HEADERS}/be -I${HEADERS}/be/app -I${HEADERS}/be/locale -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 LDFLAGS=
export PATH=${DIR}:${OLD_PATH} export PATH=${DIR}:${OLD_PATH}
export LD_LIBRARY_PATH= export LD_LIBRARY_PATH=
@ -1163,6 +1166,7 @@ function updateSystem() {
liblzma-dev \ liblzma-dev \
libssl-dev \ libssl-dev \
libxml2-dev \ libxml2-dev \
libzstd-dev \
llvm \ llvm \
mingw-w64 \ mingw-w64 \
mtools \ mtools \
@ -1184,4 +1188,3 @@ function updateSystem() {
scriptIsDownloaded "$1" "$2" "$3" scriptIsDownloaded "$1" "$2" "$3"