English
Opportunities and suggestions

Parameterzahl with DLL-functions raise/settle

 

H.Brill
sometimes wealthy The 15 Parameter Yes not.
see
oGL("gluLookAt", P1....P19)

from the Glu32.dll

If it technical machbar would, could evtl. one SET - commands,
the The amount angibt or. from/einschaltet helpful his :
SET("DLLParameters", x%)
SET("DLLParameters", 0/1)

If oGL already the benefit the API anbietet, should too any
functions useable his.

or white someone, How one obiger oGL-function yet differently
The 19 Parameter commit ?
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
08/01/23  
 




Jens-Arne
Reumschüssel
we've the Topic in detail in Paule's PC-Forum discusses - herausgekommen is that here. On these point can as much as you want Parameter for a Funktionsaufruf benefit. you'll Piece for Piece on the Stack gepusht and then becomes The function called, The these Parameter uses.

declare _params&[],_hGluDll&,_gluLookAtFuncAddr&
declare eyeX!,eyeY!,eyeZ!,centerX!,centerY!,centerZ!,upX!,upY!,upZ!

ASM "LoopAndCall",3 'here becomes The Parameteranzahl with transfer and of/ one Loop worn out
MOV ECX,Par1 // ECX=Count-tab for Loop with the amount Parameter in the aray loading, becomes each Loop circa 1 verringert (Parameter-number in the aray, The Parameter must backward on the Stack gepusht go [FILO])
// MOV EDX,Par2 // Offset the aray-Speichers in EDX loading - not necessary, EDX can we for something other aufsparen (z.B. for a Multiplikation) and instead simply Par2 using
Loop:
MOV EAX,ECX // actually Schleifenzählerstand (=Nummer the current Paramters in the aray) in EAX loading
SUB EAX,1 // EAX=ECX-1 (memory-Offset in the aray is nullbasiert)
ADD EAX,EAX // EAX=EAX+EAX --> in the Endeffekt =EAX*2
ADD EAX,EAX // EAX=EAX+EAX --> in the Endeffekt together with the row before it =EAX*4 (this is the Offset for Parameter in the aray-memory)
// so went The Multiplikation too:
// MOV EDX,4
// MUL EDX // multipliziert whom Content the EAX-Registers with the Content the EDX-Registers (4) and writes the Result in that EAX-tab back
ADD EAX,Par2 //,EDX // Offset the aray-Speicherbereichs To EAX dazuaddieren
MOV EBX,EAX // Speicheradresse in EBX write (really not necessary, but so is it klarer)
MOV EAX,[EBX] // Parameter on the Speicheradresse in EAX loading - it went too MOV EAX,[EAX] (so would one EBX for something other aufsparen and could the row hiervor save)
PUSH EAX // Parameter on the Stack pushen
LOOP Loop // ECX circa 1 to diminish and zurückspringen, To 0 access is
CALL Par3 // function Call
ENDASM

cls
_hGluDll&=@usedll("glu32.dll")
_gluLookAtFuncAddr&=@external("kernel32.dll","GetProcAddress",_hGluDll&,"gluLookAt") 'address the aufzurufenden function detect
_params&[1]=@long(@addr(eyeX!),0)
_params&[2]=@long(@addr(eyeX!),4)
_params&[3]=@long(@addr(eyeY!),0)
_params&[4]=@long(@addr(eyeY!),4)
_params&[5]=@long(@addr(eyeZ!),0)
_params&[6]=@long(@addr(eyeZ!),4)
_params&[7]=@long(@addr(centerX!),0)
_params&[8]=@long(@addr(centerX!),4)
_params&[9]=@long(@addr(centerY!),0)
_params&[10]=@long(@addr(centerY!),4)
_params&[11]=@long(@addr(centerZ!),0)
_params&[12]=@long(@addr(centerZ!),4)
_params&[13]=@long(@addr(upX!),0)
_params&[14]=@long(@addr(upX!),4)
_params&[15]=@long(@addr(upY!),0)
_params&[16]=@long(@addr(upY!),4)
_params&[17]=@long(@addr(upZ!),0)
_params&[18]=@long(@addr(upZ!),4)
print LoopAndCall(18,@addr(_params&[1]),_gluLookAtFuncAddr&) '1. Parameter: amount Parameter, 2. Parameter: address the Parameter-Arrays, 3. Parameter: Funktionsadresse
waitinput
freedll _hGluDll&
end

