aboutsummaryrefslogtreecommitdiffstats
path: root/make/joal-alc.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'make/joal-alc.cfg')
-rwxr-xr-xmake/joal-alc.cfg21
1 files changed, 19 insertions, 2 deletions
diff --git a/make/joal-alc.cfg b/make/joal-alc.cfg
index cdc24bb..5425fec 100755
--- a/make/joal-alc.cfg
+++ b/make/joal-alc.cfg
@@ -12,7 +12,9 @@ ProcAddressTableClassName ALCProcAddressTable
GetProcAddressTableExpr ALProcAddressLookup.getALCProcAddressTable()
ProcAddressNameExpr LP $UPPERCASE({0})
+Import java.io.UnsupportedEncodingException
Import java.nio.*
+Import java.util.*
Import net.java.games.joal.*
Import net.java.games.joal.impl.*
@@ -25,8 +27,18 @@ Ignore ^ALC_.+
# to use this routine to look up the ALC function pointers.
Ignore alcGetProcAddress
-# These routines use or return strings
-ReturnsString alcGetString
+# Move the body of alcGetString to a private method so we can
+# implement alcGetString(NULL, ALC_DEVICE_SPECIFIER) in another method
+RenameJavaMethod alcGetString alcGetStringImpl
+# Specify the return length of this function with our own custom strlen
+ReturnValueCapacity alcGetString strlen_alc(_ptr0, {1}, _res)
+
+# Note that we don't declare this as "ReturnsString" because we're
+# going to wrap it in another method
+IncludeAs CustomJavaCode ALC joal-alc-CustomJavaCode.java
+IncludeAs CustomJavaCode ALCImpl joal-alc-impl-CustomJavaCode.java
+
+# These routines use strings
ArgumentIsString alcIsExtensionPresent 1
ArgumentIsString alcOpenDevice 0
@@ -54,4 +66,9 @@ SkipProcAddressGen alcMakeContextCurrent
JavaEpilogue alcOpenDevice ALProcAddressLookup.resetALCProcAddressTable();
JavaEpilogue alcMakeContextCurrent ALProcAddressLookup.resetALProcAddressTable();
+# To be able to use alcGetString before a context is created we need
+# to instrument that routine as well
+JavaPrologue alcGetString ALProcAddressLookup.resetALCProcAddressTable();
+
IncludeAs CustomCCode joal-common-CustomCCode.c
+IncludeAs CustomCCode joal-alc-impl-CustomCCode.c