Skip to content

Commit

Permalink
Version 1.6.0 (Does it blend)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilu committed Aug 29, 2021
1 parent d487d44 commit d62070e
Show file tree
Hide file tree
Showing 119 changed files with 32,607 additions and 727 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ TMP1.ZIP
TMP2.TMP
TMP2.ZIP
openssl-1.1.1k/apps/progs.h
.picasa.ini
fddojs.zip
dosbox.conf
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"makefile.dojs": "makefile",
"Makefile.dojs": "makefile",
"makefile.dj": "makefile",
"common.dj": "makefile",
"dojs.h": "c",
"edit.h": "c",
"cstdlib": "c",
Expand All @@ -29,7 +30,14 @@
"base.h": "c",
"array": "c",
"utility": "c",
"sstream": "c"
"sstream": "c",
"string": "c",
"istream": "c",
"ostream": "c",
"tuple": "c",
"type_traits": "c",
"internals.h": "c",
"animatedgif.h": "c"
},
"editor.formatOnSave": true,
"editor.insertSpaces": false,
Expand Down
204 changes: 112 additions & 92 deletions 3dfx-glide.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ static void f_fxInit(js_State *J) {
fx_context = grSstWinOpen(0, GR_RESOLUTION_640x480, GR_REFRESH_60Hz, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
if (!fx_context) {
js_error(J, "Can't initialize GLIDE3.");
return;
}
DOjS.glide_enabled = true;
grErrorSetCallback(fx_error_callback);
Expand Down Expand Up @@ -820,6 +821,15 @@ static void f_fxLfbConstantAlpha(js_State *J) { grLfbConstantAlpha(js_toint32(J,
static void f_fxLfbConstantDepth(js_State *J) { grLfbConstantDepth(js_toint32(J, 1)); }
#endif

/**
* @brief initialize glide.
*
* @param J VM state.
*/
static void f_dummy_fxInit(js_State *J) {
js_error(J, "GLIDE3X.DXE missing, please run one of the V_x.BAT scripts to get the driver matching your hardware! All 3dfx functions are disabled!");
}

/***********************
** exported functions **
***********************/
Expand All @@ -831,103 +841,113 @@ static void f_fxLfbConstantDepth(js_State *J) { grLfbConstantDepth(js_toint32(J,
void init_3dfx(js_State *J) {
DEBUGF("%s\n", __PRETTY_FUNCTION__);

PROPDEF_N(J, WIDTH_3DFX, "FX_WIDTH");
PROPDEF_N(J, HEIGHT_3DFX, "FX_HEIGHT");

NFUNCDEF(J, fxInit, 0);
NFUNCDEF(J, fxShutdown, 0);
NFUNCDEF(J, fxSplash, 5);
NFUNCDEF(J, fxFlush, 0);
NFUNCDEF(J, fxResetVertexLayout, 0);
NFUNCDEF(J, fxVertexLayout, 1);
NFUNCDEF(J, fxGetVertexSize, 0);
NFUNCDEF(J, fxFinish, 0);
NFUNCDEF(J, fxBufferSwap, 1);
NFUNCDEF(J, fxBufferClear, 3);
NFUNCDEF(J, fxClipWindow, 4);
NFUNCDEF(J, fxDrawPoint, 1);
NFUNCDEF(J, fxDrawLine, 2);
NFUNCDEF(J, fxDrawTriangle, 3);
NFUNCDEF(J, fxConstantColorValue, 1);
NFUNCDEF(J, fxCullMode, 1);
NFUNCDEF(J, fxAlphaBlendFunction, 4);
NFUNCDEF(J, fxAlphaCombine, 5);
NFUNCDEF(J, fxColorCombine, 5);
NFUNCDEF(J, fxColorMask, 2);
NFUNCDEF(J, fxDepthMask, 1);
NFUNCDEF(J, fxDrawVertexArray, 2);
NFUNCDEF(J, fxEnable, 1);
NFUNCDEF(J, fxDisable, 1);
NFUNCDEF(J, fxDisableAllEffects, 0);
NFUNCDEF(J, fxAADrawTriangle, 6);
NFUNCDEF(J, fxDitherMode, 1);
NFUNCDEF(J, fxAlphaControlsITRGBLighting, 1);
NFUNCDEF(J, fxGammaCorrectionRGB, 3);
NFUNCDEF(J, fxOrigin, 1);
NFUNCDEF(J, fxRenderBuffer, 1);
NFUNCDEF(J, fxViewport, 4);

NFUNCDEF(J, fxDepthBufferMode, 1);
NFUNCDEF(J, fxDepthBufferFunction, 1);
NFUNCDEF(J, fxDepthBiasLevel, 1);
NFUNCDEF(J, fxDepthRange, 2);

NFUNCDEF(J, fxFogMode, 1);
NFUNCDEF(J, fxFogColorValue, 1);
NFUNCDEF(J, fxFogTableIndexToW, 0);
NFUNCDEF(J, fxFogTable, 1);
NFUNCDEF(J, fxFogGenerateExp, 1);
NFUNCDEF(J, fxFogGenerateExp2, 1);
NFUNCDEF(J, fxFogGenerateLinear, 2);

NFUNCDEF(J, fxChromakeyMode, 1);
NFUNCDEF(J, fxChromakeyValue, 1);

NFUNCDEF(J, fxAlphaTestFunction, 1);
NFUNCDEF(J, fxAlphaTestReferenceValue, 1);

NFUNCDEF(J, fxTexFilterMode, 3);
NFUNCDEF(J, fxTexClampMode, 3);
NFUNCDEF(J, fxTexMipMapMode, 3);
NFUNCDEF(J, fxTexLodBiasValue, 2);
NFUNCDEF(J, fxTexCombine, 7);
NFUNCDEF(J, fxTexDetailControl, 4);
NFUNCDEF(J, fxTexNCCTable, 1);

NFUNCDEF(J, fxTexCalcMemRequired, 4);
NFUNCDEF(J, fxTexMinAddress, 1);
NFUNCDEF(J, fxTexMaxAddress, 1);

// GrGet() values
NFUNCDEF(J, fxGetZDepthMinMax, 0);
NFUNCDEF(J, fxGetWDepthMinMax, 0);

NFUNCDEF(J, fxGetBitsDepth, 0);
NFUNCDEF(J, fxGetFogTableEntries, 0);
NFUNCDEF(J, fxGetGammaTableEntries, 0);
NFUNCDEF(J, fxIsBusy, 0);
NFUNCDEF(J, fxGetMemoryFb, 0);
NFUNCDEF(J, fxGetMemoryTmu, 0);
NFUNCDEF(J, fxGetMemoryUma, 0);
NFUNCDEF(J, fxGetMaxTextureSize, 0);
NFUNCDEF(J, fxGetMaxTextureAspectRatio, 0);
NFUNCDEF(J, fxGetNumBoards, 0);
NFUNCDEF(J, fxGetNumFb, 0);
NFUNCDEF(J, fxGetNumTmu, 0);
NFUNCDEF(J, fxGetNumPendingBufferSwaps, 0);
NFUNCDEF(J, fxGetRevisionFb, 0);
NFUNCDEF(J, fxGetRevisionTmu, 0);
FILE *f = fopen("GLIDE3X.DXE", "r");
if (!f) {
LOG("GLIDE3X.DXE missing, please run one of the V_x.BAT scripts to get the driver matching your hardware! All 3dfx functions are disabled!");

js_newcfunction(J, f_dummy_fxInit, "fxInit", 0);
js_setglobal(J, "fxInit");

} else {
fclose(f);

PROPDEF_N(J, WIDTH_3DFX, "FX_WIDTH");
PROPDEF_N(J, HEIGHT_3DFX, "FX_HEIGHT");

NFUNCDEF(J, fxInit, 0);
NFUNCDEF(J, fxShutdown, 0);
NFUNCDEF(J, fxSplash, 5);
NFUNCDEF(J, fxFlush, 0);
NFUNCDEF(J, fxResetVertexLayout, 0);
NFUNCDEF(J, fxVertexLayout, 1);
NFUNCDEF(J, fxGetVertexSize, 0);
NFUNCDEF(J, fxFinish, 0);
NFUNCDEF(J, fxBufferSwap, 1);
NFUNCDEF(J, fxBufferClear, 3);
NFUNCDEF(J, fxClipWindow, 4);
NFUNCDEF(J, fxDrawPoint, 1);
NFUNCDEF(J, fxDrawLine, 2);
NFUNCDEF(J, fxDrawTriangle, 3);
NFUNCDEF(J, fxConstantColorValue, 1);
NFUNCDEF(J, fxCullMode, 1);
NFUNCDEF(J, fxAlphaBlendFunction, 4);
NFUNCDEF(J, fxAlphaCombine, 5);
NFUNCDEF(J, fxColorCombine, 5);
NFUNCDEF(J, fxColorMask, 2);
NFUNCDEF(J, fxDepthMask, 1);
NFUNCDEF(J, fxDrawVertexArray, 2);
NFUNCDEF(J, fxEnable, 1);
NFUNCDEF(J, fxDisable, 1);
NFUNCDEF(J, fxDisableAllEffects, 0);
NFUNCDEF(J, fxAADrawTriangle, 6);
NFUNCDEF(J, fxDitherMode, 1);
NFUNCDEF(J, fxAlphaControlsITRGBLighting, 1);
NFUNCDEF(J, fxGammaCorrectionRGB, 3);
NFUNCDEF(J, fxOrigin, 1);
NFUNCDEF(J, fxRenderBuffer, 1);
NFUNCDEF(J, fxViewport, 4);

NFUNCDEF(J, fxDepthBufferMode, 1);
NFUNCDEF(J, fxDepthBufferFunction, 1);
NFUNCDEF(J, fxDepthBiasLevel, 1);
NFUNCDEF(J, fxDepthRange, 2);

NFUNCDEF(J, fxFogMode, 1);
NFUNCDEF(J, fxFogColorValue, 1);
NFUNCDEF(J, fxFogTableIndexToW, 0);
NFUNCDEF(J, fxFogTable, 1);
NFUNCDEF(J, fxFogGenerateExp, 1);
NFUNCDEF(J, fxFogGenerateExp2, 1);
NFUNCDEF(J, fxFogGenerateLinear, 2);

NFUNCDEF(J, fxChromakeyMode, 1);
NFUNCDEF(J, fxChromakeyValue, 1);

NFUNCDEF(J, fxAlphaTestFunction, 1);
NFUNCDEF(J, fxAlphaTestReferenceValue, 1);

NFUNCDEF(J, fxTexFilterMode, 3);
NFUNCDEF(J, fxTexClampMode, 3);
NFUNCDEF(J, fxTexMipMapMode, 3);
NFUNCDEF(J, fxTexLodBiasValue, 2);
NFUNCDEF(J, fxTexCombine, 7);
NFUNCDEF(J, fxTexDetailControl, 4);
NFUNCDEF(J, fxTexNCCTable, 1);

NFUNCDEF(J, fxTexCalcMemRequired, 4);
NFUNCDEF(J, fxTexMinAddress, 1);
NFUNCDEF(J, fxTexMaxAddress, 1);

// GrGet() values
NFUNCDEF(J, fxGetZDepthMinMax, 0);
NFUNCDEF(J, fxGetWDepthMinMax, 0);

NFUNCDEF(J, fxGetBitsDepth, 0);
NFUNCDEF(J, fxGetFogTableEntries, 0);
NFUNCDEF(J, fxGetGammaTableEntries, 0);
NFUNCDEF(J, fxIsBusy, 0);
NFUNCDEF(J, fxGetMemoryFb, 0);
NFUNCDEF(J, fxGetMemoryTmu, 0);
NFUNCDEF(J, fxGetMemoryUma, 0);
NFUNCDEF(J, fxGetMaxTextureSize, 0);
NFUNCDEF(J, fxGetMaxTextureAspectRatio, 0);
NFUNCDEF(J, fxGetNumBoards, 0);
NFUNCDEF(J, fxGetNumFb, 0);
NFUNCDEF(J, fxGetNumTmu, 0);
NFUNCDEF(J, fxGetNumPendingBufferSwaps, 0);
NFUNCDEF(J, fxGetRevisionFb, 0);
NFUNCDEF(J, fxGetRevisionTmu, 0);

#ifdef LFB_3DFX
NFUNCDEF(J, fxLfbConstantAlpha, 1);
NFUNCDEF(J, fxLfbConstantDepth, 1);
NFUNCDEF(J, fxLfbConstantAlpha, 1);
NFUNCDEF(J, fxLfbConstantDepth, 1);
#endif

FxI32 num;
if (grGet(GR_NUM_BOARDS, sizeof(num), &num)) {
LOGF("3dfx cards detected: %ld\n", num);
FxI32 num;
if (grGet(GR_NUM_BOARDS, sizeof(num), &num)) {
LOGF("3dfx cards detected: %ld\n", num);
}
}

DEBUGF("%s DONE\n", __PRETTY_FUNCTION__);
}

Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Version 1.6.0 (Does it blend) / August, 28th, 2021
* Added JPEG loading through `jpeg` module
* Made `JSLOG.txt` optional and the filename can be changed as well
* Updated libcpuid to v0.5.1
* Removed many compiler warnings and streamlined the make output during build
* Added basic GIF animations loading/rendering through `gifanim` module
* Added `ReadSoundInputInts()` which returns the sampled data as `IntArray` (`ReadSoundInput()` uses Javascript arrays which are slower)
* Improved CTRL-DEL, CTRL-BS handling with whitespaces
* Added error popup to editor for displaying script errors
* parallelized the build as far as possible
* added Makefile target to create a FreeDOS distribution ZIP
* Added different blend modes which are selected through `TransparencyEnabled()`
* Added p5js API mapping from `blendMode()` to `TransparencyEnabled()`
* Added QR-Code generator from https://github.com/kazuhikoarase/qrcode-generator, see examples/qrcode.js
* Fixed/added some examples
* Improved error handling for missing GLIDE3 drivers

# Version 1.5.0 (The neuronal necessity) / April 2, 2021
* Added SQLite module
* Added module for training/running neuronal networks
Expand Down
Loading

0 comments on commit d62070e

Please sign in to comment.