Please verzeiht me whom Assembler-code, I have yet never (sic!) something Sinnvolles in Assembler zustandebekommen, though I it often attempts have. from this reason have I the so intense and presumably very amateurish comments. probably would someone, the itself so really auskennt, the eleganter make, but it functions.

best Regards, Jens-Arne
 
XProfan X4 * Prf2Cpp * XPSE * JRPC3 * Win11 Pro 64bit * PC i7-7700K@4,2GHz, 32 GB RAM
PM: jreumsc@web.de
08/04/23  
 




Jens-Arne
Reumschüssel
so, and can me now Please someone explain, as his can, that gluLookAt in glu32.dll nine *Float*-values as Parameter expects, The 64 bit wide are? eachone 32-bit-Compiler commit 32-bit-values as Parameter on the Stack. How should because something like without our mühsamen Workaround-Murks supra Please weg? the can I not at all realize.

See  [...] 

Greeting, Jens-Arne
 
XProfan X4
XProfan X4 * Prf2Cpp * XPSE * JRPC3 * Win11 Pro 64bit * PC i7-7700K@4,2GHz, 32 GB RAM
PM: jreumsc@web.de
08/04/23  
 




Sven
Bader
too here once more thanks for your crazy Assembler function!

in the OpenGL DLL is each function multiple include for 2, sometimes 5 Datentypen. the sees the so from:

glTranslatef() for 32 bit Float
glTranslated() for 64 bit Float

The function corresponds to the XProfan ogl("move",x,y,z)

glu shining this Anatz not to follow and takes then in the doubt sooner time double, what naturally in the 3D-context not wrong is.
 
08/05/23  
 




Jens-Arne
Reumschüssel
I have The ASM-Function for the different Calling-Conventions generalisiert, so so each erdenkliche 32-bit-DLL bedient go can. Also have I tappt im dunkeln in PushParamsAndCall umbenannt.

declare _params&[],_hGluDll&,_gluLookAtFuncAddr&
declare eyeX!,eyeY!,eyeZ!,centerX!,centerY!,centerZ!,upX!,upY!,upZ!

def &stdcall 1 'Parameter absteigend on the Stack, function bereinigt whom Stack
def &cdecl 2 'Parameter absteigend on the Stack, Aufrufer must whom Stack self bereinigen
def &pascal 3 'Parameter ascending on the Stack, function bereinigt whom Stack

ASM "PushParamsAndCall",4
MOV ECX,Par1 'ECX=Count-tab for Loop with the amount Parameter in the aray loading, becomes each Loop circa 1 verringert (Parameter-number in the aray, The Parameter must, except with Pascal-Calling-Convention, backward on the Stack gepusht go [FILO])
MOV EDX,Par2 'Offset the aray-Speichers in EDX loading (is faster as the grabbed over the Parameter, which too went)
MOV EAX,Par4 '1=stdcall, 2=cdecl, 3=Pascal
CMP EAX,3
JZ PascalSchleife
Loop:
MOV EAX,ECX 'actually Schleifenzählerstand (=Nummer the current Paramters in the aray) in EAX loading
DEC EAX 'EAX=ECX-1 (memory-Offset in the aray is nullbasiert); SUB EAX,1 went too
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt =EAX*2
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt together with the row before it =EAX*4 (this is the Offset for Parameter in the aray-memory)
ADD EAX,EDX 'Offset the aray-Speicherbereichs To EAX dazuaddieren
MOV EAX,[EAX] 'Parameter on the Speicheradresse in EAX loading
PUSH EAX 'Parameter on the Stack pushen
LOOP Loop 'ECX circa 1 to diminish and zurückspringen, To 0 access is
JMP CallFunction
PascalSchleife:
MOV EAX,Par1
SUB EAX,ECX 'Parameter in aufsteigender Order on the Stack lay (Pascal-Calling-Convention)
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt =EAX*2
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt together with the row before it =EAX*4 (this is the Offset for Parameter in the aray-memory)
ADD EAX,EDX 'Offset the aray-Speicherbereichs To EAX dazuaddieren
MOV EAX,[EAX] 'Parameter on the Speicheradresse in EAX loading
PUSH EAX 'Parameter on the Stack pushen
LOOP PascalSchleife 'ECX circa 1 to diminish and zurückspringen, To 0 access is
CallFunction:
CALL Par3 'function aufrufen; ex here EAX not any more touch, there therein the Return Value standing (or EAX zwischenzeitlich secure)
MOV EBX,Par4 'now Verify, whether cdecl, then must the Stack manually bereinigt go
CMP EBX,2
JNZ end 'stdcall & Pascal: Stack watts already from the function bereinigt
MOV EBX,Par1
ADD EBX,EBX
ADD EBX,EBX
ADD ESP,EBX 'Stack bereinigen (cdecl)
end:
'Return-worth standing in EAX
ENDASM

cls
_hGluDll&=@usedll("glu32.dll")
_gluLookAtFuncAddr&=@external("kernel32.dll","GetProcAddress",_hGluDll&,"gluLookAt") 'address the aufzurufenden function detect
_params&[1]=@long(@addr(eyeX!),0)
_params&[2]=@long(@addr(eyeX!),4)
_params&[3]=@long(@addr(eyeY!),0)
_params&[4]=@long(@addr(eyeY!),4)
_params&[5]=@long(@addr(eyeZ!),0)
_params&[6]=@long(@addr(eyeZ!),4)
_params&[7]=@long(@addr(centerX!),0)
_params&[8]=@long(@addr(centerX!),4)
_params&[9]=@long(@addr(centerY!),0)
_params&[10]=@long(@addr(centerY!),4)
_params&[11]=@long(@addr(centerZ!),0)
_params&[12]=@long(@addr(centerZ!),4)
_params&[13]=@long(@addr(upX!),0)
_params&[14]=@long(@addr(upX!),4)
_params&[15]=@long(@addr(upY!),0)
_params&[16]=@long(@addr(upY!),4)
_params&[17]=@long(@addr(upZ!),0)
_params&[18]=@long(@addr(upZ!),4)
print PushParamsAndCall(18,@addr(_params&[1]),_gluLookAtFuncAddr&,&stdcall) '1. Parameter: amount Parameter, 2. Parameter: address the Parameter-Arrays, 3. Parameter: Funktionsadresse, 4. Parameter: Calling-Convention
waitinput
freedll _hGluDll&
end
 
XProfan X4 * Prf2Cpp * XPSE * JRPC3 * Win11 Pro 64bit * PC i7-7700K@4,2GHz, 32 GB RAM
PM: jreumsc@web.de
08/05/23  
 




Jens-Arne
Reumschüssel
...and here The Assembler-function for XProfan To X3 (means without Inline-Assembler):

declare _cPushParamsAndCall#,_a%,_b%
dim _cPushParamsAndCall#,75 'To XProfan 9: must on long aligned his, ggf. end with nobodies top up (here's not aligned, becomes under erledigt; to XProfan 10 on 76 dimensionieren and a further $00 append)
'Opcodes in area write:
long _cPushParamsAndCall#,0=$5589E58B,$4D088B55,$0C8B4514,$83F80374,$1089C848,$01C001C0,$01D08B00,$50E2F2EB,$108B4508,$29C801C0,$01C001D0,$8B0050E2,$F0FF5510,$8B5D1483,$FB027509,$8B5D0801,$DB01DB01,$DC89EC5D
byte _cPushParamsAndCall#,72=$C2,$10,$00
'on long alignen (goes first ex XProfan 10, because it before no "re"dim given):
if ((@sizeof(_cPushParamsAndCall#)) mod 4)<>0
dim _cPushParamsAndCall#,@sizeof(_cPushParamsAndCall#)+(4-((@sizeof(_cPushParamsAndCall#)) mod 4))
endif
'Bytes in each long turnabout:
whileloop 0,@sizeof(_cPushParamsAndCall#)-4,4
_a%=@long(_cPushParamsAndCall#,&loop)
whileloop 0,3
byte @addr(_b%),&loop=@byte(@addr(_a%),3-&loop)
endwhile
long _cPushParamsAndCall#,&Loop=_b%
endwhile
'...
'... here Parameterarray fill etc.
'...
print @call(_cPushParamsAndCall#,18,@addr(_params&[1]),_gluLookAtFuncAddr&,&stdcall) '1. Parameter: amount Parameter, 2. Parameter: address the Parameter-Arrays, 3. Parameter: Funktionsadresse, 4. Parameter: Calling-Convention
dispose _cPushParamsAndCall#
 
XProfan X4 * Prf2Cpp * XPSE * JRPC3 * Win11 Pro 64bit * PC i7-7700K@4,2GHz, 32 GB RAM
PM: jreumsc@web.de
10/07/23  
 




Jens-Arne
Reumschüssel
and, because it so beautiful is, the whole again for JRPC3 with FreeBasic, because one itself so the otherwise each appeal of gluLookAt notwendige manuelle settle the Parameter-Arrays with a macro of neck create can and the whole ditto without whom XProfan-Inline-Assembler functions (means for versions to X4) - fully funktionsfähiges example:

declare _params&[],_hGluDll&,_gluLookAtFuncAddr&,_retval&
declare eyeX!,eyeY!,eyeZ!,centerX!,centerY!,centerZ!,upX!,upY!,upZ!

def &stdcall 1 'Parameter absteigend on the Stack, function bereinigt whom Stack
def &cdecl 2 'Parameter absteigend on the Stack, Aufrufer must whom Stack self bereinigen
def &pascal 3 'Parameter ascending on the Stack, function bereinigt whom Stack

fbPROC PushParamsAndCall(byval AnzParams as long,byval pArray as long,byval pFunc as long,byval CallingConv as long) as integer export
dim as ulong ReturnValue
ASM
MOV ECX,[AnzParams] 'ECX=Count-tab for Loop with the amount Parameter in the aray loading, becomes each Loop circa 1 verringert (Parameter-number in the aray, The Parameter must, except with Pascal-Calling-Convention, backward on the Stack gepusht go [FILO])
MOV EDX,[pArray] 'Offset the aray-Speichers in EDX loading (is faster as the grabbed over the Parameter, which too went)
MOV EAX,[CallingConv] '1=stdcall, 2=cdecl, 3=Pascal
CMP EAX,3
JZ PascalSchleife
Loop:
MOV EAX,ECX 'actually Schleifenzählerstand (=Nummer the current Paramters in the aray) in EAX loading
DEC EAX 'EAX=ECX-1 (memory-Offset in the aray is nullbasiert); SUB EAX,1 went too
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt =EAX*2
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt together with the row before it =EAX*4 (this is the Offset for Parameter in the aray-memory)
ADD EAX,EDX 'Offset the aray-Speicherbereichs To EAX dazuaddieren
MOV EAX,[EAX] 'Parameter on the Speicheradresse in EAX loading
PUSH EAX 'Parameter on the Stack pushen
LOOP Loop 'ECX circa 1 to diminish and zurückspringen, To 0 access is
JMP CallFunction
PascalSchleife:
MOV EAX,[AnzParams]
SUB EAX,ECX 'Parameter in aufsteigender Order on the Stack lay (Pascal-Calling-Convention)
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt =EAX*2
ADD EAX,EAX 'EAX=EAX+EAX --> in the Endeffekt together with the row before it =EAX*4 (this is the Offset for Parameter in the aray-memory)
ADD EAX,EDX 'Offset the aray-Speicherbereichs To EAX dazuaddieren
MOV EAX,[EAX] 'Parameter on the Speicheradresse in EAX loading
PUSH EAX 'Parameter on the Stack pushen
LOOP PascalSchleife 'ECX circa 1 to diminish and zurückspringen, To 0 access is
CallFunction:
CALL [pFunc] 'function aufrufen; ex here EAX not any more touch, there therein the Return Value standing (or EAX zwischenzeitlich secure)
MOV EBX,[CallingConv] 'now Verify, whether cdecl, then must the Stack manually bereinigt go
CMP EBX,2
JNZ end 'stdcall & Pascal: Stack watts already from the function bereinigt
MOV EBX,[AnzParams]
ADD EBX,EBX
ADD EBX,EBX
ADD ESP,EBX 'Stack bereinigen (cdecl)
end:
MOV [ReturnValue],EAX 'Return Value the aufgerufenen from EAX settle ("MOV [Function],EAX" not working, because JRPC3 automatically one "return 0" end the fbPROC complement, if no return-worth indicated is, circa a suitable Compilerwarnung To avoid)
END ASM
return ReturnValue
ENDPROC 'PushParamsAndCall

MACRO mcrGluLookAt(#p1#,#p2#,#p3#,#p4#,#p5#,#p6#,#p7#,#p8#,#p9#)
_params&[1]=@long(@addr(#p1#),0)
_params&[2]=@long(@addr(#p1#),4)
_params&[3]=@long(@addr(#p2#),0)
_params&[4]=@long(@addr(#p2#),4)
_params&[5]=@long(@addr(#p3#),0)
_params&[6]=@long(@addr(#p3#),4)
_params&[7]=@long(@addr(#p4#),0)
_params&[8]=@long(@addr(#p4#),4)
_params&[9]=@long(@addr(#p5#),0)
_params&[10]=@long(@addr(#p5#),4)
_params&[11]=@long(@addr(#p6#),0)
_params&[12]=@long(@addr(#p6#),4)
_params&[13]=@long(@addr(#p7#),0)
_params&[14]=@long(@addr(#p7#),4)
_params&[15]=@long(@addr(#p8#),0)
_params&[16]=@long(@addr(#p8#),4)
_params&[17]=@long(@addr(#p9#),0)
_params&[18]=@long(@addr(#p9#),4)
_retval&=@PushParamsAndCall(18,@addr(_params&[1]),_gluLookAtFuncAddr&,&stdcall) '1. Parameter: amount Parameter, 2. Parameter: address the Parameter-Arrays, 3. Parameter: Funktionsadresse, 4. Parameter: Calling-Convention
ENDMACRO 'mcrGluLookAt

cls
_hGluDll&=@usedll("glu32.dll")
_gluLookAtFuncAddr&=@external("kernel32.dll","GetProcAddress",_hGluDll&,"gluLookAt") 'address the aufzurufenden function detect
mcrGluLookAt(eyeX!,eyeY!,eyeZ!,centerX!,centerY!,centerZ!,upX!,upY!,upZ!)
print _retval&
waitinput
freedll _hGluDll&
end
 
XProfan X4
XProfan X4 * Prf2Cpp * XPSE * JRPC3 * Win11 Pro 64bit * PC i7-7700K@4,2GHz, 32 GB RAM
PM: jreumsc@web.de
10/07/23  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.001 Views

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie